/* Generated by Cython 3.0.10 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "CYTHON_CLINE_IN_TRACEBACK",
                "0"
            ]
        ],
        "depends": [
            "/usr/include/libxml2/libxml/HTMLtree.h",
            "/usr/include/libxml2/libxml/chvalid.h",
            "/usr/include/libxml2/libxml/encoding.h",
            "/usr/include/libxml2/libxml/globals.h",
            "/usr/include/libxml2/libxml/hash.h",
            "/usr/include/libxml2/libxml/tree.h",
            "/usr/include/libxml2/libxml/uri.h",
            "/usr/include/libxml2/libxml/valid.h",
            "/usr/include/libxml2/libxml/xmlIO.h",
            "/usr/include/libxml2/libxml/xmlmemory.h",
            "/usr/include/libxml2/libxml/xmlsave.h",
            "/usr/include/libxml2/libxml/xmlstring.h",
            "/usr/include/libxml2/libxml/xmlversion.h",
            "src/lxml/apihelpers.pxi",
            "src/lxml/classlookup.pxi",
            "src/lxml/cleanup.pxi",
            "src/lxml/debug.pxi",
            "src/lxml/docloader.pxi",
            "src/lxml/dtd.pxi",
            "src/lxml/extensions.pxi",
            "src/lxml/includes/__init__.pxd",
            "src/lxml/includes/c14n.pxd",
            "src/lxml/includes/config.pxd",
            "src/lxml/includes/dtdvalid.pxd",
            "src/lxml/includes/etree_defs.h",
            "src/lxml/includes/htmlparser.pxd",
            "src/lxml/includes/lxml-version.h",
            "src/lxml/includes/relaxng.pxd",
            "src/lxml/includes/schematron.pxd",
            "src/lxml/includes/tree.pxd",
            "src/lxml/includes/uri.pxd",
            "src/lxml/includes/xinclude.pxd",
            "src/lxml/includes/xmlerror.pxd",
            "src/lxml/includes/xmlparser.pxd",
            "src/lxml/includes/xmlschema.pxd",
            "src/lxml/includes/xpath.pxd",
            "src/lxml/includes/xslt.pxd",
            "src/lxml/iterparse.pxi",
            "src/lxml/nsclasses.pxi",
            "src/lxml/parser.pxi",
            "src/lxml/parsertarget.pxi",
            "src/lxml/proxy.pxi",
            "src/lxml/public-api.pxi",
            "src/lxml/readonlytree.pxi",
            "src/lxml/relaxng.pxi",
            "src/lxml/saxparser.pxi",
            "src/lxml/schematron.pxi",
            "src/lxml/serializer.pxi",
            "src/lxml/xinclude.pxi",
            "src/lxml/xmlerror.pxi",
            "src/lxml/xmlid.pxi",
            "src/lxml/xmlschema.pxi",
            "src/lxml/xpath.pxi",
            "src/lxml/xslt.pxi",
            "src/lxml/xsltext.pxi"
        ],
        "include_dirs": [
            "src/lxml",
            "src/lxml/includes",
            "/usr/include/libxml2",
            "src"
        ],
        "libraries": [
            "xslt",
            "exslt",
            "xml2",
            "rt",
            "z",
            "m"
        ],
        "name": "lxml.etree",
        "sources": [
            "src/lxml/etree.pyx"
        ]
    },
    "module_name": "lxml.etree"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#if defined(CYTHON_LIMITED_API) && 0
  #ifndef Py_LIMITED_API
    #if CYTHON_LIMITED_API+0 > 0x03030000
      #define Py_LIMITED_API CYTHON_LIMITED_API
    #else
      #define Py_LIMITED_API 0x03030000
    #endif
  #endif
#endif

#include "Python.h"

    #if PY_VERSION_HEX >= 0x030C0000
      #undef PyUnicode_IS_READY
      #define PyUnicode_IS_READY(s)  (1)
      #undef PyUnicode_READY
      #define PyUnicode_READY(s)  (0)
      #undef PyUnicode_AS_DATA
      #define PyUnicode_AS_DATA(s)  (0)
      #undef PyUnicode_GET_DATA_SIZE
      #define PyUnicode_GET_DATA_SIZE(s)  (0)
      #undef PyUnicode_GET_SIZE
      #define PyUnicode_GET_SIZE(s)  (0)
    #endif
    
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.7+ or Python 3.3+.
#else
#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
#else
#define __PYX_EXTRA_ABI_MODULE_NAME ""
#endif
#define CYTHON_ABI "3_0_10" __PYX_EXTRA_ABI_MODULE_NAME
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
#define CYTHON_HEX_VERSION 0x03000AF0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #define HAVE_LONG_LONG
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_CLINE_IN_TRACEBACK
  #define CYTHON_CLINE_IN_TRACEBACK 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 1
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS 0
  #endif
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #if PY_VERSION_HEX < 0x030400a1
    #undef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #elif !defined(CYTHON_USE_TP_FINALIZE)
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #if PY_VERSION_HEX < 0x030600B1
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5)
  #endif
  #if PY_VERSION_HEX < 0x030700A3
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if !defined(CYTHON_VECTORCALL)
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
#endif
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
            typedef unsigned char     uint8_t;
            typedef unsigned short    uint16_t;
            typedef unsigned int      uint32_t;
        #else
            typedef unsigned __int8   uint8_t;
            typedef unsigned __int16  uint16_t;
            typedef unsigned __int32  uint32_t;
        #endif
    #endif
    #if _MSC_VER < 1300
        #ifdef _WIN64
            typedef unsigned long long  __pyx_uintptr_t;
        #else
            typedef unsigned int        __pyx_uintptr_t;
        #endif
    #else
        #ifdef _WIN64
            typedef unsigned __int64    __pyx_uintptr_t;
        #else
            typedef unsigned __int32    __pyx_uintptr_t;
        #endif
    #endif
#else
    #include <stdint.h>
    typedef uintptr_t  __pyx_uintptr_t;
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif 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

#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_DefaultClassType PyClass_Type
  #define __Pyx_PyCode_New(a, p, 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)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
    #ifndef CO_OPTIMIZED
    #define CO_OPTIMIZED 0x0001
    #endif
    #ifndef CO_NEWLOCALS
    #define CO_NEWLOCALS 0x0002
    #endif
    #ifndef CO_VARARGS
    #define CO_VARARGS 0x0004
    #endif
    #ifndef CO_VARKEYWORDS
    #define CO_VARKEYWORDS 0x0008
    #endif
    #ifndef CO_ASYNC_GENERATOR
    #define CO_ASYNC_GENERATOR 0x0200
    #endif
    #ifndef CO_GENERATOR
    #define CO_GENERATOR 0x0020
    #endif
    #ifndef CO_COROUTINE
    #define CO_COROUTINE 0x0080
    #endif
#elif PY_VERSION_HEX >= 0x030B0000
  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
    if (!empty_bytes) return NULL;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
    Py_DECREF(empty_bytes);
    return result;
  }
#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, p, 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)
#endif
#endif
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef CO_COROUTINE
  #define CO_COROUTINE 0x80
#endif
#ifndef CO_ASYNC_GENERATOR
  #define CO_ASYNC_GENERATOR 0x200
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#elif CYTHON_BACKPORT_VECTORCALL
  typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
                                            size_t nargsf, PyObject *kwnames);
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  ((size_t)1 << (8 * sizeof(size_t) - 1))
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_MAJOR_VERSION >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if __PYX_LIMITED_VERSION_HEX < 0x030900B1
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if PY_MAJOR_VERSION < 3
    #if CYTHON_COMPILING_IN_PYPY
        #if PYPY_VERSION_NUM < 0x07030600
            #if defined(__cplusplus) && __cplusplus >= 201402L
                [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
            #elif defined(__GNUC__) || defined(__clang__)
                __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
            #elif defined(_MSC_VER)
                __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
            #endif
            static CYTHON_INLINE int PyGILState_Check(void) {
                return 0;
            }
        #else  // PYPY_VERSION_NUM < 0x07030600
        #endif  // PYPY_VERSION_NUM < 0x07030600
    #else
        static CYTHON_INLINE int PyGILState_Check(void) {
            PyThreadState * tstate = _PyThreadState_Current;
            return tstate && (tstate == PyGILState_GetThisThreadState());
        }
    #endif
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
  #define __Pyx_PyObject_GetIterNextFunc(obj)  (Py_TYPE(obj)->tp_iternext)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
  #define __Pyx_PyObject_GetIterNextFunc(obj)  PyIter_Next
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
#else
  #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
#endif
#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GetLength(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #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_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((int)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]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#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
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
    #undef PyUnicode_Contains
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#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
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#if CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif
#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 __Pyx_Py3Int_Check(op)       PyLong_Check(op)
  #define __Pyx_Py3Int_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
#else
  #define __Pyx_Py3Int_Check(op)       (PyLong_Check(op) || PyInt_Check(op))
  #define __Pyx_Py3Int_CheckExact(op)  (PyLong_CheckExact(op) || PyInt_CheckExact(op))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_USE_MATH_DEFINES)
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__;  (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__lxml__etree
#define __PYX_HAVE_API__lxml__etree
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include "includes/etree_defs.h"

    #ifndef PY_BIG_ENDIAN

    #ifdef _MSC_VER
    typedef unsigned __int32 uint32_t;
    #else
    #include <stdint.h>
    #endif

    static CYTHON_INLINE int _lx__is_big_endian(void) {
        union {uint32_t i; char c[4];} x = {0x01020304};
        return x.c[0] == 1;
    }
    #define PY_BIG_ENDIAN _lx__is_big_endian()
    #endif
    
#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 "etree_defs.h"
#include "libxml/xmlerror.h"
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
#include "libxml/c14n.h"
#include <limits.h>
#include <stdlib.h>

    #ifdef ZLIB_VERNUM
      #define __lxml_zlib_version (ZLIB_VERNUM >> 4)
    #else
      #define __lxml_zlib_version 0
    #endif
    #ifdef _LIBICONV_VERSION
      #define __lxml_iconv_version (_LIBICONV_VERSION << 8)
    #else
      #define __lxml_iconv_version 0
    #endif
    
#include "stdarg.h"
#include "libxml/parser.h"
#include "libxml/SAX2.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/imports.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 */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#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 int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#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
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
#include <string.h>
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = (char) c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#include <string.h>
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


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

#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char *__pyx_f[] = {
  "src/lxml/etree.pyx",
  "src/lxml/xmlerror.pxi",
  "src/lxml/parser.pxi",
  "src/lxml/saxparser.pxi",
  "src/lxml/parsertarget.pxi",
  "src/lxml/xslt.pxi",
  "src/lxml/proxy.pxi",
  "src/lxml/apihelpers.pxi",
  "src/lxml/readonlytree.pxi",
  "src/lxml/classlookup.pxi",
  "src/lxml/serializer.pxi",
  "src/lxml/extensions.pxi",
  "src/lxml/nsclasses.pxi",
  "src/lxml/docloader.pxi",
  "src/lxml/iterparse.pxi",
  "src/lxml/xmlid.pxi",
  "src/lxml/xinclude.pxi",
  "src/lxml/cleanup.pxi",
  "src/lxml/xpath.pxi",
  "src/lxml/xsltext.pxi",
  "src/lxml/dtd.pxi",
  "src/lxml/relaxng.pxi",
  "src/lxml/xmlschema.pxi",
  "src/lxml/schematron.pxi",
  "src/lxml/public-api.pxi",
  "src/lxml/debug.pxi",
  "type.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* #### Code section: numeric_typedefs ### */
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_4lxml_5etree_Error;
struct __pyx_obj_4lxml_5etree_LxmlError;
struct __pyx_obj_4lxml_5etree_C14NError;
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_LxmlRegistryError;
struct __pyx_obj_4lxml_5etree_NamespaceRegistryError;
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_ParserError;
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_SerialisationError;
struct __pyx_obj_4lxml_5etree__FilelikeWriter;
struct __pyx_obj_4lxml_5etree_C14NWriterTarget;
struct __pyx_obj_4lxml_5etree_xmlfile;
struct __pyx_obj_4lxml_5etree_htmlfile;
struct __pyx_obj_4lxml_5etree__IncrementalFileWriter;
struct __pyx_obj_4lxml_5etree__AsyncDataWriter;
struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter;
struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement;
struct __pyx_obj_4lxml_5etree__FileWriterElement;
struct __pyx_obj_4lxml_5etree__MethodChanger;
struct __pyx_obj_4lxml_5etree_iterparse;
struct __pyx_obj_4lxml_5etree_iterwalk;
struct __pyx_obj_4lxml_5etree__IDDict;
struct __pyx_obj_4lxml_5etree_XIncludeError;
struct __pyx_obj_4lxml_5etree_XInclude;
struct __pyx_obj_4lxml_5etree_XPathError;
struct __pyx_obj_4lxml_5etree_XPathEvalError;
struct __pyx_obj_4lxml_5etree_XPathFunctionError;
struct __pyx_obj_4lxml_5etree_XPathResultError;
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_XSLTError;
struct __pyx_obj_4lxml_5etree_XSLTParseError;
struct __pyx_obj_4lxml_5etree_XSLTApplyError;
struct __pyx_obj_4lxml_5etree_XSLTExtensionError;
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_DocumentInvalid;
struct __pyx_obj_4lxml_5etree__Validator;
struct __pyx_obj_4lxml_5etree_DTDError;
struct __pyx_obj_4lxml_5etree_DTDParseError;
struct __pyx_obj_4lxml_5etree_DTDValidateError;
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_RelaxNGError;
struct __pyx_obj_4lxml_5etree_RelaxNGParseError;
struct __pyx_obj_4lxml_5etree_RelaxNGValidateError;
struct __pyx_obj_4lxml_5etree_RelaxNG;
struct __pyx_obj_4lxml_5etree_XMLSchemaError;
struct __pyx_obj_4lxml_5etree_XMLSchemaParseError;
struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError;
struct __pyx_obj_4lxml_5etree_XMLSchema;
struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext;
struct __pyx_obj_4lxml_5etree_SchematronError;
struct __pyx_obj_4lxml_5etree_SchematronParseError;
struct __pyx_obj_4lxml_5etree_SchematronValidateError;
struct __pyx_obj_4lxml_5etree_Schematron;
struct __pyx_obj_4lxml_5etree__MemDebug;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities;
struct __pyx_t_4lxml_5etree_qname;
struct __pyx_opt_args_4lxml_5etree___unpackIntVersion;
struct __pyx_t_4lxml_5etree__ns_update_map;
typedef struct __pyx_t_4lxml_5etree__ns_update_map __pyx_t_4lxml_5etree__ns_update_map;
struct __pyx_t_4lxml_5etree__nscache;
typedef struct __pyx_t_4lxml_5etree__nscache __pyx_t_4lxml_5etree__nscache;
struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc;
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__hasNonWhitespaceText;
struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog;
struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags;
struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare;
struct __pyx_ctuple_int__and_int;
typedef struct __pyx_ctuple_int__and_int __pyx_ctuple_int__and_int;
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname;
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start;

/* "src/lxml/apihelpers.pxi":1539
 * 
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     NO_FILE_PATH = 0
 *     ABS_UNIX_FILE_PATH = 1
 */
enum  {
  __pyx_e_4lxml_5etree_NO_FILE_PATH = 0,
  __pyx_e_4lxml_5etree_ABS_UNIX_FILE_PATH = 1,
  __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH = 2,
  __pyx_e_4lxml_5etree_REL_FILE_PATH = 3
};

/* "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;

/* "src/lxml/saxparser.pxi":14
 * 
 * 
 * ctypedef enum _SaxParserEvents:             # <<<<<<<<<<<<<<
 *     SAX_EVENT_START    = 1 << 0
 *     SAX_EVENT_END      = 1 << 1
 */
enum __pyx_t_4lxml_5etree__SaxParserEvents {

  /* "src/lxml/saxparser.pxi":22
 *     SAX_EVENT_COMMENT  = 1 << 5
 *     SAX_EVENT_START_NS = 1 << 6
 *     SAX_EVENT_END_NS   = 1 << 7             # <<<<<<<<<<<<<<
 * 
 * ctypedef enum _ParseEventFilter:
 */
  __pyx_e_4lxml_5etree_SAX_EVENT_START = (1 << 0),
  __pyx_e_4lxml_5etree_SAX_EVENT_END = (1 << 1),
  __pyx_e_4lxml_5etree_SAX_EVENT_DATA = (1 << 2),
  __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE = (1 << 3),
  __pyx_e_4lxml_5etree_SAX_EVENT_PI = (1 << 4),
  __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT = (1 << 5),
  __pyx_e_4lxml_5etree_SAX_EVENT_START_NS = (1 << 6),
  __pyx_e_4lxml_5etree_SAX_EVENT_END_NS = (1 << 7)
};
typedef enum __pyx_t_4lxml_5etree__SaxParserEvents __pyx_t_4lxml_5etree__SaxParserEvents;

/* "src/lxml/saxparser.pxi":24
 *     SAX_EVENT_END_NS   = 1 << 7
 * 
 * ctypedef enum _ParseEventFilter:             # <<<<<<<<<<<<<<
 *     PARSE_EVENT_FILTER_START     = 1 << 0
 *     PARSE_EVENT_FILTER_END       = 1 << 1
 */
enum __pyx_t_4lxml_5etree__ParseEventFilter {

  /* "src/lxml/saxparser.pxi":30
 *     PARSE_EVENT_FILTER_END_NS    = 1 << 3
 *     PARSE_EVENT_FILTER_COMMENT   = 1 << 4
 *     PARSE_EVENT_FILTER_PI        = 1 << 5             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START = (1 << 0),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END = (1 << 1),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS = (1 << 2),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS = (1 << 3),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT = (1 << 4),
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI = (1 << 5)
};
typedef enum __pyx_t_4lxml_5etree__ParseEventFilter __pyx_t_4lxml_5etree__ParseEventFilter;

/* "src/lxml/serializer.pxi":12
 * 
 * 
 * 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
};

/* "src/lxml/serializer.pxi":1390
 * 
 * 
 * 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
};

/* "src/lxml/iterparse.pxi":232
 * 
 * 
 * cdef enum _IterwalkSkipStates:             # <<<<<<<<<<<<<<
 *     IWSKIP_NEXT_IS_START
 *     IWSKIP_SKIP_NEXT
 */
enum __pyx_t_4lxml_5etree__IterwalkSkipStates {
  __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START,
  __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT,
  __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP,
  __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP
};

/* "lxml/etree.pyx":136
 * # 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;
};

/* "lxml/etree.pyx":258
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
 */
struct __pyx_opt_args_4lxml_5etree___unpackIntVersion {
  int __pyx_n;
  int base;
};

/* "lxml/etree.pyx":353
 * 
 * # type of a function that steps from node to node
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef xmlNode *(*_node_to_node_function)(xmlNode *);

/* "src/lxml/proxy.pxi":216
 * 
 * 
 * ctypedef struct _ns_update_map:             # <<<<<<<<<<<<<<
 *     xmlNs* old
 *     xmlNs* new
 */
struct __pyx_t_4lxml_5etree__ns_update_map {
  xmlNs *old;
  xmlNs *new;
};

/* "src/lxml/proxy.pxi":221
 * 
 * 
 * ctypedef struct _nscache:             # <<<<<<<<<<<<<<
 *     _ns_update_map* ns_map
 *     size_t size
 */
struct __pyx_t_4lxml_5etree__nscache {
  __pyx_t_4lxml_5etree__ns_update_map *ns_map;
  size_t size;
  size_t last;
};

/* "src/lxml/proxy.pxi":594
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
 */
struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc {
  int __pyx_n;
  struct __pyx_obj_4lxml_5etree__BaseParser *parser;
  int is_owned;
};

/* "src/lxml/apihelpers.pxi":347
 * 
 * 
 * ctypedef struct _ns_node_ref:             # <<<<<<<<<<<<<<
 *     xmlNs* ns
 *     xmlNode* node
 */
struct __pyx_t_4lxml_5etree__ns_node_ref {
  xmlNs *ns;
  xmlNode *node;
};

/* "src/lxml/apihelpers.pxi":674
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
 */
struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText {
  int __pyx_n;
  int tail;
};

/* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 */
struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog {
  int __pyx_n;
  int c_domain;
};

/* "lxml/etree.pyx":2819
 *                 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;
};

/* "src/lxml/classlookup.pxi":210
 * # 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 *);

/* "src/lxml/parser.pxi":590
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */
struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare {
  int __pyx_n;
  int set_document_loader;
};

/* "src/lxml/parser.pxi":1496
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 */
struct __pyx_ctuple_int__and_int {
  int f0;
  int f1;
};

/* "src/lxml/serializer.pxi":1017
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 */
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname {
  int __pyx_n;
  PyObject *uri;
};

/* "src/lxml/serializer.pxi":1097
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 */
struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start {
  int __pyx_n;
  PyObject *qname_text;
};

/* "src/lxml/extensions.pxi":22
 * # 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 *);

/* "lxml/etree.pyx":207
 * 
 * # Error superclass for ElementTree compatibility
 * cdef class Error(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4lxml_5etree_Error {
  PyBaseExceptionObject __pyx_base;
};


/* "lxml/etree.pyx":211
 * 
 * # module level superclass for all exceptions
 * cdef class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     """Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
 */
struct __pyx_obj_4lxml_5etree_LxmlError {
  struct __pyx_obj_4lxml_5etree_Error __pyx_base;
};


/* "lxml/etree.pyx":230
 *     """
 * 
 * cdef class C14NError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Error during C14N serialisation.
 *     """
 */
struct __pyx_obj_4lxml_5etree_C14NError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "lxml/etree.pyx":304
 * @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;
};


/* "lxml/etree.pyx":320
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef int clear(self) except -1:
 */
struct __pyx_obj_4lxml_5etree__ExceptionContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtab;
  PyObject *_exc_info;
};


/* "src/lxml/xmlerror.pxi":38
 * @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;
  long line;
  int column;
  PyObject *_message;
  PyObject *_filename;
  char *_c_message;
  xmlChar *_c_filename;
  xmlChar *_c_path;
};


/* "src/lxml/xmlerror.pxi":187
 * 
 * 
 * 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;
};


/* "src/lxml/xmlerror.pxi":277
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     "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;
};


/* "src/lxml/xmlerror.pxi":395
 * @cython.final
 * @cython.internal
 * cdef class _ErrorLogContext:             # <<<<<<<<<<<<<<
 *     """
 *     Error log context for the 'with' statement.
 */
struct __pyx_obj_4lxml_5etree__ErrorLogContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext *__pyx_vtab;
  xmlStructuredErrorFunc old_error_func;
  void *old_error_context;
  xmlGenericErrorFunc old_xslt_error_func;
  void *old_xslt_error_context;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *old_xslt_error_log;
};


/* "src/lxml/xmlerror.pxi":432
 * 
 * 
 * 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;
};


/* "src/lxml/xmlerror.pxi":485
 *         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;
};


/* "src/lxml/xmlerror.pxi":494
 *             _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;
};


/* "src/lxml/xmlerror.pxi":512
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "lxml/etree.pyx":369
 * @cython.final
 * @cython.freelist(8)
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:             # <<<<<<<<<<<<<<
 *     """Internal base class to reference a libxml document.
 * 
 */
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;

/* "lxml/etree.pyx":543
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 */
struct __pyx_obj_4lxml_5etree_DocInfo {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_DocInfo *__pyx_vtab;
  struct LxmlDocument *_doc;
};


/* "lxml/etree.pyx":718
 * 
 * @cython.no_gc_clear
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]:             # <<<<<<<<<<<<<<
 *     """Element class.
 * 
 */
struct LxmlElement {
  PyObject_HEAD
  struct LxmlDocument *_doc;
  xmlNode *_c_node;
  PyObject *_tag;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementType;

/* "lxml/etree.pyx":1669
 * 
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, "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;
};


/* "lxml/etree.pyx":1736
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
 */
struct __pyx_obj_4lxml_5etree__Comment {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1744
 *         return "<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
 */
struct __pyx_obj_4lxml_5etree__ProcessingInstruction {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1794
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(self):
 */
struct __pyx_obj_4lxml_5etree__Entity {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "lxml/etree.pyx":1823
 * 
 * 
 * cdef class QName:             # <<<<<<<<<<<<<<
 *     """QName(text_or_uri_or_element, tag=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_QName {
  PyObject_HEAD
  PyObject *text;
  PyObject *localname;
  PyObject *namespace;
};


/* "lxml/etree.pyx":1892
 * 
 * 
 * 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;

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


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


/* "lxml/etree.pyx":2666
 * 
 * 
 * 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;

/* "lxml/etree.pyx":2697
 *                 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;

/* "lxml/etree.pyx":2734
 * @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;
};


/* "lxml/etree.pyx":2873
 *         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;
};


/* "lxml/etree.pyx":2902
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "lxml/etree.pyx":2922
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "lxml/etree.pyx":2937
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "lxml/etree.pyx":2947
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     """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;
};


/* "lxml/etree.pyx":3024
 * 
 * 
 * cdef class ElementTextIterator:             # <<<<<<<<<<<<<<
 *     """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 *_events;
  struct LxmlElement *_start_element;
};


/* "lxml/etree.pyx":3151
 * 
 * 
 * cdef class CDATA:             # <<<<<<<<<<<<<<
 *     """CDATA(data)
 * 
 */
struct __pyx_obj_4lxml_5etree_CDATA {
  PyObject_HEAD
  PyObject *_utf8_data;
};


/* "src/lxml/readonlytree.pxi":4
 * 
 * @cython.internal
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     "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;
};


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


/* "src/lxml/readonlytree.pxi":257
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/readonlytree.pxi":275
 * 
 * @cython.internal
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/readonlytree.pxi":376
 * 
 * @cython.internal
 * cdef class _OpaqueNodeWrapper:             # <<<<<<<<<<<<<<
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 */
struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper {
  PyObject_HEAD
  xmlNode *_c_node;
};


/* "src/lxml/readonlytree.pxi":383
 * @cython.final
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         """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;
};


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


/* "src/lxml/readonlytree.pxi":450
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/readonlytree.pxi":467
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     "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;
};


/* "src/lxml/readonlytree.pxi":483
 * @cython.final
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     """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;
};


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

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementBaseType;

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


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


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


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

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementClassLookupType;

/* "src/lxml/classlookup.pxi":221
 * 
 * 
 * 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;

/* "src/lxml/classlookup.pxi":263
 * # default lookup scheme
 * 
 * cdef class ElementDefaultClassLookup(ElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/classlookup.pxi":342
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;
};


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


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


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


/* "src/lxml/nsclasses.pxi":3
 * # module-level API for namespace implementations
 * 
 * cdef class LxmlRegistryError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of lxml registry errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_LxmlRegistryError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/nsclasses.pxi":7
 *     """
 * 
 * cdef class NamespaceRegistryError(LxmlRegistryError):             # <<<<<<<<<<<<<<
 *     """Error registering a namespace extension.
 *     """
 */
struct __pyx_obj_4lxml_5etree_NamespaceRegistryError {
  struct __pyx_obj_4lxml_5etree_LxmlRegistryError __pyx_base;
};


/* "src/lxml/nsclasses.pxi":13
 * 
 * @cython.internal
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     "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;
};


/* "src/lxml/nsclasses.pxi":106
 * @cython.final
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     "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;
};


/* "src/lxml/nsclasses.pxi":120
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """ElementNamespaceClassLookup(self, fallback=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_namespace_registries;
};


/* "src/lxml/nsclasses.pxi":237
 * 
 * @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;
};


/* "src/lxml/nsclasses.pxi":252
 * @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;
};


/* "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;
};


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


/* "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;
};


/* "src/lxml/docloader.pxi":162
 * 
 * @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;
};


/* "src/lxml/parser.pxi":34
 *     """
 * 
 * cdef class ParserError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Internal lxml parser error.
 *     """
 */
struct __pyx_obj_4lxml_5etree_ParserError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/parser.pxi":41
 * @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;
};


/* "src/lxml/parser.pxi":283
 * @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;
};


/* "src/lxml/parser.pxi":535
 * @cython.no_gc_clear  # May have to call "self._validator.disconnect()" on dealloc.
 * @cython.internal
 * cdef class _ParserContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef _ErrorLog _error_log
 *     cdef _ParserSchemaValidationContext _validator
 */
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;
  xmlExternalEntityLoader _orig_loader;
  PyThread_type_lock _lock;
  struct LxmlDocument *_doc;
  int _collect_ids;
};


/* "src/lxml/parser.pxi":814
 * 
 * @cython.internal
 * cdef class _BaseParser:             # <<<<<<<<<<<<<<
 *     cdef ElementClassLookup _class_lookup
 *     cdef _ResolverRegistry _resolvers
 */
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;
  int _collect_ids;
  int _resolve_external_entities;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  PyObject *_filename;
  PyObject *target;
  PyObject *_default_encoding;
  PyObject *_events_to_collect;
};


/* "src/lxml/parser.pxi":1319
 * ############################################################
 * 
 * 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;
};


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


/* "src/lxml/parser.pxi":1642
 * 
 * 
 * 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;
};


/* "src/lxml/parser.pxi":1671
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/parser.pxi":1750
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/parser.pxi":1815
 * 
 * 
 * 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;
};


/* "src/lxml/saxparser.pxi":53
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 * 
 */
struct __pyx_obj_4lxml_5etree__SaxParserTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtab;
  int _sax_event_filter;
};


/* "src/lxml/saxparser.pxi":77
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _SaxParserContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     """This class maps SAX2 events to parser target events.
 *     """
 */
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;
};


/* "src/lxml/saxparser.pxi":253
 * @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;
};


/* "src/lxml/saxparser.pxi":708
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     """TreeBuilder(self, element_factory=None, parser=None,
 *                     comment_factory=None, pi_factory=None,
 */
struct __pyx_obj_4lxml_5etree_TreeBuilder {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  PyObject *_factory;
  PyObject *_comment_factory;
  PyObject *_pi_factory;
  PyObject *_data;
  PyObject *_element_stack;
  PyObject *_element_stack_pop;
  struct LxmlElement *_last;
  int _in_tail;
  int _insert_comments;
  int _insert_pis;
};


/* "src/lxml/parsertarget.pxi":20
 * @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_start_ns;
  PyObject *_target_end_ns;
  PyObject *_target_doctype;
  PyObject *_target_pi;
  PyObject *_target_comment;
  int _start_takes_nsmap;
};


/* "src/lxml/parsertarget.pxi":123
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _TargetParserContext(_SaxParserContext):             # <<<<<<<<<<<<<<
 *     """This class maps SAX2 events to the ET parser target interface.
 *     """
 */
struct __pyx_obj_4lxml_5etree__TargetParserContext {
  struct __pyx_obj_4lxml_5etree__SaxParserContext __pyx_base;
  PyObject *_python_target;
};


/* "src/lxml/serializer.pxi":7
 * 
 * 
 * cdef class SerialisationError(LxmlError):             # <<<<<<<<<<<<<<
 *     """A libxml2 error that occurred during serialisation.
 *     """
 */
struct __pyx_obj_4lxml_5etree_SerialisationError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/serializer.pxi":609
 * @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;
};


/* "src/lxml/serializer.pxi":932
 * 
 * 
 * cdef class C14NWriterTarget:             # <<<<<<<<<<<<<<
 *     """
 *     Canonicalization writer target for the XMLParser.
 */
struct __pyx_obj_4lxml_5etree_C14NWriterTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *__pyx_vtab;
  PyObject *_write;
  PyObject *_data;
  PyObject *_qname_aware_tags;
  PyObject *_find_qname_aware_attrs;
  PyObject *_declared_ns_stack;
  PyObject *_ns_stack;
  PyObject *_prefix_map;
  PyObject *_preserve_space;
  PyObject *_pending_start;
  PyObject *_exclude_tags;
  PyObject *_exclude_attrs;
  Py_ssize_t _ignored_depth;
  int _with_comments;
  int _strip_text;
  int _rewrite_prefixes;
  int _root_seen;
  int _root_done;
};


/* "src/lxml/serializer.pxi":1290
 * # incremental serialisation
 * 
 * cdef class xmlfile:             # <<<<<<<<<<<<<<
 *     """xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)
 * 
 */
struct __pyx_obj_4lxml_5etree_xmlfile {
  PyObject_HEAD
  PyObject *output_file;
  PyObject *encoding;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *writer;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *async_writer;
  int compresslevel;
  int close;
  int buffered;
  int method;
};


/* "src/lxml/serializer.pxi":1379
 * 
 * 
 * cdef class htmlfile(xmlfile):             # <<<<<<<<<<<<<<
 *     """htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)
 * 
 */
struct __pyx_obj_4lxml_5etree_htmlfile {
  struct __pyx_obj_4lxml_5etree_xmlfile __pyx_base;
};


/* "src/lxml/serializer.pxi":1400
 * @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;
  int _method;
  int _buffered;
};


/* "src/lxml/serializer.pxi":1704
 * @cython.final
 * @cython.internal
 * cdef class _AsyncDataWriter:             # <<<<<<<<<<<<<<
 *     cdef list _data
 *     def __cinit__(self):
 */
struct __pyx_obj_4lxml_5etree__AsyncDataWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter *__pyx_vtab;
  PyObject *_data;
};


/* "src/lxml/serializer.pxi":1723
 * @cython.final
 * @cython.internal
 * cdef class _AsyncIncrementalFileWriter:             # <<<<<<<<<<<<<<
 *     cdef _IncrementalFileWriter _writer
 *     cdef _AsyncDataWriter _buffer
 */
struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *_buffer;
  PyObject *_async_outfile;
  int _flush_after_writes;
  int _should_close;
  int _buffered;
};


/* "src/lxml/serializer.pxi":1788
 * @cython.final
 * @cython.internal
 * cdef class _AsyncFileWriterElement:             # <<<<<<<<<<<<<<
 *     cdef _FileWriterElement _element_writer
 *     cdef _AsyncIncrementalFileWriter _writer
 */
struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__FileWriterElement *_element_writer;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *_writer;
};


/* "src/lxml/serializer.pxi":1813
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _FileWriterElement:             # <<<<<<<<<<<<<<
 *     cdef _IncrementalFileWriter _writer
 *     cdef object _element
 */
struct __pyx_obj_4lxml_5etree__FileWriterElement {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  PyObject *_element;
  int _new_method;
  int _old_method;
};


/* "src/lxml/serializer.pxi":1837
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _MethodChanger:             # <<<<<<<<<<<<<<
 *     cdef _IncrementalFileWriter _writer
 *     cdef int _new_method
 */
struct __pyx_obj_4lxml_5etree__MethodChanger {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
  int _new_method;
  int _old_method;
  int _entered;
  int _exited;
};


/* "src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/iterparse.pxi":239
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     """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;
  PyObject *_events;
  PyObject *_pop_event;
  PyObject *_include_siblings;
  int _index;
  int _event_filter;
  enum __pyx_t_4lxml_5etree__IterwalkSkipStates _skip_state;
};


/* "src/lxml/xmlid.pxi":58
 *     return _elementTreeFactory(doc, None), _IDDict(doc)
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xinclude.pxi":6
 * 
 * 
 * cdef class XIncludeError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Error during XInclude processing.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XIncludeError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xinclude.pxi":11
 * 
 * 
 * cdef class XInclude:             # <<<<<<<<<<<<<<
 *     """XInclude(self)
 *     XInclude processor.
 */
struct __pyx_obj_4lxml_5etree_XInclude {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/extensions.pxi":3
 * # support for extension functions in XPath and XSLT
 * 
 * cdef class XPathError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XPath errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XPathError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/extensions.pxi":7
 *     """
 * 
 * cdef class XPathEvalError(XPathError):             # <<<<<<<<<<<<<<
 *     """Error during XPath evaluation.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XPathEvalError {
  struct __pyx_obj_4lxml_5etree_XPathError __pyx_base;
};


/* "src/lxml/extensions.pxi":11
 *     """
 * 
 * cdef class XPathFunctionError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     """Internal error looking up an XPath extension function.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XPathFunctionError {
  struct __pyx_obj_4lxml_5etree_XPathEvalError __pyx_base;
};


/* "src/lxml/extensions.pxi":15
 *     """
 * 
 * cdef class XPathResultError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     """Error handling an XPath result.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XPathResultError {
  struct __pyx_obj_4lxml_5etree_XPathEvalError __pyx_base;
};


/* "src/lxml/extensions.pxi":29
 * 
 * @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;
};


/* "src/lxml/extensions.pxi":23
 * 
 * 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;
};


/* "src/lxml/extensions.pxi":720
 * 
 * @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;
};


/* "src/lxml/xpath.pxi":50
 * @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;
};


/* "src/lxml/xpath.pxi":116
 * 
 * 
 * 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;
};


/* "src/lxml/xpath.pxi":221
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xpath.pxi":298
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xpath.pxi":377
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xpath.pxi":451
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xslt.pxi":5
 * 
 * 
 * cdef class XSLTError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XSLT errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XSLTError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xslt.pxi":9
 *     """
 * 
 * cdef class XSLTParseError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error parsing a stylesheet document.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XSLTParseError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":13
 *     """
 * 
 * cdef class XSLTApplyError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error running an XSL transformation.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XSLTApplyError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":21
 *     """
 * 
 * cdef class XSLTExtensionError(XSLTError):             # <<<<<<<<<<<<<<
 *     """Error registering an XSLT extension.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XSLTExtensionError {
  struct __pyx_obj_4lxml_5etree_XSLTError __pyx_base;
};


/* "src/lxml/xslt.pxi":48
 * @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;
};


/* "src/lxml/xslt.pxi":168
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     """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;
};


/* "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;
};


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


/* "src/lxml/xslt.pxi":334
 * 
 * @cython.no_gc_clear
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xslt.pxi":699
 * 
 * @cython.final
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     """The result of an XSLT evaluation.
 * 
 */
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;
};


/* "src/lxml/xslt.pxi":873
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         """parseXSL(self, parser=None)
 */
struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_obj_4lxml_5etree_PIBase __pyx_base;
};


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


/* "lxml/etree.pyx":3663
 * # Validation
 * 
 * cdef class DocumentInvalid(LxmlError):             # <<<<<<<<<<<<<<
 *     """Validation error.
 * 
 */
struct __pyx_obj_4lxml_5etree_DocumentInvalid {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "lxml/etree.pyx":3671
 * 
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     "Base class for XML validators."
 *     cdef _ErrorLog _error_log
 */
struct __pyx_obj_4lxml_5etree__Validator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "src/lxml/dtd.pxi":4
 * from lxml.includes cimport dtdvalid
 * 
 * cdef class DTDError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class for DTD errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_DTDError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/dtd.pxi":8
 *     """
 * 
 * cdef class DTDParseError(DTDError):             # <<<<<<<<<<<<<<
 *     """Error while parsing a DTD.
 *     """
 */
struct __pyx_obj_4lxml_5etree_DTDParseError {
  struct __pyx_obj_4lxml_5etree_DTDError __pyx_base;
};


/* "src/lxml/dtd.pxi":12
 *     """
 * 
 * cdef class DTDValidateError(DTDError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a DTD.
 *     """
 */
struct __pyx_obj_4lxml_5etree_DTDValidateError {
  struct __pyx_obj_4lxml_5etree_DTDError __pyx_base;
};


/* "src/lxml/dtd.pxi":24
 * @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;
};


/* "src/lxml/dtd.pxi":94
 * @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;
};


/* "src/lxml/dtd.pxi":177
 * @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;
};


/* "src/lxml/dtd.pxi":240
 * @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;
};


/* "src/lxml/dtd.pxi":270
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/relaxng.pxi":18
 * 
 * 
 * cdef class RelaxNGError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class for RelaxNG errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_RelaxNGError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/relaxng.pxi":22
 *     """
 * 
 * cdef class RelaxNGParseError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as RelaxNG.
 *     """
 */
struct __pyx_obj_4lxml_5etree_RelaxNGParseError {
  struct __pyx_obj_4lxml_5etree_RelaxNGError __pyx_base;
};


/* "src/lxml/relaxng.pxi":26
 *     """
 * 
 * cdef class RelaxNGValidateError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a RelaxNG schema.
 *     """
 */
struct __pyx_obj_4lxml_5etree_RelaxNGValidateError {
  struct __pyx_obj_4lxml_5etree_RelaxNGError __pyx_base;
};


/* "src/lxml/relaxng.pxi":34
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     """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;
};


/* "src/lxml/xmlschema.pxi":5
 * 
 * 
 * cdef class XMLSchemaError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all XML Schema errors
 *     """
 */
struct __pyx_obj_4lxml_5etree_XMLSchemaError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":9
 *     """
 * 
 * cdef class XMLSchemaParseError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as XML Schema.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XMLSchemaParseError {
  struct __pyx_obj_4lxml_5etree_XMLSchemaError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":13
 *     """
 * 
 * cdef class XMLSchemaValidateError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with an XML Schema.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError {
  struct __pyx_obj_4lxml_5etree_XMLSchemaError __pyx_base;
};


/* "src/lxml/xmlschema.pxi":26
 * 
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     """XMLSchema(self, etree=None, file=None)
 *     Turn a document into an XML Schema validator.
 */
struct __pyx_obj_4lxml_5etree_XMLSchema {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchema *_c_schema;
  struct LxmlDocument *_doc;
  int _has_default_attributes;
  int _add_attribute_defaults;
};


/* "src/lxml/xmlschema.pxi":160
 * @cython.final
 * @cython.internal
 * cdef class _ParserSchemaValidationContext:             # <<<<<<<<<<<<<<
 *     cdef XMLSchema _schema
 *     cdef xmlschema.xmlSchemaValidCtxt* _valid_ctxt
 */
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;
};


/* "src/lxml/schematron.pxi":5
 * 
 * 
 * cdef class SchematronError(LxmlError):             # <<<<<<<<<<<<<<
 *     """Base class of all Schematron errors.
 *     """
 */
struct __pyx_obj_4lxml_5etree_SchematronError {
  struct __pyx_obj_4lxml_5etree_LxmlError __pyx_base;
};


/* "src/lxml/schematron.pxi":9
 *     """
 * 
 * cdef class SchematronParseError(SchematronError):             # <<<<<<<<<<<<<<
 *     """Error while parsing an XML document as Schematron schema.
 *     """
 */
struct __pyx_obj_4lxml_5etree_SchematronParseError {
  struct __pyx_obj_4lxml_5etree_SchematronError __pyx_base;
};


/* "src/lxml/schematron.pxi":13
 *     """
 * 
 * cdef class SchematronValidateError(SchematronError):             # <<<<<<<<<<<<<<
 *     """Error while validating an XML document with a Schematron schema.
 *     """
 */
struct __pyx_obj_4lxml_5etree_SchematronValidateError {
  struct __pyx_obj_4lxml_5etree_SchematronError __pyx_base;
};


/* "src/lxml/schematron.pxi":21
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     """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;
};


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


/* "src/lxml/serializer.pxi":589
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file {
  PyObject_HEAD
  PyObject *__pyx_v_compression;
  PyObject *__pyx_v_f;
  PyObject *__pyx_v_file;
  PyObject *__pyx_v_zf;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
};


/* "src/lxml/serializer.pxi":1005
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces {
  PyObject_HEAD
  PyObject *__pyx_v_namespaces;
  PyObject *__pyx_v_ns_stack;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "src/lxml/serializer.pxi":1359
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1370
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_exc_tb;
  PyObject *__pyx_v_exc_type;
  PyObject *__pyx_v_exc_val;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_old_writer;
  PyObject *__pyx_v_raise_on_error;
  struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1746
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1752
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_doctype;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
  PyObject *__pyx_v_standalone;
  PyObject *__pyx_v_version;
};


/* "src/lxml/serializer.pxi":1758
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_doctype;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1764
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_method;
  PyObject *__pyx_v_pretty_print;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
  PyObject *__pyx_v_with_tail;
};


/* "src/lxml/serializer.pxi":1777
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  int __pyx_v_raise_on_error;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1797
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ {
  PyObject_HEAD
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1803
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_data;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1865
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self;
};


/* "src/lxml/serializer.pxi":1869
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     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_13_itervalues {
  PyObject_HEAD
  xmlEnumeration *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self;
};


/* "src/lxml/dtd.pxi":223
 *            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_14_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;
};


/* "src/lxml/dtd.pxi":326
 *        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_15_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;
};


/* "src/lxml/dtd.pxi":339
 *         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_16_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;
};



/* "lxml/etree.pyx":304
 * @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 *);


/* "lxml/etree.pyx":320
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef int clear(self) except -1:
 */

struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext {
  int (*clear)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  int (*_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;


/* "src/lxml/xmlerror.pxi":38
 * @cython.final
 * @cython.freelist(16)
 * cdef class _LogEntry:             # <<<<<<<<<<<<<<
 *     """A log message entry from an error log.
 * 
 */

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


/* "src/lxml/xmlerror.pxi":187
 * 
 * 
 * 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);
  int (*_receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *);
  int (*_receiveGeneric)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, 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 int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *);
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, 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 *);


/* "src/lxml/xmlerror.pxi":277
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     "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;


/* "src/lxml/xmlerror.pxi":395
 * @cython.final
 * @cython.internal
 * cdef class _ErrorLogContext:             # <<<<<<<<<<<<<<
 *     """
 *     Error log context for the 'with' statement.
 */

struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext {
  int (*push_error_log)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
  int (*pop_error_log)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext *__pyx_vtabptr_4lxml_5etree__ErrorLogContext;
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *);


/* "src/lxml/xmlerror.pxi":432
 * 
 * 
 * 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 *);


/* "src/lxml/xmlerror.pxi":485
 *         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;


/* "src/lxml/xmlerror.pxi":494
 *             _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;


/* "src/lxml/xmlerror.pxi":512
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     """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;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "lxml/etree.pyx":369
 * @cython.final
 * @cython.freelist(8)
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:             # <<<<<<<<<<<<<<
 *     """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 *);


/* "lxml/etree.pyx":543
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 */

struct __pyx_vtabstruct_4lxml_5etree_DocInfo {
  xmlDtd *(*_get_c_dtd)(struct __pyx_obj_4lxml_5etree_DocInfo *);
};
static struct __pyx_vtabstruct_4lxml_5etree_DocInfo *__pyx_vtabptr_4lxml_5etree_DocInfo;
static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *);


/* "lxml/etree.pyx":1669
 * 
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, "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;


/* "lxml/etree.pyx":1736
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(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;


/* "lxml/etree.pyx":1744
 *         return "<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(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;


/* "lxml/etree.pyx":1794
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     @property
 *     def tag(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;

/* "lxml/etree.pyx":1892
 * 
 * 
 * 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;

/* "lxml/etree.pyx":2666
 * 
 * 
 * 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;

/* "lxml/etree.pyx":2697
 *                 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;


/* "lxml/etree.pyx":2734
 * @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 *);


/* "lxml/etree.pyx":2873
 *         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 *);


/* "lxml/etree.pyx":2902
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;


/* "lxml/etree.pyx":2922
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;


/* "lxml/etree.pyx":2937
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     """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;


/* "lxml/etree.pyx":2947
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     """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 *);


/* "src/lxml/readonlytree.pxi":4
 * 
 * @cython.internal
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     "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;


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

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;


/* "src/lxml/readonlytree.pxi":257
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/readonlytree.pxi":275
 * 
 * @cython.internal
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/readonlytree.pxi":383
 * @cython.final
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         """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);


/* "src/lxml/readonlytree.pxi":427
 * 
 * @cython.internal
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/readonlytree.pxi":450
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/readonlytree.pxi":467
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     "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;


/* "src/lxml/readonlytree.pxi":483
 * @cython.final
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     """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);


/* "src/lxml/classlookup.pxi":97
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/classlookup.pxi":126
 *         self._init()
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/classlookup.pxi":157
 *         self._init()
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     """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;

/* "src/lxml/classlookup.pxi":221
 * 
 * 
 * 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;


/* "src/lxml/classlookup.pxi":342
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/classlookup.pxi":394
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/classlookup.pxi":411
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/classlookup.pxi":466
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/nsclasses.pxi":13
 * 
 * @cython.internal
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     "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;


/* "src/lxml/nsclasses.pxi":106
 * @cython.final
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     "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;


/* "src/lxml/nsclasses.pxi":120
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/nsclasses.pxi":237
 * 
 * @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;


/* "src/lxml/nsclasses.pxi":252
 * @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;


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


/* "src/lxml/docloader.pxi":162
 * 
 * @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;


/* "src/lxml/parser.pxi":41
 * @cython.final
 * @cython.internal
 * cdef class _ParserDictionaryContext:             # <<<<<<<<<<<<<<
 *     # Global parser context to share the string dictionary.
 *     #
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext {
  int (*initMainParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*_findThreadParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  int (*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 *);
  int (*initThreadDictRef)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
  int (*initParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
  int (*initXPathParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
  int (*initDocDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*findImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  int (*pushImpliedContextFromParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  int (*pushImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*popImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
static int __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 int __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 int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
static int __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 int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);


/* "src/lxml/parser.pxi":283
 * @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);


/* "src/lxml/parser.pxi":535
 * @cython.no_gc_clear  # May have to call "self._validator.disconnect()" on dealloc.
 * @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 *, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args);
  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;


/* "src/lxml/parser.pxi":814
 * 
 * @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 (*_configureSaxContext)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);
  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;
static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);


/* "src/lxml/parser.pxi":1319
 * ############################################################
 * 
 * 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;


/* "src/lxml/parser.pxi":1552
 *     )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema: XMLSchema =None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, collect_ids=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;


/* "src/lxml/parser.pxi":1642
 * 
 * 
 * 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;


/* "src/lxml/parser.pxi":1671
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/parser.pxi":1750
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/parser.pxi":1815
 * 
 * 
 * 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;


/* "src/lxml/saxparser.pxi":53
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 * 
 */

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 *);
  PyObject *(*_handleSaxStartNs)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *);
  PyObject *(*_handleSaxEndNs)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;


/* "src/lxml/saxparser.pxi":77
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _SaxParserContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/saxparser.pxi":708
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     """TreeBuilder(self, element_factory=None, parser=None,
 *                     comment_factory=None, pi_factory=None,
 */

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


/* "src/lxml/parsertarget.pxi":20
 * @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;


/* "src/lxml/parsertarget.pxi":123
 * @cython.internal
 * @cython.no_gc_clear  # Required because parent class uses it - Cython bug.
 * cdef class _TargetParserContext(_SaxParserContext):             # <<<<<<<<<<<<<<
 *     """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 *);


/* "src/lxml/serializer.pxi":609
 * @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 *);


/* "src/lxml/serializer.pxi":932
 * 
 * 
 * cdef class C14NWriterTarget:             # <<<<<<<<<<<<<<
 *     """
 *     Canonicalization writer target for the XMLParser.
 */

struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget {
  PyObject *(*_resolve_prefix_name)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *);
  PyObject *(*_qname)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args);
  PyObject *(*_flush)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *);
  PyObject *(*_start)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *__pyx_vtabptr_4lxml_5etree_C14NWriterTarget;


/* "src/lxml/serializer.pxi":1400
 * @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);


/* "src/lxml/serializer.pxi":1704
 * @cython.final
 * @cython.internal
 * cdef class _AsyncDataWriter:             # <<<<<<<<<<<<<<
 *     cdef list _data
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter {
  PyObject *(*collect)(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter *__pyx_vtabptr_4lxml_5etree__AsyncDataWriter;
static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *);


/* "src/lxml/serializer.pxi":1723
 * @cython.final
 * @cython.internal
 * cdef class _AsyncIncrementalFileWriter:             # <<<<<<<<<<<<<<
 *     cdef _IncrementalFileWriter _writer
 *     cdef _AsyncDataWriter _buffer
 */

struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter {
  PyObject *(*_flush)(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter;
static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *);


/* "src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     """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 *);


/* "src/lxml/iterparse.pxi":239
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     """iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_iterwalk {
  xmlNode *(*_process_non_elements)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *);
  PyObject *(*_next_event)(struct __pyx_obj_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;
static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *);
static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *);
static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *);
static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *);


/* "src/lxml/xmlid.pxi":58
 *     return _elementTreeFactory(doc, None), _IDDict(doc)
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/extensions.pxi":457
 * @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 *);


/* "src/lxml/extensions.pxi":29
 * 
 * @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 *);


/* "src/lxml/xpath.pxi":50
 * @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 *);


/* "src/lxml/xpath.pxi":116
 * 
 * 
 * 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 *(*_build_parse_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_build_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 *);


/* "src/lxml/xpath.pxi":221
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xpath.pxi":298
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xpath.pxi":377
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xpath.pxi":451
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xslt.pxi":48
 * @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 *);


/* "src/lxml/xslt.pxi":168
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     """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);


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


/* "src/lxml/xslt.pxi":334
 * 
 * @cython.no_gc_clear
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xslt.pxi":699
 * 
 * @cython.final
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     """The result of an XSLT evaluation.
 * 
 */

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


/* "src/lxml/xslt.pxi":873
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         """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;


/* "src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     """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;


/* "lxml/etree.pyx":3671
 * 
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     "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;


/* "src/lxml/dtd.pxi":270
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/relaxng.pxi":34
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xmlschema.pxi":26
 * 
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     """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;


/* "src/lxml/xmlschema.pxi":160
 * @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 *);


/* "src/lxml/schematron.pxi":21
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     """Schematron(self, etree=None, file=None)
 *     A Schematron validator.
 */

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;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
  #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
#endif
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #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); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#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)

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* TupleAndListFromArray.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto */
#include <string.h>

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

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

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
#else
    #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
#endif
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
    #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
#else
    #define __Pyx_Arg_NewRef_VARARGS(arg) arg
    #define __Pyx_Arg_XDECREF_VARARGS(arg)
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_Arg_FASTCALL(args, i) args[i]
    #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
    #define __Pyx_Arg_NewRef_FASTCALL(arg) arg  /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
                                                   to have the same reference counting */
    #define __Pyx_Arg_XDECREF_FASTCALL(arg)
#else
    #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
    #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
    #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
#else
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

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

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

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

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

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

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

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#if !CYTHON_VECTORCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if !CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03080000
  #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #define __Pxy_PyFrame_Initialize_Offsets()
  #define __Pyx_PyFrame_GetLocalsplus(frame)  ((frame)->f_localsplus)
#else
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif
#endif
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);

/* PyObjectCallNoArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

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

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

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

/* decode_bytes.proto */
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)) {
    char* as_c_string;
    Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS
    as_c_string = PyBytes_AS_STRING(string);
    size = PyBytes_GET_SIZE(string);
#else
    if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) {
        return NULL;
    }
#endif
    return __Pyx_decode_c_bytes(
        as_c_string, size,
        start, stop, encoding, errors, decode_func);
}

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#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);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
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);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* ModInt[int].proto */
static CYTHON_INLINE int __Pyx_mod_int(int, int);

/* DivInt[int].proto */
static CYTHON_INLINE int __Pyx_div_int(int, int);

/* UnaryNegOverflows.proto */
#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed);

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

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (1)
#elif CYTHON_COMPILING_IN_LIMITED_API  ||  (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000)
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* GCCDiagnostics.proto */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* BuildPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char, char format_char);

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

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

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

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

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

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
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);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

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

/* HasAttr.proto */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

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

/* DivInt[Py_ssize_t].proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* pop.proto */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
#define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
    __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
#else
#define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
#define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
#endif

/* SliceTupleAndList.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

/* DivInt[long].proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

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

/* ImportDottedModule.proto */
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
#endif

/* RaiseUnboundLocalError.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

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

/* PyObject_Unicode.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
#else
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right)
    #endif
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_ConcatInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_ConcatInPlaceSafe(left, right) ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_ConcatInPlace(left, right))

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

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
#define __Pyx_PyCallable_Check(obj)   (Py_TYPE(obj)->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyUnicode_Substring.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop);

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* IncludeStructmemberH.proto */
#include <structmember.h>

/* FixUpExtensionType.proto */
#if CYTHON_USE_TYPE_SPECS
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
#endif

/* FetchSharedCythonModule.proto */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto */
#if !CYTHON_USE_TYPE_SPECS
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#else
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
#endif

/* PyObjectCall2Args.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);

/* GeneratorYieldFrom.proto */
static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyUnicodeContains.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
    int result = PyUnicode_Contains(text, substring);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PySet_Update.proto */
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it);

/* PyMethodNew.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    typesModule = PyImport_ImportModule("types");
    if (!typesModule) return NULL;
    methodType = PyObject_GetAttrString(typesModule, "MethodType");
    Py_DECREF(typesModule);
    if (!methodType) return NULL;
    result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
    Py_DECREF(methodType);
    return result;
}
#elif PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#else
    #define __Pyx_PyMethod_New PyMethod_New
#endif

/* PyVectorcallFastCallDict.proto */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (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 {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_BACKPORT_VECTORCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
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(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_BACKPORT_VECTORCALL
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* unicode_iter.proto */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind);

/* ReturnWithStopIteration.proto */
#define __Pyx_ReturnWithStopIteration(value)\
    if (value == Py_None) PyErr_SetNone(PyExc_StopIteration); else __Pyx__ReturnWithStopIteration(value)
static void __Pyx__ReturnWithStopIteration(PyObject* value);

/* Coroutine.proto */
#define __Pyx_Coroutine_USED
#define __Pyx_Coroutine_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineType)
#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj)
#define __Pyx_CoroutineAwait_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineAwaitType)
#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_CoroutineType, body, code, closure, name, qualname, module_name)
static int __pyx_Coroutine_init(PyObject *module);
static PyObject *__Pyx__Coroutine_await(PyObject *coroutine);
typedef struct {
    PyObject_HEAD
    PyObject *coroutine;
} __pyx_CoroutineAwaitObject;
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg);
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args);

/* GetAwaitIter.proto */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o);
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o);

/* CoroutineYieldFrom.proto */
static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source);

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

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

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* set_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set);
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char, char format_char);

/* ErrOccurredWithGIL.proto */
static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void);

/* PyObject_Str.proto */
#define __Pyx_PyObject_Str(obj)\
    (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

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

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear);

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#else
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* ValidateExternBase.proto */
static int __Pyx_validate_extern_base(PyTypeObject *base);

/* ValidateBasesTuple.proto */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type);
#endif

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_10
#define __PYX_HAVE_RT_ImportType_proto_3_0_10
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_0_10(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_0_10(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_0_10 {
   __Pyx_ImportType_CheckSize_Error_3_0_10 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_0_10 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_0_10 = 2
};
static PyTypeObject *__Pyx_ImportType_3_0_10(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_10 check_size);
#endif

/* Py3UpdateBases.proto */
static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

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

/* PatchInspect.proto */
static PyObject* __Pyx_patch_inspect(PyObject* module);

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

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

/* RegisterModuleCleanup.proto */
static void __pyx_module_cleanup(PyObject *self);
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static int __Pyx_RegisterCleanup(void);
#else
#define __Pyx_RegisterCleanup() (0)
#endif

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __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);
#endif

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

/* UnicodeAsUCS4.proto */
static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlParserErrors(xmlParserErrors value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE signed char __Pyx_PyInt_As_signed_char(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

/* CIntFromPy.proto */
static CYTHON_INLINE xmlChar __Pyx_PyInt_As_xmlChar(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlErrorDomain(xmlErrorDomain value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlErrorLevel(xmlErrorLevel value);

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

/* ObjectAsUCS4.proto */
#define __Pyx_PyObject_AsPy_UCS4(x)\
    (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x))
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CheckBinaryVersion.proto */
static unsigned long __Pyx_get_runtime_version(void);
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

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

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

/* #### Code section: module_declarations ### */
static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError const *__pyx_v_error); /* proto*/
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, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* 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); /* proto*/
static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError const *__pyx_v_error); /* proto*/
static int __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, long __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_default_message); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_ListErrorLog_copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log); /* proto*/
static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* 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); /* 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); /* 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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_copy(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, int __pyx_skip_dispatch); /* 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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch(struct LxmlElementTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag); /* proto*/
static void __pyx_f_4lxml_5etree_16_ElementIterator__storeNext(struct LxmlElementIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, int __pyx_v_node_type); /* proto*/
static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, PyObject *__pyx_v_tags); /* proto*/
static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self); /* 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); /* 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); /* proto*/
static void __pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__get(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, char *__pyx_v_name); /* proto*/
static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static int __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); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict *__pyx_v_default); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict **__pyx_v_c_dict_ref); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static int __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); /* proto*/
static int __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); /* proto*/
static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt); /* proto*/
static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_14_ParserContext__copy(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_14_ParserContext__resetParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_14_ParserContext_prepare(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args); /* proto*/
static int __pyx_f_4lxml_5etree_14_ParserContext_cleanup(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_base_url); /* proto*/
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); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
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); /* proto*/
static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt); /* proto*/
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); /* proto*/
static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_11_BaseParser__copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_filename); /* proto*/
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); /* 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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix, CYTHON_UNUSED PyObject *__pyx_v_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix); /* proto*/
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); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
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); /* proto*/
static int __pyx_f_4lxml_5etree_17_SaxParserContext_startDocument(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc); /* proto*/
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); /* proto*/
static int __pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt); /* proto*/
static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag); /* proto*/
static int __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto*/
static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment); /* proto*/
static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, PyObject *__pyx_v_target); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_20_TargetParserContext__copy(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, xmlDoc *__pyx_v_result); /* proto*/
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); /* proto*/
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); /* proto*/
static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, xmlCharEncodingHandler *__pyx_v_enchandler); /* proto*/
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); /* proto*/
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefixed_name); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__qname(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_qname, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__flush(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_new_namespaces, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_nsmap); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_error_result); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto*/
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); /* proto*/
static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_BaseContext__copy(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__to_utf(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_s); /* proto*/
static void __pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix_utf); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlNode *__pyx_v_c_node); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_variable_dict); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt); /* proto*/
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, char *__pyx_v_path); /* proto*/
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_parse_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_eval_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_7ETXPath__nsextract_path(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path); /* proto*/
static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_self); /* proto*/
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); /* proto*/
static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltTransformContext *__pyx_v_ctxt); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option); /* proto*/
static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_XSLTContext__copy(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto*/
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); /* proto*/
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
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); /* 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); /* 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); /* proto*/
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); /* proto*/
static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto*/
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); /* proto*/
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); /* proto*/
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto*/
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* 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 "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "cpython.object" */

/* 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 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_OrderedDict = 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_partial = 0;
static PyObject *__pyx_v_4lxml_5etree_islice = 0;
static PyObject *__pyx_v_4lxml_5etree_ITER_EMPTY = 0;
static PyObject *__pyx_v_4lxml_5etree_MutableMapping = 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__DEFAULT_NAMESPACE_PREFIXES_ITEMS = 0;
static PyObject *__pyx_v_4lxml_5etree__check_internal_prefix = 0;
static PyObject *__pyx_v_4lxml_5etree__Error = 0;
static int __pyx_v_4lxml_5etree__LIBXML_VERSION_INT;
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_invalid_public_id_characters = 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__ParseError = 0;
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = 0;
static const char *__pyx_v_4lxml_5etree__PY_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_inspect_getargspec = 0;
static PyObject *__pyx_v_4lxml_5etree_GzipFile = 0;
static PyObject *__pyx_v_4lxml_5etree_io_open = 0;
static PyObject *__pyx_v_4lxml_5etree_gzip = 0;
static PyObject *__pyx_v_4lxml_5etree_getwriter = 0;
static PyObject *__pyx_v_4lxml_5etree_utf8_writer = 0;
static PyObject *__pyx_v_4lxml_5etree_contextmanager = 0;
static PyObject *__pyx_v_4lxml_5etree__open_utf8_file = 0;
static PyObject *__pyx_v_4lxml_5etree__looks_like_prefix_name = 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 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 PyObject *__pyx_v_4lxml_5etree__rnc2rng = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree__check_for_default_attributes = 0;
static PyObject *__pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int, struct __pyx_opt_args_4lxml_5etree___unpackIntVersion *__pyx_optional_args); /*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 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 void __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(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__setTreeDoc(xmlNode *, xmlDoc *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixDocChildren(xmlNode *, xmlDoc *); /*proto*/
static int __pyx_f_4lxml_5etree__fixCNs(struct LxmlDocument *, xmlNode *, xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *, struct LxmlDocument *, size_t); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixThreadDictPtr(const xmlChar **, 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_fixThreadDictContentForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(xmlDtd *, xmlDict *, xmlDict *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__adoptForeignDoc(xmlDoc *, struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc *__pyx_optional_args); /*proto*/
static void __pyx_f_4lxml_5etree_displayNode(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__isHtmlDocument(struct LxmlElement *); /*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 int __pyx_f_4lxml_5etree__isAncestorOrSame(xmlNode *, xmlNode *); /*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__setNodeNamespaces(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__build_nsmap(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__iter_nsmap(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__iter_attrib(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__collectNsDefs(xmlNode *, __pyx_t_4lxml_5etree__ns_node_ref **, size_t *, size_t *); /*proto*/
static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *, PyObject *); /*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 CYTHON_INLINE int __pyx_f_4lxml_5etree__hasNonWhitespaceTail(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__hasNonWhitespaceText(xmlNode *, struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__removeText(xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createTextNode(xmlDoc *, PyObject *); /*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__linkChild(xmlNode *, xmlNode *); /*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 int __pyx_f_4lxml_5etree__addSibling(struct LxmlElement *, struct LxmlElement *, int); /*proto*/
static int __pyx_f_4lxml_5etree_isutf8l(const xmlChar *, size_t); /*proto*/
static int __pyx_f_4lxml_5etree__is_valid_xml_ascii(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__is_valid_xml_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__getFSPathOrObject(PyObject *); /*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__initThreadLogging(void); /*proto*/
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getThreadErrorLog(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__setThreadErrorLog(PyObject *, 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 const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveError(void *, xmlError const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXSLTError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__receiveRelaxNGParseError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__receiveRelaxNGValidationError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__connectGenericErrorLog(PyObject *, struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog *__pyx_optional_args); /*proto*/
static void __pyx_f_4lxml_5etree__receiveGenericError(void *, int, char *, va_list); /*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 int __pyx_f_4lxml_5etree__indent_children(xmlNode *, Py_ssize_t, PyObject *, PyObject *); /*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 PyObject *__pyx_f_4lxml_5etree__find_PyUCS4EncodingName(void); /*proto*/
static int __pyx_f_4lxml_5etree__readFilelikeParser(void *, char *, int); /*proto*/
static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(const char *, const char *, xmlParserCtxt *); /*proto*/
static xmlExternalEntityLoader __pyx_f_4lxml_5etree__register_document_loader(void); /*proto*/
static void __pyx_f_4lxml_5etree__reset_document_loader(xmlExternalEntityLoader); /*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 const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveParserError(void *, xmlError const *); /*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 xmlEntity *__pyx_f_4lxml_5etree__getInternalEntityOnly(void *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__initSaxDocument(void *); /*proto*/
static __pyx_ctuple_int__and_int __pyx_f_4lxml_5etree__parse_data_chunk(xmlParserCtxt *, char const *, int); /*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 PyObject *__pyx_f_4lxml_5etree__build_prefix_uri_list(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__handleSaxTargetPI(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 *, int, 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 unsigned char *__pyx_f_4lxml_5etree_xmlSerializeHexCharRef(unsigned char *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__write_attr_string(xmlOutputBuffer *, char const *); /*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 int __pyx_f_4lxml_5etree__serialise_node(xmlOutputBuffer *, const xmlChar *, const char *, xmlNode *, int, int, int, int, int, int); /*proto*/
static struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *, const char *, int, xmlOutputBuffer **, int); /*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 PyObject *__pyx_f_4lxml_5etree__tree_to_target(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__raise_serialization_error(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__escape_cdata_c14n(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__escape_attrib_c14n(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 const *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXPathError(void *, xmlError const *); /*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 *, const 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*/
static int __pyx_f_4lxml_5etree__require_rnc2rng(void); /*proto*/
__PYX_EXTERN_C struct LxmlElement *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *elementTreeFactory(struct LxmlElement *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *newElementTree(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElementTree *adoptExternalDocument(xmlDoc *, PyObject *, int); /*proto*/
__PYX_EXTERN_C struct LxmlElement *elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C void setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C int tagMatches(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C struct LxmlDocument *documentOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C struct LxmlElement *rootNodeOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C int hasText(xmlNode *); /*proto*/
__PYX_EXTERN_C int hasTail(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *textOf(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *tailOf(xmlNode *); /*proto*/
__PYX_EXTERN_C int setNodeText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C int setTailText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *attributeValue(xmlNode *, xmlAttr *); /*proto*/
__PYX_EXTERN_C PyObject *attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C PyObject *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *iterattributes(struct LxmlElement *, int); /*proto*/
__PYX_EXTERN_C PyObject *collectAttributes(xmlNode *, int); /*proto*/
__PYX_EXTERN_C int setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C int delAttribute(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C int delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C int hasChild(xmlNode *); /*proto*/
__PYX_EXTERN_C xmlNode *findChild(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C xmlNode *nextElement(xmlNode *); /*proto*/
__PYX_EXTERN_C xmlNode *previousElement(xmlNode *); /*proto*/
__PYX_EXTERN_C void appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C int appendChildToElement(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C PyObject *pyunicode(const xmlChar *); /*proto*/
__PYX_EXTERN_C PyObject *utf8(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *getNsTag(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *getNsTagWithEmptyNs(PyObject *); /*proto*/
__PYX_EXTERN_C PyObject *namespacedName(xmlNode *); /*proto*/
__PYX_EXTERN_C PyObject *namespacedNameFromNsName(const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C void iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C void initTagMatch(struct LxmlElementTagMatcher *, PyObject *); /*proto*/
__PYX_EXTERN_C xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "lxml.etree"
extern int __pyx_module_is_main_lxml__etree;
int __pyx_module_is_main_lxml__etree = 0;

/* Implementation of "lxml.etree" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_SyntaxError;
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_BaseException;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
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_DeprecationWarning;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_ReferenceError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_LookupError;
static PyObject *__pyx_builtin_reversed;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_NotImplementedError;
/* #### Code section: string_decls ### */
static const char __pyx_k_1[] = "[1]";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_U[] = "U";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_g[] = "g";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "<!--%s-->";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_25[] = "%25";
static const char __pyx_k_BE[] = "BE";
static const char __pyx_k_LE[] = "LE";
static const char __pyx_k_Ok[] = "Ok";
static const char __pyx_k_PI[] = "PI";
static const char __pyx_k__3[] = "-";
static const char __pyx_k__4[] = ".";
static const char __pyx_k_dc[] = "dc";
static const char __pyx_k_el[] = "el";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_gt[] = "&gt;";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_io[] = "io";
static const char __pyx_k_kw[] = "_kw";
static const char __pyx_k_lt[] = "&lt;";
static const char __pyx_k_ns[] = "ns";
static const char __pyx_k_or[] = "or";
static const char __pyx_k_pi[] = "pi";
static const char __pyx_k_py[] = "py";
static const char __pyx_k_rb[] = "rb";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_wb[] = "wb";
static const char __pyx_k_x9[] = "&#x9;";
static const char __pyx_k_xA[] = "&#xA;";
static const char __pyx_k_xD[] = "&#xD;";
static const char __pyx_k_xs[] = "xs";
static const char __pyx_k_zf[] = "zf";
static const char __pyx_k_0_9[] = "[0-9]+";
static const char __pyx_k_DTD[] = "DTD";
static const char __pyx_k_TAG[] = "TAG";
static const char __pyx_k_XML[] = "XML";
static const char __pyx_k__11[] = " ";
static const char __pyx_k__12[] = "";
static const char __pyx_k__17[] = ":";
static const char __pyx_k__18[] = "{";
static const char __pyx_k__19[] = "}";
static const char __pyx_k__20[] = ": ";
static const char __pyx_k__21[] = "\n";
static const char __pyx_k__22[] = "*";
static const char __pyx_k__24[] = "=";
static const char __pyx_k__25[] = "'";
static const char __pyx_k__26[] = "\"";
static const char __pyx_k__28[] = "\" ";
static const char __pyx_k__29[] = ">";
static const char __pyx_k__30[] = "\">";
static const char __pyx_k__32[] = "<?";
static const char __pyx_k__33[] = "?>";
static const char __pyx_k__34[] = "&";
static const char __pyx_k__35[] = ";";
static const char __pyx_k__41[] = "[";
static const char __pyx_k__42[] = "]";
static const char __pyx_k__43[] = "/";
static const char __pyx_k__45[] = "{*}*";
static const char __pyx_k__48[] = "--";
static const char __pyx_k__50[] = "]]>";
static const char __pyx_k__52[] = "  ";
static const char __pyx_k__56[] = "_";
static const char __pyx_k__57[] = "': ";
static const char __pyx_k__61[] = ")";
static const char __pyx_k__63[] = "%";
static const char __pyx_k__71[] = "<";
static const char __pyx_k__72[] = "=\"";
static const char __pyx_k__73[] = "</";
static const char __pyx_k__74[] = "<!--";
static const char __pyx_k__75[] = "-->";
static const char __pyx_k__95[] = "(";
static const char __pyx_k__96[] = ", ";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_all[] = "__all__";
static const char __pyx_k_amp[] = "&amp;";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_cls[] = "cls";
static const char __pyx_k_dev[] = "dev";
static const char __pyx_k_dic[] = "dic";
static const char __pyx_k_doc[] = "_doc";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_got[] = ", got ";
static const char __pyx_k_int[] = "int";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_len[] = "__len__";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_new[] = "new";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_old[] = "old";
static const char __pyx_k_opt[] = "opt";
static const char __pyx_k_out[] = "out";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_rdf[] = "rdf";
static const char __pyx_k_rnc[] = ".rnc";
static const char __pyx_k_s_2[] = "<?%s?>";
static const char __pyx_k_s_3[] = "&%s;";
static const char __pyx_k_s_4[] = "s";
static const char __pyx_k_s_r[] = "%s=%r";
static const char __pyx_k_seq[] = "seq";
static const char __pyx_k_set[] = "set";
static const char __pyx_k_sio[] = "sio";
static const char __pyx_k_src[] = "src";
static const char __pyx_k_sub[] = "sub";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_tag[] = "tag";
static const char __pyx_k_uri[] = "uri";
static const char __pyx_k_url[] = "url";
static const char __pyx_k_w_w[] = "^\\w+:\\w+$";
static const char __pyx_k_xml[] = "xml";
static const char __pyx_k_xsi[] = "xsi";
static const char __pyx_k_xsl[] = "xsl";
static const char __pyx_k_HTML[] = "HTML";
static const char __pyx_k_None[] = "None";
static const char __pyx_k_Type[] = "Type '";
static const char __pyx_k_UTF8[] = "UTF8";
static const char __pyx_k_XSLT[] = "XSLT";
static const char __pyx_k__106[] = "?";
static const char __pyx_k__489[] = "(\"[^\"]*\")|('[^']*')";
static const char __pyx_k__491[] = "({[^}]+})";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_c14n[] = "c14n";
static const char __pyx_k_code[] = "code";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_ctxt[] = "ctxt";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_deco[] = "__deco";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_dump[] = "dump";
static const char __pyx_k_elem[] = "elem";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_expr[] = "expr";
static const char __pyx_k_feed[] = "feed";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_find[] = "find";
static const char __pyx_k_gzip[] = "gzip";
static const char __pyx_k_href[] = "href";
static const char __pyx_k_html[] = "html";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_int1[] = "int1";
static const char __pyx_k_int2[] = "int2";
static const char __pyx_k_item[] = "item";
static const char __pyx_k_iter[] = "iter";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_line[] = ", line ";
static const char __pyx_k_load[] = "load";
static const char __pyx_k_lxml[] = "lxml";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_memo[] = "memo";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_mult[] = "mult";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_node[] = "node";
static const char __pyx_k_none[] = "none";
static const char __pyx_k_ns_d[] = "ns%d";
static const char __pyx_k_once[] = "once";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_plus[] = "plus";
static const char __pyx_k_quot[] = "&quot;";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_rexp[] = "rexp";
static const char __pyx_k_root[] = "root";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_show[] = "show";
static const char __pyx_k_spec[] = "__spec__";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_str1[] = "str1";
static const char __pyx_k_str2[] = "str2";
static const char __pyx_k_str3[] = "str3";
static const char __pyx_k_tags[] = "tags";
static const char __pyx_k_tail[] = "tail";
static const char __pyx_k_tell[] = "tell";
static const char __pyx_k_test[] = "test";
static const char __pyx_k_text[] = "text";
static const char __pyx_k_tree[] = "tree";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_utf8[] = "utf8";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_wsdl[] = "wsdl";
static const char __pyx_k_xslt[] = "_xslt";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_CDATA[] = "CDATA";
static const char __pyx_k_DEBUG[] = "DEBUG";
static const char __pyx_k_ERROR[] = "ERROR";
static const char __pyx_k_Error[] = "Error";
static const char __pyx_k_FATAL[] = "FATAL";
static const char __pyx_k_QName[] = "QName";
static const char __pyx_k_UTF_8[] = "UTF-8";
static const char __pyx_k_XMLID[] = "XMLID";
static const char __pyx_k_XPath[] = "XPath";
static const char __pyx_k_aexit[] = "__aexit__";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_at_0x[] = " at 0x";
static const char __pyx_k_attrs[] = "attrs";
static const char __pyx_k_await[] = "__await__";
static const char __pyx_k_c14n2[] = "c14n2";
static const char __pyx_k_c_doc[] = "c_doc";
static const char __pyx_k_c_dtd[] = "c_dtd";
static const char __pyx_k_cdata[] = "cdata";
static const char __pyx_k_child[] = "child";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_doc_2[] = "doc";
static const char __pyx_k_doc_3[] = "__doc__";
static const char __pyx_k_dumps[] = "dumps";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_entry[] = "entry";
static const char __pyx_k_etree[] = "etree";
static const char __pyx_k_extra[] = "_extra";
static const char __pyx_k_fixed[] = "fixed";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_flush[] = "flush";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_hrefs[] = "hrefs";
static const char __pyx_k_idref[] = "idref";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_input[] = "_input";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_level[] = "level";
static const char __pyx_k_loads[] = "loads";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_match[] = "match";
static const char __pyx_k_mixed[] = "mixed";
static const char __pyx_k_names[] = "_names";
static const char __pyx_k_nsmap[] = "nsmap";
static const char __pyx_k_occur[] = " occur=";
static const char __pyx_k_parse[] = "parse";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_rexpc[] = "rexpc";
static const char __pyx_k_space[] = "space";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_strip[] = "strip";
static const char __pyx_k_style[] = "style";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_tag_2[] = "_tag";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_types[] = "types";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_xmlns[] = "xmlns:";
static const char __pyx_k_xpath[] = "xpath";
static const char __pyx_k_Attrib[] = "_Attrib";
static const char __pyx_k_Entity[] = "Entity";
static const char __pyx_k_IDDict[] = "_IDDict";
static const char __pyx_k_PARSER[] = "PARSER";
static const char __pyx_k_PIBase[] = "PIBase";
static const char __pyx_k_PUBLIC[] = " PUBLIC \"";
static const char __pyx_k_Prefix[] = "Prefix ";
static const char __pyx_k_SYSTEM[] = " SYSTEM ";
static const char __pyx_k_aenter[] = "__aenter__";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_assert[] = "assert_";
static const char __pyx_k_attrib[] = "attrib";
static const char __pyx_k_c_attr[] = "c_attr";
static const char __pyx_k_c_ctxt[] = "c_ctxt";
static const char __pyx_k_c_dict[] = "c_dict";
static const char __pyx_k_c_href[] = "c_href";
static const char __pyx_k_c_name[] = "c_name";
static const char __pyx_k_c_next[] = "c_next";
static const char __pyx_k_c_node[] = "c_node";
static const char __pyx_k_c_path[] = "c_path";
static const char __pyx_k_c_stop[] = "c_stop";
static const char __pyx_k_codecs[] = "codecs";
static const char __pyx_k_column[] = ", column ";
static const char __pyx_k_copy_2[] = "__copy__";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_domain[] = "domain";
static const char __pyx_k_enable[] = "enable";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_end_ns[] = "end-ns";
static const char __pyx_k_entity[] = "entity";
static const char __pyx_k_events[] = "events";
static const char __pyx_k_exc_tb[] = "exc_tb";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_file_2[] = "file://";
static const char __pyx_k_geturl[] = "geturl";
static const char __pyx_k_groups[] = "groups";
static const char __pyx_k_href_2[] = " href=\"";
static const char __pyx_k_idrefs[] = "idrefs";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_indent[] = "indent";
static const char __pyx_k_init_2[] = "_init";
static const char __pyx_k_insert[] = "insert";
static const char __pyx_k_islice[] = "islice";
static const char __pyx_k_iter_2[] = "__iter__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_levels[] = "levels";
static const char __pyx_k_line_2[] = "line";
static const char __pyx_k_line_3[] = "line ";
static const char __pyx_k_lineno[] = "lineno";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_lookup[] = "lookup";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_module[] = "module";
static const char __pyx_k_name_2[] = "name";
static const char __pyx_k_ns_d_2[] = "ns\\d+$";
static const char __pyx_k_ns_uri[] = "ns_uri";
static const char __pyx_k_ns_utf[] = "ns_utf";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_parent[] = "_parent";
static const char __pyx_k_parser[] = "parser";
static const char __pyx_k_path_2[] = "_path";
static const char __pyx_k_pcdata[] = "pcdata";
static const char __pyx_k_prefix[] = "prefix";
static const char __pyx_k_rclose[] = "rclose";
static const char __pyx_k_regexp[] = "regexp";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_rsplit[] = "rsplit";
static const char __pyx_k_schema[] = "schema";
static const char __pyx_k_script[] = "script";
static const char __pyx_k_search[] = "search";
static const char __pyx_k_setter[] = "setter";
static const char __pyx_k_sorted[] = "sorted";
static const char __pyx_k_source[] = "source";
static const char __pyx_k_stdout[] = "stdout";
static const char __pyx_k_string[] = "<string>";
static const char __pyx_k_strval[] = "strval";
static const char __pyx_k_target[] = "target";
static const char __pyx_k_test_2[] = "__test__";
static const char __pyx_k_type_2[] = " (type ";
static const char __pyx_k_type_3[] = " type=";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_writer[] = "writer";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_xslt_2[] = ".xslt";
static const char __pyx_k_xslt_3[] = "xslt";
static const char __pyx_k_BytesIO[] = "BytesIO";
static const char __pyx_k_Comment[] = "Comment";
static const char __pyx_k_DOCTYPE[] = "<!DOCTYPE ";
static const char __pyx_k_DocInfo[] = "DocInfo";
static const char __pyx_k_ETXPath[] = "ETXPath";
static const char __pyx_k_Element[] = "<Element ";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_RelaxNG[] = "RelaxNG";
static const char __pyx_k_UNICODE[] = "UNICODE";
static const char __pyx_k_WARNING[] = "WARNING";
static const char __pyx_k_abspath[] = "abspath";
static const char __pyx_k_addnext[] = "addnext";
static const char __pyx_k_bstring[] = "bstring";
static const char __pyx_k_c_attrs[] = "c_attrs";
static const char __pyx_k_c_child[] = "c_child";
static const char __pyx_k_c_count[] = "c_count";
static const char __pyx_k_c_start[] = "c_start";
static const char __pyx_k_capsule[] = "capsule";
static const char __pyx_k_close_2[] = "_close";
static const char __pyx_k_comment[] = "comment";
static const char __pyx_k_compact[] = "compact";
static const char __pyx_k_compile[] = "compile";
static const char __pyx_k_content[] = "content";
static const char __pyx_k_context[] = "context";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_delitem[] = "__delitem__";
static const char __pyx_k_disable[] = "disable";
static const char __pyx_k_discard[] = "discard";
static const char __pyx_k_doc_ref[] = "doc_ref";
static const char __pyx_k_doctype[] = "doctype";
static const char __pyx_k_domains[] = "domains";
static const char __pyx_k_element[] = "element";
static const char __pyx_k_entries[] = "entries";
static const char __pyx_k_exc_val[] = "exc_val";
static const char __pyx_k_execute[] = "execute";
static const char __pyx_k_fileobj[] = "fileobj";
static const char __pyx_k_findall[] = "findall";
static const char __pyx_k_g_1_g_2[] = "\\g<1>\\g<2>";
static const char __pyx_k_getName[] = "_getName";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_getnext[] = "getnext";
static const char __pyx_k_getpath[] = "getpath";
static const char __pyx_k_getroot[] = "getroot";
static const char __pyx_k_has_key[] = "has_key";
static const char __pyx_k_id_name[] = "id_name";
static const char __pyx_k_implied[] = "implied";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_isspace[] = "isspace";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_matcher[] = "matcher";
static const char __pyx_k_matches[] = "matches";
static const char __pyx_k_max_len[] = "max_len";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_new_doc[] = "new_doc";
static const char __pyx_k_new_pos[] = "new_pos";
static const char __pyx_k_nmtoken[] = "nmtoken";
static const char __pyx_k_occur_2[] = "occur";
static const char __pyx_k_of_name[] = "\" of name \"";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_os_path[] = "os.path";
static const char __pyx_k_outfile[] = "outfile";
static const char __pyx_k_parseid[] = "parseid";
static const char __pyx_k_partial[] = "partial";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_receive[] = "receive";
static const char __pyx_k_recover[] = "recover";
static const char __pyx_k_relaxng[] = "relaxng";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_resolve[] = "resolve";
static const char __pyx_k_results[] = "results";
static const char __pyx_k_rnc2rng[] = "rnc2rng";
static const char __pyx_k_rng_str[] = "rng_str";
static const char __pyx_k_s_match[] = "s_match";
static const char __pyx_k_s_w_s_s[] = "\\s+(\\w+)\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")";
static const char __pyx_k_setitem[] = "__setitem__";
static const char __pyx_k_setroot[] = "_setroot";
static const char __pyx_k_strings[] = "strings";
static const char __pyx_k_unicode[] = "unicode";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_uri_utf[] = "uri_utf";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_xml_xml[] = "<xml>\360\237\244\252</xml>";
static const char __pyx_k_xmlfile[] = "xmlfile";
static const char __pyx_k_xmlns_2[] = "xmlns";
static const char __pyx_k_CRITICAL[] = "CRITICAL";
static const char __pyx_k_DENY_ALL[] = "DENY_ALL";
static const char __pyx_k_DTDError[] = "DTDError";
static const char __pyx_k_Document[] = "_Document";
static const char __pyx_k_Entity_2[] = "_Entity";
static const char __pyx_k_ErrorLog[] = "_ErrorLog";
static const char __pyx_k_GzipFile[] = "GzipFile";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_LogEntry[] = "_LogEntry";
static const char __pyx_k_RELAXNGV[] = "RELAXNGV";
static const char __pyx_k_Resolver[] = "Resolver";
static const char __pyx_k_StringIO[] = "StringIO";
static const char __pyx_k_US_ASCII[] = "US-ASCII";
static const char __pyx_k_XInclude[] = "XInclude";
static const char __pyx_k_XMLDTDID[] = "XMLDTDID";
static const char __pyx_k_base_url[] = "base_url";
static const char __pyx_k_buffered[] = "buffered";
static const char __pyx_k_c_buffer[] = "c_buffer";
static const char __pyx_k_c_method[] = "c_method";
static const char __pyx_k_c_parent[] = "c_parent";
static const char __pyx_k_children[] = "children";
static const char __pyx_k_column_2[] = "column";
static const char __pyx_k_contains[] = "__contains__";
static const char __pyx_k_deepcopy[] = "__deepcopy__";
static const char __pyx_k_elements[] = "elements";
static const char __pyx_k_elemname[] = " elemname=";
static const char __pyx_k_encoding[] = "encoding";
static const char __pyx_k_end_ns_2[] = "end_ns";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_entities[] = "entities";
static const char __pyx_k_exc_info[] = "exc_info";
static const char __pyx_k_exc_type[] = "exc_type";
static const char __pyx_k_expected[] = ", expected ";
static const char __pyx_k_fallback[] = "fallback";
static const char __pyx_k_filelike[] = "filelike";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_filtered[] = "filtered";
static const char __pyx_k_findtext[] = "findtext";
static const char __pyx_k_for_html[] = "for_html";
static const char __pyx_k_getvalue[] = "getvalue";
static const char __pyx_k_href_utf[] = "href_utf";
static const char __pyx_k_htmlfile[] = "htmlfile";
static const char __pyx_k_internal[] = "internal";
static const char __pyx_k_is_owned[] = "is_owned";
static const char __pyx_k_iterfind[] = "iterfind";
static const char __pyx_k_iterkeys[] = "iterkeys";
static const char __pyx_k_itertext[] = "itertext";
static const char __pyx_k_iterwalk[] = "iterwalk";
static const char __pyx_k_load_dtd[] = "load_dtd";
static const char __pyx_k_module_2[] = "__module__";
static const char __pyx_k_name_utf[] = "name_utf";
static const char __pyx_k_nmtokens[] = "nmtokens";
static const char __pyx_k_notation[] = "notation";
static const char __pyx_k_ns_clean[] = "ns_clean";
static const char __pyx_k_ns_stack[] = "ns_stack";
static const char __pyx_k_of_QName[] = " of QName \"";
static const char __pyx_k_parseXSL[] = "parseXSL";
static const char __pyx_k_position[] = "position";
static const char __pyx_k_prefix_2[] = " prefix=";
static const char __pyx_k_preserve[] = "preserve";
static const char __pyx_k_property[] = "property";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_register[] = "register";
static const char __pyx_k_registry[] = "registry";
static const char __pyx_k_required[] = "required";
static const char __pyx_k_resolver[] = "resolver";
static const char __pyx_k_reversed[] = "reversed";
static const char __pyx_k_set_name[] = "__set_name__";
static const char __pyx_k_start_ns[] = "start-ns";
static const char __pyx_k_string_2[] = "string";
static const char __pyx_k_strparam[] = "strparam";
static const char __pyx_k_tostring[] = "tostring";
static const char __pyx_k_validate[] = "validate";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_xinclude[] = "xinclude";
static const char __pyx_k_xml_data[] = "xml_data";
static const char __pyx_k_C14NError[] = "C14NError";
static const char __pyx_k_Comment_2[] = "_Comment";
static const char __pyx_k_Element_2[] = "Element";
static const char __pyx_k_Element_3[] = "_Element";
static const char __pyx_k_Extension[] = "Extension";
static const char __pyx_k_LxmlError[] = "LxmlError";
static const char __pyx_k_NAMESPACE[] = "NAMESPACE";
static const char __pyx_k_Namespace[] = "Namespace \"";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_Validator[] = "_Validator";
static const char __pyx_k_XMLParser[] = "XMLParser";
static const char __pyx_k_XMLSchema[] = "XMLSchema";
static const char __pyx_k_XSLTError[] = "XSLTError";
static const char __pyx_k_c_element[] = "c_element";
static const char __pyx_k_c_version[] = "c_version";
static const char __pyx_k_cssselect[] = "cssselect";
static const char __pyx_k_default_2[] = " default=";
static const char __pyx_k_dict_size[] = "dict_size";
static const char __pyx_k_docformat[] = "__docformat__";
static const char __pyx_k_docstring[] = "docstring";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_error_log[] = "error_log";
static const char __pyx_k_evaluator[] = "evaluator";
static const char __pyx_k_exclusive[] = "exclusive";
static const char __pyx_k_from_file[] = "from_file";
static const char __pyx_k_functions[] = "functions";
static const char __pyx_k_functools[] = "functools";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_getparent[] = "getparent";
static const char __pyx_k_getwriter[] = "getwriter";
static const char __pyx_k_huge_tree[] = "huge_tree";
static const char __pyx_k_inclusive[] = "inclusive";
static const char __pyx_k_iselement[] = "iselement";
static const char __pyx_k_isenabled[] = "isenabled";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_iterparse[] = "iterparse";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_keep_tail[] = "keep_tail";
static const char __pyx_k_log_entry[] = "log_entry";
static const char __pyx_k_max_depth[] = "max_depth";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_namespace[] = "namespace";
static const char __pyx_k_not_found[] = "' not found";
static const char __pyx_k_preceding[] = "preceding";
static const char __pyx_k_public_id[] = "public_id";
static const char __pyx_k_read_file[] = "read_file";
static const char __pyx_k_resolvers[] = "resolvers";
static const char __pyx_k_self_node[] = "self_node";
static const char __pyx_k_string_id[] = "//*[string(@id)]";
static const char __pyx_k_tag_names[] = "tag_names";
static const char __pyx_k_text_root[] = "text-root";
static const char __pyx_k_top_nsmap[] = "top_nsmap";
static const char __pyx_k_tounicode[] = "tounicode";
static const char __pyx_k_type_name[] = "type_name";
static const char __pyx_k_undefined[] = "undefined";
static const char __pyx_k_variables[] = "variables";
static const char __pyx_k_version_2[] = "__version__";
static const char __pyx_k_with_tail[] = "with_tail";
static const char __pyx_k_xmlschema[] = "xmlschema";
static const char __pyx_k_Attrib_get[] = "_Attrib.get";
static const char __pyx_k_Attrib_pop[] = "_Attrib.pop";
static const char __pyx_k_DENY_WRITE[] = "DENY_WRITE";
static const char __pyx_k_EntityBase[] = "EntityBase";
static const char __pyx_k_ErrorTypes[] = "ErrorTypes";
static const char __pyx_k_FeedParser[] = "_FeedParser";
static const char __pyx_k_HTMLParser[] = "HTMLParser";
static const char __pyx_k_IDDict_get[] = "_IDDict.get";
static const char __pyx_k_IGNORECASE[] = "IGNORECASE";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ParseError[] = "ParseError";
static const char __pyx_k_PyErrorLog[] = "PyErrorLog";
static const char __pyx_k_Schematron[] = "Schematron";
static const char __pyx_k_SubElement[] = "SubElement";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_XPathError[] = "XPathError";
static const char __pyx_k_attributes[] = "attributes";
static const char __pyx_k_byte_count[] = "byte_count";
static const char __pyx_k_bytes_used[] = "bytes_used";
static const char __pyx_k_c_encoding[] = "c_encoding";
static const char __pyx_k_c_new_next[] = "c_new_next";
static const char __pyx_k_c_new_node[] = "c_new_node";
static const char __pyx_k_c_old_next[] = "c_old_next";
static const char __pyx_k_c_old_node[] = "c_old_node";
static const char __pyx_k_close_file[] = "close_file";
static const char __pyx_k_contextlib[] = "contextlib";
static const char __pyx_k_create_dir[] = "create_dir";
static const char __pyx_k_elemname_2[] = "elemname";
static const char __pyx_k_extensions[] = "extensions";
static const char __pyx_k_fromstring[] = "fromstring";
static const char __pyx_k_getargspec[] = "getargspec";
static const char __pyx_k_input_node[] = "input_node";
static const char __pyx_k_insert_pis[] = "insert_pis";
static const char __pyx_k_itervalues[] = "itervalues";
static const char __pyx_k_last_error[] = "last_error";
static const char __pyx_k_level_name[] = "level_name";
static const char __pyx_k_lxml_etree[] = "lxml.etree";
static const char __pyx_k_memorydump[] = ".memorydump";
static const char __pyx_k_memorylist[] = ".memorylist";
static const char __pyx_k_namespaces[] = "namespaces";
static const char __pyx_k_no_network[] = "no_network";
static const char __pyx_k_old_writer[] = "old_writer";
static const char __pyx_k_pi_factory[] = "pi_factory";
static const char __pyx_k_prefix_utf[] = "prefix_utf";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_remove_pis[] = "remove_pis";
static const char __pyx_k_result_doc[] = "result_doc";
static const char __pyx_k_reversed_2[] = "__reversed__";
static const char __pyx_k_s_href_s_s[] = "\\s+href\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")";
static const char __pyx_k_splitlines[] = "splitlines";
static const char __pyx_k_stacklevel[] = "stacklevel";
static const char __pyx_k_standalone[] = "standalone";
static const char __pyx_k_start_ns_2[] = "start_ns";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_strip_tags[] = "strip_tags";
static const char __pyx_k_strip_text[] = "strip_text";
static const char __pyx_k_system_url[] = "system_url";
static const char __pyx_k_translator[] = "translator";
static const char __pyx_k_write_c14n[] = "write_c14n";
static const char __pyx_k_write_file[] = "write_file";
static const char __pyx_k_xpath_name[] = "xpath_name";
static const char __pyx_k_xslt_input[] = "xslt_input";
static const char __pyx_k_Attrib_keys[] = "_Attrib.keys";
static const char __pyx_k_C14N_failed[] = "C14N failed";
static const char __pyx_k_CSSSelector[] = "CSSSelector";
static const char __pyx_k_CommentBase[] = "CommentBase";
static const char __pyx_k_ElementBase[] = "ElementBase";
static const char __pyx_k_ElementTree[] = "ElementTree";
static const char __pyx_k_Element_get[] = "_Element.get";
static const char __pyx_k_Element_set[] = "_Element.set";
static const char __pyx_k_ErrorLevels[] = "ErrorLevels";
static const char __pyx_k_IDDict_copy[] = "_IDDict.copy";
static const char __pyx_k_IDDict_keys[] = "_IDDict.keys";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_LookupError[] = "LookupError";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_Namespace_r[] = "Namespace(%r)";
static const char __pyx_k_OrderedDict[] = "OrderedDict";
static const char __pyx_k_ParserError[] = "ParserError";
static const char __pyx_k_SyntaxError[] = "SyntaxError";
static const char __pyx_k_TreeBuilder[] = "TreeBuilder";
static const char __pyx_k_XPATH_POINT[] = "XPATH_POINT";
static const char __pyx_k_XPATH_RANGE[] = "XPATH_RANGE";
static const char __pyx_k_XPATH_USERS[] = "XPATH_USERS";
static const char __pyx_k_XSLT___copy[] = "XSLT.__copy__";
static const char __pyx_k_addprevious[] = "addprevious";
static const char __pyx_k_assertValid[] = "assertValid";
static const char __pyx_k_block_count[] = "block_count";
static const char __pyx_k_blocks_used[] = "blocks_used";
static const char __pyx_k_c_attr_next[] = "c_attr_next";
static const char __pyx_k_c_node_copy[] = "c_node_copy";
static const char __pyx_k_c_node_next[] = "c_node_next";
static const char __pyx_k_collect_ids[] = "collect_ids";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_compression[] = "compression";
static const char __pyx_k_domain_name[] = "domain_name";
static const char __pyx_k_elementpath[] = "_elementpath";
static const char __pyx_k_enumeration[] = "enumeration";
static const char __pyx_k_exc_context[] = "exc_context";
static const char __pyx_k_external_id[] = "external_id";
static const char __pyx_k_first_error[] = "first_error";
static const char __pyx_k_getchildren[] = "getchildren";
static const char __pyx_k_getiterator[] = "getiterator";
static const char __pyx_k_getprevious[] = "getprevious";
static const char __pyx_k_getroottree[] = "getroottree";
static const char __pyx_k_logger_name[] = "logger_name";
static const char __pyx_k_makeelement[] = "makeelement";
static const char __pyx_k_mro_entries[] = "__mro_entries__";
static const char __pyx_k_new_element[] = "new_element";
static const char __pyx_k_not_found_2[] = " not found";
static const char __pyx_k_object_name[] = " object name=";
static const char __pyx_k_old_element[] = "old_element";
static const char __pyx_k_output_file[] = "output_file";
static const char __pyx_k_profile_run[] = "profile_run";
static const char __pyx_k_read_events[] = "read_events";
static const char __pyx_k_replacement[] = "replacement";
static const char __pyx_k_result_list[] = "result_list";
static const char __pyx_k_result_node[] = "result_node";
static const char __pyx_k_result_tree[] = "result_tree";
static const char __pyx_k_strip_cdata[] = "strip_cdata";
static const char __pyx_k_variables_2[] = "_variables";
static const char __pyx_k_Attrib_clear[] = "_Attrib.clear";
static const char __pyx_k_Attrib_items[] = "_Attrib.items";
static const char __pyx_k_BaseErrorLog[] = "_BaseErrorLog";
static const char __pyx_k_DTD_elements[] = "DTD.elements";
static const char __pyx_k_DTD_entities[] = "DTD.entities";
static const char __pyx_k_Element_find[] = "_Element.find";
static const char __pyx_k_Element_iter[] = "_Element.iter";
static const char __pyx_k_Element_keys[] = "_Element.keys";
static const char __pyx_k_ErrorDomains[] = "ErrorDomains";
static const char __pyx_k_IDDict_items[] = "_IDDict.items";
static const char __pyx_k_Invalid_type[] = "Invalid type";
static const char __pyx_k_LXML_VERSION[] = "LXML_VERSION";
static const char __pyx_k_ListErrorLog[] = "_ListErrorLog";
static const char __pyx_k_RelaxNGError[] = "RelaxNGError";
static const char __pyx_k_Syntax_error[] = "Syntax error";
static const char __pyx_k_XSLTErrorLog[] = "_XSLTErrorLog";
static const char __pyx_k_c_source_doc[] = "c_source_doc";
static const char __pyx_k_c_standalone[] = "c_standalone";
static const char __pyx_k_c_start_node[] = "c_start_node";
static const char __pyx_k_canonicalize[] = "canonicalize";
static const char __pyx_k_exclude_tags[] = "exclude_tags";
static const char __pyx_k_filter_types[] = "filter_types";
static const char __pyx_k_getattribute[] = "__getattribute__";
static const char __pyx_k_in_public_id[] = " in public_id.";
static const char __pyx_k_initializing[] = "_initializing";
static const char __pyx_k_intersection[] = "intersection";
static const char __pyx_k_is_coroutine[] = "_is_coroutine";
static const char __pyx_k_iterchildren[] = "iterchildren";
static const char __pyx_k_iterelements[] = "iterelements";
static const char __pyx_k_iterentities[] = "iterentities";
static const char __pyx_k_itersiblings[] = "itersiblings";
static const char __pyx_k_pretty_print[] = "pretty_print";
static const char __pyx_k_read_network[] = "read_network";
static const char __pyx_k_resolve_file[] = "resolve_file";
static const char __pyx_k_set_fallback[] = "set_fallback";
static const char __pyx_k_skip_subtree[] = "skip_subtree";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_tostringlist[] = "tostringlist";
static const char __pyx_k_write_output[] = "write_output";
static const char __pyx_k_Attrib___copy[] = "_Attrib.__copy__";
static const char __pyx_k_Attrib_update[] = "_Attrib.update";
static const char __pyx_k_Attrib_values[] = "_Attrib.values";
static const char __pyx_k_BaseException[] = "BaseException";
static const char __pyx_k_DTDParseError[] = "DTDParseError";
static const char __pyx_k_DocInfo_clear[] = "DocInfo.clear";
static const char __pyx_k_ElementTree_2[] = "_ElementTree";
static const char __pyx_k_Element__init[] = "_Element._init";
static const char __pyx_k_Element_clear[] = "_Element.clear";
static const char __pyx_k_Element_index[] = "_Element.index";
static const char __pyx_k_Element_items[] = "_Element.items";
static const char __pyx_k_Element_xpath[] = "_Element.xpath";
static const char __pyx_k_ErrorLog_copy[] = "_ErrorLog.copy";
static const char __pyx_k_Error_reading[] = "Error reading '";
static const char __pyx_k_FutureWarning[] = "FutureWarning";
static const char __pyx_k_IDDict_values[] = "_IDDict.values";
static const char __pyx_k_MemDebug_dump[] = "_MemDebug.dump";
static const char __pyx_k_MemDebug_show[] = "_MemDebug.show";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_Unknown_error[] = "\077\077 Unknown error \077\077\n";
static const char __pyx_k_XIncludeError[] = "XIncludeError";
static const char __pyx_k_XMLPullParser[] = "XMLPullParser";
static const char __pyx_k_XML_line_3261[] = "XML (line 3261)";
static const char __pyx_k_XSLTExtension[] = "XSLTExtension";
static const char __pyx_k_XSLTSaveError[] = "XSLTSaveError";
static const char __pyx_k_XSLT_strparam[] = "XSLT.strparam";
static const char __pyx_k_XSLT_tostring[] = "XSLT.tostring";
static const char __pyx_k_async_outfile[] = "async_outfile";
static const char __pyx_k_c_compression[] = "c_compression";
static const char __pyx_k_class_getitem[] = "__class_getitem__";
static const char __pyx_k_class_mapping[] = "class_mapping";
static const char __pyx_k_compresslevel[] = "compresslevel";
static const char __pyx_k_default_value[] = " default_value=";
static const char __pyx_k_elements_only[] = "elements_only";
static const char __pyx_k_enable_regexp[] = "enable_regexp";
static const char __pyx_k_exclude_attrs[] = "exclude_attrs";
static const char __pyx_k_filter_levels[] = "filter_levels";
static const char __pyx_k_function_name[] = "function_name";
static const char __pyx_k_get_namespace[] = "get_namespace";
static const char __pyx_k_init_subclass[] = "__init_subclass__";
static const char __pyx_k_is_standalone[] = "is_standalone";
static const char __pyx_k_iterancestors[] = "iterancestors";
static const char __pyx_k_key_not_found[] = "key not found.";
static const char __pyx_k_libxml2_d_d_d[] = "libxml2 %d.%d.%d";
static const char __pyx_k_other_element[] = "other_element";
static const char __pyx_k_output_parent[] = "output_parent";
static const char __pyx_k_parse_options[] = "parse_options";
static const char __pyx_k_resolve_empty[] = "resolve_empty";
static const char __pyx_k_smart_strings[] = "smart_strings";
static const char __pyx_k_unknown_error[] = "unknown error";
static const char __pyx_k_with_comments[] = "with_comments";
static const char __pyx_k_with_prefixes[] = "with_prefixes";
static const char __pyx_k_write_doctype[] = "write_doctype";
static const char __pyx_k_write_network[] = "write_network";
static const char __pyx_k_AssertionError[] = "AssertionError";
static const char __pyx_k_Attrib_has_key[] = "_Attrib.has_key";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_DomainErrorLog[] = "_DomainErrorLog";
static const char __pyx_k_Element___copy[] = "_Element.__copy__";
static const char __pyx_k_Element_append[] = "_Element.append";
static const char __pyx_k_Element_extend[] = "_Element.extend";
static const char __pyx_k_Element_insert[] = "_Element.insert";
static const char __pyx_k_Element_remove[] = "_Element.remove";
static const char __pyx_k_Element_values[] = "_Element.values";
static const char __pyx_k_Empty_tag_name[] = "Empty tag name";
static const char __pyx_k_Encoding_error[] = "Encoding error";
static const char __pyx_k_ErrorLog_clear[] = "_ErrorLog.clear";
static const char __pyx_k_GlobalErrorLog[] = "_GlobalErrorLog";
static const char __pyx_k_HTMLPullParser[] = "HTMLPullParser";
static const char __pyx_k_IDDict_has_key[] = "_IDDict.has_key";
static const char __pyx_k_LIBXML_VERSION[] = "LIBXML_VERSION";
static const char __pyx_k_MutableMapping[] = "MutableMapping";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_PyErrorLog_log[] = "PyErrorLog.log";
static const char __pyx_k_ReferenceError[] = "ReferenceError";
static const char __pyx_k_Resource_error[] = "Resource error";
static const char __pyx_k_TreeBuilder_pi[] = "TreeBuilder.pi";
static const char __pyx_k_XMLSchemaError[] = "XMLSchemaError";
static const char __pyx_k_XMLSyntaxError[] = "XMLSyntaxError";
static const char __pyx_k_XMLTreeBuilder[] = "XMLTreeBuilder";
static const char __pyx_k_XPathEvalError[] = "XPathEvalError";
static const char __pyx_k_XPathEvaluator[] = "XPathEvaluator";
static const char __pyx_k_XPath_function[] = "XPath function '";
static const char __pyx_k_XSLTApplyError[] = "XSLTApplyError";
static const char __pyx_k_XSLTParseError[] = "XSLTParseError";
static const char __pyx_k_XSLTResultTree[] = "_XSLTResultTree";
static const char __pyx_k_access_control[] = "access_control";
static const char __pyx_k_attribute_name[] = "attribute_name";
static const char __pyx_k_c_context_node[] = "c_context_node";
static const char __pyx_k_contextmanager[] = "contextmanager";
static const char __pyx_k_dtd_validation[] = "dtd_validation";
static const char __pyx_k_element_config[] = "element_config";
static const char __pyx_k_element_writer[] = "element_writer";
static const char __pyx_k_feed_error_log[] = "feed_error_log";
static const char __pyx_k_filter_domains[] = "filter_domains";
static const char __pyx_k_fromstringlist[] = "fromstringlist";
static const char __pyx_k_getelementpath[] = "getelementpath";
static const char __pyx_k_getfullargspec[] = "getfullargspec";
static const char __pyx_k_iterattributes[] = "iterattributes";
static const char __pyx_k_lxml_cssselect[] = "lxml.cssselect";
static const char __pyx_k_new_namespaces[] = "new_namespaces";
static const char __pyx_k_open_utf8_file[] = "_open_utf8_file";
static const char __pyx_k_raise_on_error[] = "raise_on_error";
static const char __pyx_k_resolve_string[] = "resolve_string";
static const char __pyx_k_reversed_nsmap[] = "reversed_nsmap";
static const char __pyx_k_strip_elements[] = "strip_elements";
static const char __pyx_k_xmlfile___exit[] = "xmlfile.__exit__";
static const char __pyx_k_Attrib_iterkeys[] = "_Attrib.iterkeys";
static const char __pyx_k_BaseParser_copy[] = "_BaseParser.copy";
static const char __pyx_k_DocumentInvalid[] = "DocumentInvalid";
static const char __pyx_k_ElementIterator[] = "_ElementIterator";
static const char __pyx_k_Element_addnext[] = "_Element.addnext";
static const char __pyx_k_Element_findall[] = "_Element.findall";
static const char __pyx_k_Element_getnext[] = "_Element.getnext";
static const char __pyx_k_Element_replace[] = "_Element.replace";
static const char __pyx_k_ErrorLog___exit[] = "_ErrorLog.__exit__";
static const char __pyx_k_FeedParser_feed[] = "_FeedParser.feed";
static const char __pyx_k_IDDict_iterkeys[] = "_IDDict.iterkeys";
static const char __pyx_k_Invalid_PI_name[] = "Invalid PI name '";
static const char __pyx_k_Invalid_operand[] = "Invalid operand";
static const char __pyx_k_LIBXSLT_VERSION[] = "LIBXSLT_VERSION";
static const char __pyx_k_LxmlSyntaxError[] = "LxmlSyntaxError";
static const char __pyx_k_Number_encoding[] = "Number encoding";
static const char __pyx_k_PyErrorLog_copy[] = "PyErrorLog.copy";
static const char __pyx_k_SaxParserTarget[] = "_SaxParserTarget";
static const char __pyx_k_SchematronError[] = "SchematronError";
static const char __pyx_k_TreeBuilder_end[] = "TreeBuilder.end";
static const char __pyx_k_XSLT___deepcopy[] = "XSLT.__deepcopy__";
static const char __pyx_k_apply_templates[] = "apply_templates";
static const char __pyx_k_attribute_names[] = "attribute_names";
static const char __pyx_k_clear_error_log[] = "_clear_error_log";
static const char __pyx_k_collections_abc[] = "collections.abc";
static const char __pyx_k_comment_factory[] = "comment_factory";
static const char __pyx_k_default_doctype[] = "default_doctype";
static const char __pyx_k_default_value_2[] = "default_value";
static const char __pyx_k_element_factory[] = "element_factory";
static const char __pyx_k_element_or_tree[] = "element_or_tree";
static const char __pyx_k_from_rnc_string[] = "from_rnc_string";
static const char __pyx_k_insert_comments[] = "insert_comments";
static const char __pyx_k_invalid_element[] = "invalid element";
static const char __pyx_k_iter_namespaces[] = "_iter_namespaces";
static const char __pyx_k_iterdescendants[] = "iterdescendants";
static const char __pyx_k_memory_debugger[] = "memory_debugger";
static const char __pyx_k_no_context_node[] = "no context node";
static const char __pyx_k_remove_comments[] = "remove_comments";
static const char __pyx_k_store_exception[] = "store_exception";
static const char __pyx_k_tree_or_element[] = "tree_or_element";
static const char __pyx_k_unknown_error_2[] = "unknown error ";
static const char __pyx_k_xml_declaration[] = "xml_declaration";
static const char __pyx_k_xmlfile___aexit[] = "xmlfile.__aexit__";
static const char __pyx_k_xmlfile___enter[] = "xmlfile.__enter__";
static const char __pyx_k_Attrib_iteritems[] = "_Attrib.iteritems";
static const char __pyx_k_C14NWriterTarget[] = "C14NWriterTarget";
static const char __pyx_k_DTDValidateError[] = "DTDValidateError";
static const char __pyx_k_DTD_iterelements[] = "DTD.iterelements";
static const char __pyx_k_DTD_iterentities[] = "DTD.iterentities";
static const char __pyx_k_ERR_INVALID_CHAR[] = "ERR_INVALID_CHAR";
static const char __pyx_k_ElementTree_find[] = "_ElementTree.find";
static const char __pyx_k_ElementTree_iter[] = "_ElementTree.iter";
static const char __pyx_k_ElementTree_xslt[] = "_ElementTree.xslt";
static const char __pyx_k_Element_findtext[] = "_Element.findtext";
static const char __pyx_k_Element_iterfind[] = "_Element.iterfind";
static const char __pyx_k_Element_itertext[] = "_Element.itertext";
static const char __pyx_k_ErrorLog_receive[] = "_ErrorLog.receive";
static const char __pyx_k_ExsltRegExp_test[] = "_ExsltRegExp.test";
static const char __pyx_k_FeedParser_close[] = "_FeedParser.close";
static const char __pyx_k_IDDict_iteritems[] = "_IDDict.iteritems";
static const char __pyx_k_ImmutableMapping[] = "_ImmutableMapping";
static const char __pyx_k_Invalid_tag_name[] = "Invalid tag name";
static const char __pyx_k_PI_lacks_content[] = "PI lacks content";
static const char __pyx_k_Resolver_resolve[] = "Resolver.resolve";
static const char __pyx_k_RotatingErrorLog[] = "_RotatingErrorLog";
static const char __pyx_k_SiblingsIterator[] = "SiblingsIterator";
static const char __pyx_k_Start_of_literal[] = "Start of literal";
static const char __pyx_k_TreeBuilder_data[] = "TreeBuilder.data";
static const char __pyx_k_Validator_assert[] = "_Validator.assert_";
static const char __pyx_k_XPathResultError[] = "XPathResultError";
static const char __pyx_k_XPathSyntaxError[] = "XPathSyntaxError";
static const char __pyx_k_accepted_domains[] = "_accepted_domains";
static const char __pyx_k_cannot_serialize[] = "cannot serialize ";
static const char __pyx_k_default_resolver[] = "default_resolver";
static const char __pyx_k_etree_or_element[] = "etree_or_element";
static const char __pyx_k_function_mapping[] = "function_mapping";
static const char __pyx_k_keep_ns_prefixes[] = "keep_ns_prefixes";
static const char __pyx_k_missing_end_tags[] = "missing end tags";
static const char __pyx_k_no_element_found[] = "no element found";
static const char __pyx_k_process_children[] = "process_children";
static const char __pyx_k_qname_aware_tags[] = "qname_aware_tags";
static const char __pyx_k_resolve_entities[] = "resolve_entities";
static const char __pyx_k_resolve_filename[] = "resolve_filename";
static const char __pyx_k_result_container[] = "result_container";
static const char __pyx_k_rewrite_prefixes[] = "rewrite_prefixes";
static const char __pyx_k_sequence_or_dict[] = "sequence_or_dict";
static const char __pyx_k_src_lxml_dtd_pxi[] = "src/lxml/dtd.pxi";
static const char __pyx_k_strip_attributes[] = "strip_attributes";
static const char __pyx_k_unknown_encoding[] = "unknown encoding: '";
static const char __pyx_k_xmlfile___aenter[] = "xmlfile.__aenter__";
static const char __pyx_k_AncestorsIterator[] = "AncestorsIterator";
static const char __pyx_k_Attrib___deepcopy[] = "_Attrib.__deepcopy__";
static const char __pyx_k_Attrib_itervalues[] = "_Attrib.itervalues";
static const char __pyx_k_BaseErrorLog_copy[] = "_BaseErrorLog.copy";
static const char __pyx_k_ETCompatXMLParser[] = "ETCompatXMLParser";
static const char __pyx_k_ElementTagMatcher[] = "_ElementTagMatcher";
static const char __pyx_k_ElementTree_parse[] = "_ElementTree.parse";
static const char __pyx_k_ElementTree_write[] = "_ElementTree.write";
static const char __pyx_k_ElementTree_xpath[] = "_ElementTree.xpath";
static const char __pyx_k_Element_cssselect[] = "_Element.cssselect";
static const char __pyx_k_Element_getparent[] = "_Element.getparent";
static const char __pyx_k_ExsltRegExp_match[] = "_ExsltRegExp.match";
static const char __pyx_k_FunctionNamespace[] = "FunctionNamespace";
static const char __pyx_k_IDDict_itervalues[] = "_IDDict.itervalues";
static const char __pyx_k_Invalid_character[] = "Invalid character: ";
static const char __pyx_k_Invalid_predicate[] = "Invalid predicate";
static const char __pyx_k_ListErrorLog_copy[] = "_ListErrorLog.copy";
static const char __pyx_k_LxmlRegistryError[] = "LxmlRegistryError";
static const char __pyx_k_ParseError___init[] = "ParseError.__init__";
static const char __pyx_k_Proxy_invalidated[] = "Proxy invalidated!";
static const char __pyx_k_RelaxNGErrorTypes[] = "RelaxNGErrorTypes";
static const char __pyx_k_RelaxNGParseError[] = "RelaxNGParseError";
static const char __pyx_k_Stack_usage_error[] = "Stack usage error";
static const char __pyx_k_TreeBuilder_close[] = "TreeBuilder.close";
static const char __pyx_k_TreeBuilder_start[] = "TreeBuilder.start";
static const char __pyx_k_Unknown_node_type[] = "Unknown node type: ";
static const char __pyx_k_XPATH_LOCATIONSET[] = "XPATH_LOCATIONSET";
static const char __pyx_k_XSLTAccessControl[] = "XSLTAccessControl";
static const char __pyx_k_cannot_parse_from[] = "cannot parse from '";
static const char __pyx_k_clear_error_log_2[] = "clear_error_log";
static const char __pyx_k_error_parsing_DTD[] = "error parsing DTD";
static const char __pyx_k_extension_element[] = "extension element ";
static const char __pyx_k_filter_from_level[] = "filter_from_level";
static const char __pyx_k_invalid_node_type[] = "invalid node type ";
static const char __pyx_k_not_in_an_element[] = "not in an element";
static const char __pyx_k_qname_aware_attrs[] = "qname_aware_attrs";
static const char __pyx_k_remove_blank_text[] = "remove_blank_text";
static const char __pyx_k_src_lxml_xslt_pxi[] = "src/lxml/xslt.pxi";
static const char __pyx_k_write_declaration[] = "write_declaration";
static const char __pyx_k_Cannot_resolve_URI[] = "Cannot resolve URI ";
static const char __pyx_k_DeprecationWarning[] = "DeprecationWarning";
static const char __pyx_k_ElementClassLookup[] = "ElementClassLookup";
static const char __pyx_k_ElementTree___copy[] = "_ElementTree.__copy__";
static const char __pyx_k_Element___deepcopy[] = "_Element.__deepcopy__";
static const char __pyx_k_Element___reversed[] = "_Element.__reversed__";
static const char __pyx_k_Error_reading_file[] = "Error reading file '";
static const char __pyx_k_Forbidden_variable[] = "Forbidden variable\n";
static const char __pyx_k_Invalid_child_type[] = "Invalid child type: ";
static const char __pyx_k_Invalid_expression[] = "Invalid expression";
static const char __pyx_k_Invalid_tag_name_2[] = "Invalid tag name ";
static const char __pyx_k_MemDebug_dict_size[] = "_MemDebug.dict_size";
static const char __pyx_k_PyErrorLog_receive[] = "PyErrorLog.receive";
static const char __pyx_k_SerialisationError[] = "SerialisationError";
static const char __pyx_k_Sub_resource_error[] = "Sub resource error";
static const char __pyx_k_TargetParserResult[] = "_TargetParserResult";
static const char __pyx_k_Undefined_variable[] = "Undefined variable";
static const char __pyx_k_Unfinished_literal[] = "Unfinished literal";
static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
static const char __pyx_k_UnicodeEncodeError[] = "UnicodeEncodeError";
static const char __pyx_k_Validator_validate[] = "_Validator.validate";
static const char __pyx_k_XPathEvaluatorBase[] = "_XPathEvaluatorBase";
static const char __pyx_k_XPathFunctionError[] = "XPathFunctionError";
static const char __pyx_k_XSLTExtensionError[] = "XSLTExtensionError";
static const char __pyx_k_append_log_message[] = "_append_log_message";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_attribute_defaults[] = "attribute_defaults";
static const char __pyx_k_cannot_assign_None[] = "cannot assign None";
static const char __pyx_k_cleanup_namespaces[] = "cleanup_namespaces";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_etree_or_element_2[] = "_etree_or_element";
static const char __pyx_k_filter_from_errors[] = "filter_from_errors";
static const char __pyx_k_filter_from_fatals[] = "filter_from_fatals";
static const char __pyx_k_get_default_parser[] = "get_default_parser";
static const char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
static const char __pyx_k_index_out_of_range[] = "index out of range: ";
static const char __pyx_k_invalid_event_name[] = "invalid event name '";
static const char __pyx_k_no_content_written[] = "no content written";
static const char __pyx_k_register_namespace[] = "register_namespace";
static const char __pyx_k_set_default_parser[] = "set_default_parser";
static const char __pyx_k_src_lxml_debug_pxi[] = "src/lxml/debug.pxi";
static const char __pyx_k_src_lxml_etree_pyx[] = "src/lxml/etree.pyx";
static const char __pyx_k_src_lxml_xmlid_pxi[] = "src/lxml/xmlid.pxi";
static const char __pyx_k_src_lxml_xpath_pxi[] = "src/lxml/xpath.pxi";
static const char __pyx_k_C14NWriterTarget_pi[] = "C14NWriterTarget.pi";
static const char __pyx_k_DTD_not_initialised[] = "DTD not initialised";
static const char __pyx_k_ElementTextIterator[] = "ElementTextIterator";
static const char __pyx_k_ElementTree_findall[] = "_ElementTree.findall";
static const char __pyx_k_ElementTree_getpath[] = "_ElementTree.getpath";
static const char __pyx_k_ElementTree_getroot[] = "_ElementTree.getroot";
static const char __pyx_k_ElementTree_relaxng[] = "_ElementTree.relaxng";
static const char __pyx_k_Element_addprevious[] = "_Element.addprevious";
static const char __pyx_k_Element_getchildren[] = "_Element.getchildren";
static const char __pyx_k_Element_getiterator[] = "_Element.getiterator";
static const char __pyx_k_Element_getprevious[] = "_Element.getprevious";
static const char __pyx_k_Element_getroottree[] = "_Element.getroottree";
static const char __pyx_k_Element_makeelement[] = "_Element.makeelement";
static const char __pyx_k_ExsltRegExp_replace[] = "_ExsltRegExp.replace";
static const char __pyx_k_FunctionNamespace_r[] = "FunctionNamespace(%r)";
static const char __pyx_k_Invalid_character_s[] = "Invalid character(s) ";
static const char __pyx_k_Invalid_entity_name[] = "Invalid entity name '";
static const char __pyx_k_Libxml2_error_types[] = "Libxml2 error types";
static const char __pyx_k_MemDebug_bytes_used[] = "_MemDebug.bytes_used";
static const char __pyx_k_Name_not_registered[] = "Name not registered.";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_ParseError_position[] = "ParseError.position";
static const char __pyx_k_TreeBuilder_comment[] = "TreeBuilder.comment";
static const char __pyx_k_Unknown_return_type[] = "Unknown return type: ";
static const char __pyx_k_XMLSchemaParseError[] = "XMLSchemaParseError";
static const char __pyx_k_build_smart_strings[] = "build_smart_strings";
static const char __pyx_k_c_old_output_parent[] = "c_old_output_parent";
static const char __pyx_k_class_dict_iterable[] = "class_dict_iterable";
static const char __pyx_k_internal_error_tail[] = "internal error (tail)";
static const char __pyx_k_internal_error_text[] = "internal error (text)";
static const char __pyx_k_register_namespaces[] = "register_namespaces";
static const char __pyx_k_restructuredtext_en[] = "restructuredtext en";
static const char __pyx_k_src_lxml_parser_pxi[] = "src/lxml/parser.pxi";
static const char __pyx_k_BaseErrorLog_receive[] = "_BaseErrorLog.receive";
static const char __pyx_k_C14NWriterTarget_end[] = "C14NWriterTarget.end";
static const char __pyx_k_ElementChildIterator[] = "ElementChildIterator";
static const char __pyx_k_ElementMatchIterator[] = "_ElementMatchIterator";
static const char __pyx_k_ElementTree__setroot[] = "_ElementTree._setroot";
static const char __pyx_k_ElementTree_findtext[] = "_ElementTree.findtext";
static const char __pyx_k_ElementTree_iterfind[] = "_ElementTree.iterfind";
static const char __pyx_k_ElementTree_xinclude[] = "_ElementTree.xinclude";
static const char __pyx_k_ElementUnicodeResult[] = "_ElementUnicodeResult";
static const char __pyx_k_Element_iterchildren[] = "_Element.iterchildren";
static const char __pyx_k_Element_itersiblings[] = "_Element.itersiblings";
static const char __pyx_k_Illegal_Unicode_kind[] = "Illegal Unicode kind ";
static const char __pyx_k_Invalid_context_size[] = "Invalid context size";
static const char __pyx_k_Invalid_input_object[] = "Invalid input object: ";
static const char __pyx_k_Libxml2_error_levels[] = "Libxml2 error levels";
static const char __pyx_k_MemDebug_blocks_used[] = "_MemDebug.blocks_used";
static const char __pyx_k_MethodChanger___exit[] = "_MethodChanger.__exit__";
static const char __pyx_k_ReadOnlyProxy___copy[] = "_ReadOnlyProxy.__copy__";
static const char __pyx_k_RelaxNGValidateError[] = "RelaxNGValidateError";
static const char __pyx_k_ResolverRegistry_add[] = "_ResolverRegistry.add";
static const char __pyx_k_SchematronParseError[] = "SchematronParseError";
static const char __pyx_k_Unknown_xpath_result[] = "Unknown xpath result ";
static const char __pyx_k_cannot_be_serialized[] = "' cannot be serialized.";
static const char __pyx_k_filter_from_warnings[] = "filter_from_warnings";
static const char __pyx_k_pyucs4_encoding_name[] = "_pyucs4_encoding_name";
static const char __pyx_k_set_global_max_depth[] = "set_global_max_depth";
static const char __pyx_k_src_lxml_cleanup_pxi[] = "src/lxml/cleanup.pxi";
static const char __pyx_k_src_lxml_relaxng_pxi[] = "src/lxml/relaxng.pxi";
static const char __pyx_k_src_lxml_xsltext_pxi[] = "src/lxml/xsltext.pxi";
static const char __pyx_k_x20_x0D_x0Aa_zA_Z0_9[] = "[^\\x20\\x0D\\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+";
static const char __pyx_k_xml_s_encoding_s_s_s[] = "^(<\\?xml[^>]+)\\s+encoding\\s*=\\s*[\"\\'][^\"\\']*[\"\\'](\\s*\\?>|)";
static const char __pyx_k_AsyncDataWriter_close[] = "_AsyncDataWriter.close";
static const char __pyx_k_AsyncDataWriter_write[] = "_AsyncDataWriter.write";
static const char __pyx_k_C14NWriterTarget_data[] = "C14NWriterTarget.data";
static const char __pyx_k_Char_out_of_XML_range[] = "Char out of XML range";
static const char __pyx_k_ERR_UNDECLARED_ENTITY[] = "ERR_UNDECLARED_ENTITY";
static const char __pyx_k_ElementTree_xmlschema[] = "_ElementTree.xmlschema";
static const char __pyx_k_Element_iterancestors[] = "_Element.iterancestors";
static const char __pyx_k_Failed_to_create_file[] = "Failed to create file ";
static const char __pyx_k_Invalid_HTML_tag_name[] = "Invalid HTML tag name ";
static const char __pyx_k_Invalid_namespace_URI[] = "Invalid namespace URI ";
static const char __pyx_k_Libxml2_error_domains[] = "Libxml2 error domains";
static const char __pyx_k_MethodChanger___aexit[] = "_MethodChanger.__aexit__";
static const char __pyx_k_MethodChanger___enter[] = "_MethodChanger.__enter__";
static const char __pyx_k_No_tree_or_file_given[] = "No tree or file given";
static const char __pyx_k_Node_must_not_be_None[] = "Node must not be None";
static const char __pyx_k_ProcessingInstruction[] = "ProcessingInstruction";
static const char __pyx_k_ReadOnlyProxy_getnext[] = "_ReadOnlyProxy.getnext";
static const char __pyx_k_ResolverRegistry_copy[] = "_ResolverRegistry.copy";
static const char __pyx_k_Resolver_resolve_file[] = "Resolver.resolve_file";
static const char __pyx_k_Unregistered_function[] = "Unregistered function";
static const char __pyx_k_Unsupported_node_type[] = "Unsupported node type: ";
static const char __pyx_k_Validator_assertValid[] = "_Validator.assertValid";
static const char __pyx_k_WAR_UNDECLARED_ENTITY[] = "WAR_UNDECLARED_ENTITY";
static const char __pyx_k_XPathElementEvaluator[] = "XPathElementEvaluator";
static const char __pyx_k_XSLTExtension_execute[] = "XSLTExtension.execute";
static const char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
static const char __pyx_k_inclusive_ns_prefixes[] = "inclusive_ns_prefixes";
static const char __pyx_k_invalid_argument_type[] = "invalid argument type ";
static const char __pyx_k_iterparse_makeelement[] = "iterparse.makeelement";
static const char __pyx_k_iterwalk_skip_subtree[] = "iterwalk.skip_subtree";
static const char __pyx_k_parser_locking_failed[] = "parser locking failed";
static const char __pyx_k_src_lxml_xmlerror_pxi[] = "src/lxml/xmlerror.pxi";
static const char __pyx_k_string___STRING__XSLT[] = "string://__STRING__XSLT__/";
static const char __pyx_k_unknown_output_method[] = "unknown output method ";
static const char __pyx_k_use_global_python_log[] = "use_global_python_log";
static const char __pyx_k_BaseParser_makeelement[] = "_BaseParser.makeelement";
static const char __pyx_k_C14NWriterTarget_close[] = "C14NWriterTarget.close";
static const char __pyx_k_C14NWriterTarget_start[] = "C14NWriterTarget.start";
static const char __pyx_k_ContentOnlyElement_get[] = "__ContentOnlyElement.get";
static const char __pyx_k_ContentOnlyElement_set[] = "__ContentOnlyElement.set";
static const char __pyx_k_DomainErrorLog_receive[] = "_DomainErrorLog.receive";
static const char __pyx_k_ElementTree___deepcopy[] = "_ElementTree.__deepcopy__";
static const char __pyx_k_ElementTree_write_c14n[] = "_ElementTree.write_c14n";
static const char __pyx_k_File_is_already_closed[] = "File is already closed";
static const char __pyx_k_ICONV_COMPILED_VERSION[] = "ICONV_COMPILED_VERSION";
static const char __pyx_k_ID_attribute_not_found[] = "ID attribute not found.";
static const char __pyx_k_ImmutableMapping___len[] = "_ImmutableMapping.__len__";
static const char __pyx_k_Invalid_attribute_name[] = "Invalid attribute name ";
static const char __pyx_k_MethodChanger___aenter[] = "_MethodChanger.__aenter__";
static const char __pyx_k_NamespaceRegistryError[] = "NamespaceRegistryError";
static const char __pyx_k_Resolver_resolve_empty[] = "Resolver.resolve_empty";
static const char __pyx_k_Undefined_xpath_result[] = "Undefined xpath result";
static const char __pyx_k_XMLSchemaValidateError[] = "XMLSchemaValidateError";
static const char __pyx_k_XPathDocumentEvaluator[] = "XPathDocumentEvaluator";
static const char __pyx_k_can_only_parse_strings[] = "can only parse strings";
static const char __pyx_k_invalid_DTD_proxy_at_s[] = "invalid DTD proxy at %s";
static const char __pyx_k_src_lxml_docloader_pxi[] = "src/lxml/docloader.pxi";
static const char __pyx_k_src_lxml_iterparse_pxi[] = "src/lxml/iterparse.pxi";
static const char __pyx_k_src_lxml_nsclasses_pxi[] = "src/lxml/nsclasses.pxi";
static const char __pyx_k_src_lxml_saxparser_pxi[] = "src/lxml/saxparser.pxi";
static const char __pyx_k_text_or_uri_or_element[] = "text_or_uri_or_element";
static const char __pyx_k_Cannot_parse_stylesheet[] = "Cannot parse stylesheet";
static const char __pyx_k_ContentOnlyElement_keys[] = "__ContentOnlyElement.keys";
static const char __pyx_k_DTDAttributeDecl_values[] = "_DTDAttributeDecl.values";
static const char __pyx_k_ElementTree_getiterator[] = "_ElementTree.getiterator";
static const char __pyx_k_Element_iterdescendants[] = "_Element.iterdescendants";
static const char __pyx_k_ImmutableMapping___iter[] = "_ImmutableMapping.__iter__";
static const char __pyx_k_LIBXML_COMPILED_VERSION[] = "LIBXML_COMPILED_VERSION";
static const char __pyx_k_Memory_allocation_error[] = "Memory allocation error";
static const char __pyx_k_NamespaceRegistry__deco[] = "_NamespaceRegistry__deco";
static const char __pyx_k_NamespaceRegistry_clear[] = "_NamespaceRegistry.clear";
static const char __pyx_k_NamespaceRegistry_items[] = "_NamespaceRegistry.items";
static const char __pyx_k_ParserDictionaryContext[] = "_ParserDictionaryContext";
static const char __pyx_k_ProcessingInstruction_2[] = "_ProcessingInstruction";
static const char __pyx_k_ReadOnlyProxy_getparent[] = "_ReadOnlyProxy.getparent";
static const char __pyx_k_RelaxNG_from_rnc_string[] = "RelaxNG.from_rnc_string";
static const char __pyx_k_ResolverRegistry_remove[] = "_ResolverRegistry.remove";
static const char __pyx_k_Resolver_resolve_string[] = "Resolver.resolve_string";
static const char __pyx_k_SchematronValidateError[] = "SchematronValidateError";
static const char __pyx_k_Unknown_libxml2_version[] = "Unknown libxml2 version: ";
static const char __pyx_k_XMLSyntaxAssertionError[] = "XMLSyntaxAssertionError";
static const char __pyx_k_adopt_external_document[] = "adopt_external_document";
static const char __pyx_k_input_is_not_an_Element[] = "input is not an Element";
static const char __pyx_k_list_index_out_of_range[] = "list index out of range";
static const char __pyx_k_malformed_PI_attributes[] = "malformed PI attributes";
static const char __pyx_k_src_lxml_extensions_pxi[] = "src/lxml/extensions.pxi";
static const char __pyx_k_src_lxml_serializer_pxi[] = "src/lxml/serializer.pxi";
static const char __pyx_k_C14NWriterTarget_comment[] = "C14NWriterTarget.comment";
static const char __pyx_k_ContentOnlyElement_items[] = "__ContentOnlyElement.items";
static const char __pyx_k_Could_not_find_root_node[] = "Could not find root node";
static const char __pyx_k_CustomElementClassLookup[] = "CustomElementClassLookup";
static const char __pyx_k_FileWriterElement___exit[] = "_FileWriterElement.__exit__";
static const char __pyx_k_Invalid_context_position[] = "Invalid context position";
static const char __pyx_k_Invalid_entity_reference[] = "Invalid entity reference: '";
static const char __pyx_k_Invalid_namespace_prefix[] = "Invalid namespace prefix ";
static const char __pyx_k_LIBXSLT_COMPILED_VERSION[] = "LIBXSLT_COMPILED_VERSION";
static const char __pyx_k_NamespaceRegistry___deco[] = "_NamespaceRegistry.__deco";
static const char __pyx_k_NamespaceRegistry_update[] = "_NamespaceRegistry.update";
static const char __pyx_k_No_document_to_serialise[] = "No document to serialise";
static const char __pyx_k_PI_text_must_not_contain[] = "PI text must not contain '?>'";
static const char __pyx_k_PythonElementClassLookup[] = "PythonElementClassLookup";
static const char __pyx_k_ReadOnlyElementProxy_get[] = "_ReadOnlyElementProxy.get";
static const char __pyx_k_ReadOnlyProxy___deepcopy[] = "_ReadOnlyProxy.__deepcopy__";
static const char __pyx_k_ResolverRegistry_resolve[] = "_ResolverRegistry.resolve";
static const char __pyx_k_RotatingErrorLog_receive[] = "_RotatingErrorLog.receive";
static const char __pyx_k_Unsupported_element_type[] = "Unsupported element type: ";
static const char __pyx_k_double_registering_proxy[] = "double registering proxy!";
static const char __pyx_k_is_not_declared_in_scope[] = "\" is not declared in scope";
static const char __pyx_k_missing_toplevel_element[] = "missing toplevel element";
static const char __pyx_k_not_allowed_inside_CDATA[] = "']]>' not allowed inside CDATA";
static const char __pyx_k_set_element_class_lookup[] = "set_element_class_lookup";
static const char __pyx_k_src_lxml_classlookup_pxi[] = "src/lxml/classlookup.pxi";
static const char __pyx_k_xsl_stylesheet_xml_id_id[] = "//xsl:stylesheet[@xml:id = $id]";
static const char __pyx_k_C14NWriterTarget_start_ns[] = "C14NWriterTarget.start_ns";
static const char __pyx_k_ContentOnlyElement_append[] = "__ContentOnlyElement.append";
static const char __pyx_k_ContentOnlyElement_insert[] = "__ContentOnlyElement.insert";
static const char __pyx_k_ContentOnlyElement_values[] = "__ContentOnlyElement.values";
static const char __pyx_k_DTDElementDecl_attributes[] = "_DTDElementDecl.attributes";
static const char __pyx_k_ElementDefaultClassLookup[] = "ElementDefaultClassLookup";
static const char __pyx_k_ElementDepthFirstIterator[] = "ElementDepthFirstIterator";
static const char __pyx_k_Error_applying_stylesheet[] = "Error applying stylesheet";
static const char __pyx_k_Error_in_xpath_expression[] = "Error in xpath expression";
static const char __pyx_k_FileWriterElement___enter[] = "_FileWriterElement.__enter__";
static const char __pyx_k_Invalid_input_tag_of_type[] = "Invalid input tag of type ";
static const char __pyx_k_ListErrorLog_filter_types[] = "_ListErrorLog.filter_types";
static const char __pyx_k_ProcessingInstruction_get[] = "_ProcessingInstruction.get";
static const char __pyx_k_ReadOnlyElementProxy_keys[] = "_ReadOnlyElementProxy.keys";
static const char __pyx_k_ReadOnlyProxy_getchildren[] = "_ReadOnlyProxy.getchildren";
static const char __pyx_k_ReadOnlyProxy_getprevious[] = "_ReadOnlyProxy.getprevious";
static const char __pyx_k_Resolver_resolve_filename[] = "Resolver.resolve_filename";
static const char __pyx_k_TargetParserResult___init[] = "_TargetParserResult.__init__";
static const char __pyx_k_XMLPullParser_read_events[] = "XMLPullParser.read_events";
static const char __pyx_k_XSLTProcessingInstruction[] = "_XSLTProcessingInstruction";
static const char __pyx_k_XSLT_set_global_max_depth[] = "XSLT.set_global_max_depth";
static const char __pyx_k_end_tag_mismatch_expected[] = "end tag mismatch (expected ";
static const char __pyx_k_resolve_external_entities[] = "resolve_external_entities";
static const char __pyx_k_src_lxml_parsertarget_pxi[] = "src/lxml/parsertarget.pxi";
static const char __pyx_k_src_lxml_readonlytree_pxi[] = "src/lxml/readonlytree.pxi";
static const char __pyx_k_to_extended_slice_of_size[] = " to extended slice of size ";
static const char __pyx_k_undecodable_error_message[] = "<undecodable error message>";
static const char __pyx_k_ElementTree_getelementpath[] = "_ElementTree.getelementpath";
static const char __pyx_k_FallbackElementClassLookup[] = "FallbackElementClassLookup";
static const char __pyx_k_FunctionNamespace_line_207[] = "FunctionNamespace (line 207)";
static const char __pyx_k_HTMLPullParser_read_events[] = "HTMLPullParser.read_events";
static const char __pyx_k_ImmutableMapping___delitem[] = "_ImmutableMapping.__delitem__";
static const char __pyx_k_ImmutableMapping___getitem[] = "_ImmutableMapping.__getitem__";
static const char __pyx_k_ImmutableMapping___setitem[] = "_ImmutableMapping.__setitem__";
static const char __pyx_k_ListErrorLog_filter_levels[] = "_ListErrorLog.filter_levels";
static const char __pyx_k_No_ID_dictionary_available[] = "No ID dictionary available.";
static const char __pyx_k_ReadOnlyElementProxy_items[] = "_ReadOnlyElementProxy.items";
static const char __pyx_k_ReadOnlyProxy_iterchildren[] = "_ReadOnlyProxy.iterchildren";
static const char __pyx_k_Undefined_namespace_prefix[] = "Undefined namespace prefix";
static const char __pyx_k_Validator__clear_error_log[] = "_Validator._clear_error_log";
static const char __pyx_k_XInclude_processing_failed[] = "XInclude processing failed";
static const char __pyx_k_expected_string_or_Element[] = ", expected string or Element";
static const char __pyx_k_http_www_w3_org_1999_xhtml[] = "http://www.w3.org/1999/xhtml";
static const char __pyx_k_invalid_Element_proxy_at_s[] = "invalid Element proxy at %s";
static const char __pyx_k_list_index_x_x_not_in_list[] = "list.index(x): x not in list";
static const char __pyx_k_pending_open_tags_on_close[] = "pending open tags on close";
static const char __pyx_k_DTDAttributeDecl_itervalues[] = "_DTDAttributeDecl.itervalues";
static const char __pyx_k_Document_is_not_well_formed[] = "Document is not well formed";
static const char __pyx_k_ElementNamespaceClassLookup[] = "ElementNamespaceClassLookup";
static const char __pyx_k_Element_is_not_in_this_tree[] = "Element is not in this tree.";
static const char __pyx_k_ImmutableMapping___contains[] = "_ImmutableMapping.__contains__";
static const char __pyx_k_IncrementalFileWriter_flush[] = "_IncrementalFileWriter.flush";
static const char __pyx_k_IncrementalFileWriter_write[] = "_IncrementalFileWriter.write";
static const char __pyx_k_Invalid_character_reference[] = "Invalid character reference: '";
static const char __pyx_k_Invalid_number_of_arguments[] = "Invalid number of arguments";
static const char __pyx_k_Libxml2_RelaxNG_error_types[] = "Libxml2 RelaxNG error types";
static const char __pyx_k_ListErrorLog_filter_domains[] = "_ListErrorLog.filter_domains";
static const char __pyx_k_Missing_closing_curly_brace[] = "Missing closing curly brace";
static const char __pyx_k_NamespaceRegistry_iteritems[] = "_NamespaceRegistry.iteritems";
static const char __pyx_k_ReadOnlyElementProxy_values[] = "_ReadOnlyElementProxy.values";
static const char __pyx_k_XSLTResultTree_write_output[] = "_XSLTResultTree.write_output";
static const char __pyx_k_document_context_is_missing[] = "document context is missing";
static const char __pyx_k_invalid_Document_proxy_at_s[] = "invalid Document proxy at %s";
static const char __pyx_k_list_index_x_x_not_in_slice[] = "list.index(x): x not in slice";
static const char __pyx_k_IncrementalFileWriter_method[] = "_IncrementalFileWriter.method";
static const char __pyx_k_Input_object_has_no_document[] = "Input object has no document: ";
static const char __pyx_k_Invalid_attribute_dictionary[] = "Invalid attribute dictionary: ";
static const char __pyx_k_OpaqueDocumentWrapper_append[] = "_OpaqueDocumentWrapper.append";
static const char __pyx_k_OpaqueDocumentWrapper_extend[] = "_OpaqueDocumentWrapper.extend";
static const char __pyx_k_Parsing_requires_string_data[] = "Parsing requires string data";
static const char __pyx_k_XSLT_context_not_initialised[] = "XSLT context not initialised";
static const char __pyx_k_unsupported_XSLT_result_type[] = "unsupported XSLT result type: ";
static const char __pyx_k_AppendOnlyElementProxy_append[] = "_AppendOnlyElementProxy.append";
static const char __pyx_k_AppendOnlyElementProxy_extend[] = "_AppendOnlyElementProxy.extend";
static const char __pyx_k_DTDElementDecl_iterattributes[] = "_DTDElementDecl.iterattributes";
static const char __pyx_k_Element_is_not_in_this_tree_2[] = "Element is not in this tree";
static const char __pyx_k_File_or_filename_expected_got[] = "File or filename expected, got '";
static const char __pyx_k_IncrementalFileWriter_element[] = "_IncrementalFileWriter.element";
static const char __pyx_k_Invalid_or_incomplete_context[] = "Invalid or incomplete context";
static const char __pyx_k_ParserBasedElementClassLookup[] = "ParserBasedElementClassLookup";
static const char __pyx_k_Validator__append_log_message[] = "_Validator._append_log_message";
static const char __pyx_k_XPath_context_not_initialised[] = "XPath context not initialised";
static const char __pyx_k_XSLTExtension_apply_templates[] = "XSLTExtension.apply_templates";
static const char __pyx_k_XSLTProcessingInstruction_set[] = "_XSLTProcessingInstruction.set";
static const char __pyx_k_http_purl_org_dc_elements_1_1[] = "http://purl.org/dc/elements/1.1/";
static const char __pyx_k_http_schemas_xmlsoap_org_wsdl[] = "http://schemas.xmlsoap.org/wsdl/";
static const char __pyx_k_AsyncFileWriterElement___aexit[] = "_AsyncFileWriterElement.__aexit__";
static const char __pyx_k_Document_is_not_valid_Relax_NG[] = "Document is not valid Relax NG";
static const char __pyx_k_ElementUnicodeResult_getparent[] = "_ElementUnicodeResult.getparent";
static const char __pyx_k_Error_applying_stylesheet_line[] = "Error applying stylesheet, line ";
static const char __pyx_k_Illegal_document_provided_NULL[] = "Illegal document provided: NULL";
static const char __pyx_k_ListErrorLog_filter_from_level[] = "_ListErrorLog.filter_from_level";
static const char __pyx_k_XMLSyntaxAssertionError___init[] = "XMLSyntaxAssertionError.__init__";
static const char __pyx_k_XPath_evaluator_locking_failed[] = "XPath evaluator locking failed";
static const char __pyx_k_XSLTExtension_process_children[] = "XSLTExtension.process_children";
static const char __pyx_k_cannot_append_parent_to_itself[] = "cannot append parent to itself";
static const char __pyx_k_http_www_w3_org_2001_XMLSchema[] = "http://www.w3.org/2001/XMLSchema";
static const char __pyx_k_An_XMLSyntaxError_that_addition[] = "\n    An XMLSyntaxError that additionally inherits from AssertionError for\n    ElementTree / backwards compatibility reasons.\n\n    This class may get replaced by a plain XMLSyntaxError in a future version.\n    ";
static const char __pyx_k_AsyncFileWriterElement___aenter[] = "_AsyncFileWriterElement.__aenter__";
static const char __pyx_k_AsyncIncrementalFileWriter__clo[] = "_AsyncIncrementalFileWriter._close";
static const char __pyx_k_AsyncIncrementalFileWriter_elem[] = "_AsyncIncrementalFileWriter.element";
static const char __pyx_k_AsyncIncrementalFileWriter_flus[] = "_AsyncIncrementalFileWriter.flush";
static const char __pyx_k_AsyncIncrementalFileWriter_meth[] = "_AsyncIncrementalFileWriter.method";
static const char __pyx_k_AsyncIncrementalFileWriter_writ[] = "_AsyncIncrementalFileWriter.write_declaration";
static const char __pyx_k_BaseParser_set_element_class_lo[] = "_BaseParser.set_element_class_lookup";
static const char __pyx_k_Can_only_strip_text_in_C14N_2_0[] = "Can only strip text in C14N 2.0 serialisation";
static const char __pyx_k_Cannot_change_the_xml_prefix_of[] = "Cannot change the 'xml' prefix of the XML namespace";
static const char __pyx_k_CustomElementClassLookup_lookup[] = "CustomElementClassLookup.lookup";
static const char __pyx_k_ElementNamespaceClassLookup_get[] = "ElementNamespaceClassLookup.get_namespace";
static const char __pyx_k_Expected_for_variable_reference[] = "Expected $ for variable reference";
static const char __pyx_k_IncrementalFileWriter_write_dec[] = "_IncrementalFileWriter.write_declaration";
static const char __pyx_k_IncrementalFileWriter_write_doc[] = "_IncrementalFileWriter.write_doctype";
static const char __pyx_k_Invalid_URL_must_not_contain_or[] = "Invalid URL, must not contain '\"' or '>'";
static const char __pyx_k_ListErrorLog_filter_from_errors[] = "_ListErrorLog.filter_from_errors";
static const char __pyx_k_ListErrorLog_filter_from_fatals[] = "_ListErrorLog.filter_from_fatals";
static const char __pyx_k_ListErrorLog_filter_from_warnin[] = "_ListErrorLog.filter_from_warnings";
static const char __pyx_k_Not_yet_implemented_result_node[] = "Not yet implemented result node type: ";
static const char __pyx_k_ParserSchemaValidationContext_n[] = "_ParserSchemaValidationContext not initialised";
static const char __pyx_k_PythonElementClassLookup_lookup[] = "PythonElementClassLookup.lookup";
static const 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 const char __pyx_k_Registered_element_classes_must[] = "Registered element classes must be subtypes of ElementBase";
static const char __pyx_k_Schema_instance_not_initialised[] = "Schema instance not initialised";
static const char __pyx_k_System_URL_may_not_contain_both[] = "System URL may not contain both single (') and double quotes (\").";
static const char __pyx_k_The_lxml_etree_module_implement[] = "\nThe ``lxml.etree`` module implements the extended ElementTree API for XML.\n";
static const char __pyx_k_This_search_incorrectly_ignores[] = "This search incorrectly ignores the root element, and will be fixed in a future version.  If you rely on the current behaviour, change it to ";
static const char __pyx_k_XML_declaration_already_written[] = "XML declaration already written";
static const char __pyx_k_XPath_evaluator_not_initialised[] = "XPath evaluator not initialised";
static const char __pyx_k_XSLTProcessingInstruction_parse[] = "_XSLTProcessingInstruction.parseXSL";
static const char __pyx_k_XSLT_stylesheet_not_initialised[] = "XSLT stylesheet not initialised";
static const char __pyx_k_ambiguous_reference_to_embedded[] = "ambiguous reference to embedded stylesheet";
static const char __pyx_k_boolean_xs_attribute_default_or[] = "boolean(//xs:attribute[@default or @fixed][1])";
static const char __pyx_k_cannot_set_a_maximum_stylesheet[] = "cannot set a maximum stylesheet traversal depth < 0";
static const char __pyx_k_document_external_context_nodes[] = "document-external context nodes are not supported";
static const char __pyx_k_got_invalid_input_value_of_type[] = "got invalid input value of type ";
static const char __pyx_k_http_www_w3_org_XML_1998_namesp[] = "{http://www.w3.org/XML/1998/namespace}space";
static const char __pyx_k_lxml_etree_was_compiled_without[] = "lxml.etree was compiled without Schematron support.";
static const char __pyx_k_only_setting_the_href_attribute[] = "only setting the 'href' attribute is supported on XSLT-PIs";
static const 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 const char __pyx_k_Argument_is_not_a_file_like_obje[] = "Argument is not a file-like object";
static const char __pyx_k_Argument_must_be_bytes_or_unicod[] = "Argument must be bytes or unicode, got '%.200s'";
static const char __pyx_k_Argument_must_be_string_or_unico[] = "Argument must be string or unicode.";
static const char __pyx_k_AttributeBasedElementClassLookup[] = "AttributeBasedElementClassLookup";
static const char __pyx_k_Base_class_for_all_syntax_errors[] = "Base class for all syntax errors.\n    ";
static const char __pyx_k_C14NWriterTarget__iter_namespace[] = "C14NWriterTarget._iter_namespaces";
static const char __pyx_k_C14NWriterTarget__start_locals_l[] = "C14NWriterTarget._start.<locals>.<lambda>";
static const char __pyx_k_Can_only_discard_comments_in_C14[] = "Can only discard comments in C14N serialisation";
static const char __pyx_k_Cannot_asynchronously_write_to_a[] = "Cannot asynchronously write to a plain file";
static const char __pyx_k_Cannot_enable_XML_declaration_in[] = "Cannot enable XML declaration in C14N";
static const char __pyx_k_Cannot_specify_encoding_with_C14[] = "Cannot specify encoding with C14N";
static const char __pyx_k_Comment_may_not_contain_or_end_w[] = "Comment may not contain '--' or end with '-'";
static const char __pyx_k_Could_not_create_I_O_writer_cont[] = "Could not create I/O writer context.";
static const char __pyx_k_DOCTYPE_already_written_or_canno[] = "DOCTYPE already written or cannot write it here";
static const char __pyx_k_Document_does_not_comply_with_sc[] = "Document does not comply with schema";
static const char __pyx_k_Document_is_not_a_valid_Schematr[] = "Document is not a valid Schematron schema";
static const char __pyx_k_Document_is_not_parsable_as_Rela[] = "Document is not parsable as Relax NG";
static const char __pyx_k_Document_is_not_valid_XML_Schema[] = "Document is not valid XML Schema";
static const 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\nERR_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\nERR_COMMENT_ABRUPTLY_ENDED=112\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\nRNGP_ATTRIBUTE_CHILDREN=1002\nRNGP_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_PA""T_DATA_EXCEPT_EMPTY=1071\nRNGP_PAT_DATA_EXCEPT_GROUP=1072\nRNGP_PAT_DATA_EXCEPT_INTERLEAVE=1073\nRNGP_PAT_DATA_EXCEPT_LIST=1074\nRNGP_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_UNDE""F_PREFIX_ERROR=1219\nXPATH_ENCODING_ERROR=1220\nXPATH_INVALID_CHAR_ERROR=1221\nTREE_INVALID_HEX=1300\nTREE_INVALID_DEC=1301\nTREE_UNTERMINATED_ENTITY=1302\nTREE_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_ATTRFORM""DEFAULT_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\nSCHEMAP_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\nSCHEMAP_UNKNOWN_PREFIX=1767\nSCHEMAP_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_C""VC_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\nSCHEMAV_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=20""00\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\nSCHEMAP_SRC_SIMPLE_TYPE_4=3003\nSCHEMAP_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_A""TTRIBUTE_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_DEFAULT_2_2_2=3061\nSCHEMAP_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_WR""ONG_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\nI18N_NO_OUTPUT=6004\nBUF_OVERFLOW=7000\n";
static const char __pyx_k_Either_xml_data_or_from_file_mus[] = "Either 'xml_data' or 'from_file' must be provided as input";
static const char __pyx_k_ElementTree_not_initialized_miss[] = "ElementTree not initialized, missing root";
static const char __pyx_k_Element_is_not_a_child_of_this_n[] = "Element is not a child of this node.";
static const char __pyx_k_Entity_class_must_be_subclass_of[] = "Entity class must be subclass of EntityBase";
static const char __pyx_k_Error_during_serialisation_out_o[] = "Error during serialisation (out of memory?)";
static const char __pyx_k_Error_serialising_an_XSLT_result[] = "Error serialising an XSLT result.\n    ";
static const char __pyx_k_Failed_to_create_validation_cont[] = "Failed to create validation context";
static const char __pyx_k_FallbackElementClassLookup_set_f[] = "FallbackElementClassLookup.set_fallback";
static const char __pyx_k_FunctionNamespace_ns_uri_Retriev[] = "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.\n\n    Usage:\n\n    >>> ns_functions = FunctionNamespace(\"http://schema.org/Movie\")\n\n    >>> @ns_functions  # uses function name\n    ... def add2(x):\n    ...     return x + 2\n\n    >>> @ns_functions(\"add3\")  # uses explicit name\n    ... def add_three(x):\n    ...     return x + 3\n    ";
static const char __pyx_k_Illegal_document_provided_expect[] = "Illegal document provided: expected XML or HTML, found ";
static const char __pyx_k_Inconsistent_enter_action_in_con[] = "Inconsistent enter action in context manager";
static const char __pyx_k_Inconsistent_exit_action_in_cont[] = "Inconsistent exit action in context manager";
static const char __pyx_k_Initial_indentation_level_must_b[] = "Initial indentation level must be >= 0, got ";
static const char __pyx_k_Input_object_is_not_an_XML_eleme[] = "Input object is not an XML element: ";
static const char __pyx_k_Internal_error_in_DTD_validation[] = "Internal error in DTD validation";
static const char __pyx_k_Internal_error_in_Relax_NG_valid[] = "Internal error in Relax NG validation";
static const char __pyx_k_Internal_error_in_Schematron_val[] = "Internal error in Schematron validation";
static const char __pyx_k_Internal_error_in_XML_Schema_val[] = "Internal error in XML Schema validation.";
static const char __pyx_k_Method_changed_outside_of_contex[] = "Method changed outside of context manager";
static const 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 const char __pyx_k_NONE_0_WARNING_1_ERROR_2_FATAL_3[] = "NONE=0\nWARNING=1\nERROR=2\nFATAL=3\n";
static const char __pyx_k_Non_Element_values_not_supported[] = "Non-Element values not supported at this point - got ";
static const char __pyx_k_Only_elements_can_be_the_root_of[] = "Only elements can be the root of an ElementTree";
static const char __pyx_k_Only_processing_instructions_and[] = "Only processing instructions and comments can be siblings of the root element";
static const char __pyx_k_Output_file_needs_an_async_write[] = "Output file needs an async .write() method";
static const char __pyx_k_PI_class_must_be_subclass_of_PIB[] = "PI class must be subclass of PIBase";
static const char __pyx_k_Prefix_format_reserved_for_inter[] = "Prefix format reserved for internal use";
static const char __pyx_k_Registered_functions_must_be_cal[] = "Registered functions must be callable.";
static const char __pyx_k_RelaxNG_instance_not_initialised[] = "RelaxNG instance not initialised";
static const char __pyx_k_Schematron_instance_not_initiali[] = "Schematron instance not initialised";
static const char __pyx_k_Serialisation_to_unicode_must_no[] = "Serialisation to unicode must not request an XML declaration";
static const 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 const 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 const char __pyx_k_The_docstring_option_is_deprecat[] = "The 'docstring' option is deprecated. Use 'doctype' instead.";
static const char __pyx_k_This_class_cannot_be_instantiate[] = "This class cannot be instantiated";
static const char __pyx_k_This_is_not_a_supported_node_set[] = "This is not a supported node-set result: ";
static const char __pyx_k_This_type_cannot_be_instantiated[] = "This type cannot be instantiated from Python";
static const char __pyx_k_Tried_to_unregister_unknown_prox[] = "Tried to unregister unknown proxy";
static const 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 const char __pyx_k_XInclude_instance_not_initialise[] = "XInclude instance not initialised";
static const char __pyx_k_XInclude_processor_not_initialis[] = "XInclude processor not initialised";
static const 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 const char __pyx_k_XPathElementEvaluator_register_n[] = "XPathElementEvaluator.register_namespace";
static const char __pyx_k_XPath_context_is_only_usable_dur[] = "XPath context is only usable during the evaluation";
static const char __pyx_k_argument_must_be_a_byte_string_o[] = "argument must be a byte string or unicode string";
static const char __pyx_k_attempt_to_assign_sequence_of_si[] = "attempt to assign sequence of size ";
static const char __pyx_k_cannot_add_ancestor_as_sibling_p[] = "cannot add ancestor as sibling, please break cycle first";
static const char __pyx_k_cannot_append_document_already_h[] = "cannot append, document already has a root element";
static const char __pyx_k_cannot_append_trailing_element_t[] = "cannot append trailing element to complete XML document";
static const char __pyx_k_comment_class_must_be_subclass_o[] = "comment class must be subclass of CommentBase";
static const char __pyx_k_compact_syntax_not_supported_ple[] = "compact syntax not supported (please install rnc2rng)";
static const char __pyx_k_either_filename_or_external_ID_r[] = "either filename or external ID required";
static const char __pyx_k_element_class_must_be_subclass_o[] = "element class must be subclass of ElementBase";
static const char __pyx_k_empty_namespace_prefix_is_not_su[] = "empty namespace prefix is not supported in XPath";
static const char __pyx_k_empty_prefix_is_not_supported_in[] = "empty prefix is not supported in XPath";
static const char __pyx_k_extensions_must_have_non_empty_n[] = "extensions must have non empty names";
static const char __pyx_k_extensions_must_not_have_empty_n[] = "extensions must not have empty namespaces";
static const char __pyx_k_file_must_be_a_filename_file_lik[] = "file must be a filename, file-like or path-like object";
static const char __pyx_k_http_codespeak_net_lxml_objectif[] = "http://codespeak.net/lxml/objectify/pytype";
static const char __pyx_k_http_exslt_org_regular_expressio[] = "http://exslt.org/regular-expressions";
static const char __pyx_k_http_www_w3_org_1999_02_22_rdf_s[] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
static const char __pyx_k_http_www_w3_org_1999_XSL_Transfo[] = "http://www.w3.org/1999/XSL/Transform";
static const char __pyx_k_http_www_w3_org_2001_XMLSchema_i[] = "http://www.w3.org/2001/XMLSchema-instance";
static const char __pyx_k_http_www_w3_org_XML_1998_namespa[] = "http://www.w3.org/XML/1998/namespace";
static const char __pyx_k_inconsistent_exit_action_in_cont[] = "inconsistent exit action in context manager";
static const char __pyx_k_iterparse_set_element_class_look[] = "iterparse.set_element_class_lookup";
static const char __pyx_k_only_XML_documents_have_declarat[] = "only XML documents have declarations";
static const char __pyx_k_passing_a_single_string_into_fro[] = "passing a single string into fromstringlist() is not efficient, use fromstring() instead";
static const char __pyx_k_pop_expected_at_most_2_arguments[] = "pop expected at most 2 arguments, got ";
static const char __pyx_k_reading_file_objects_must_return[] = "reading file objects must return bytes objects";
static const char __pyx_k_reading_from_file_like_objects_m[] = "reading from file-like objects must return byte strings or unicode strings";
static const char __pyx_k_reference_to_non_existing_embedd[] = "reference to non-existing embedded stylesheet";
static const char __pyx_k_result_of_class_lookup_must_be_s[] = "result of class lookup must be subclass of ";
static const char __pyx_k_setting_default_namespace_is_not[] = "setting default namespace is not supported in XPath";
static const char __pyx_k_this_element_does_not_have_child[] = "this element does not have children or attributes";
static const char __pyx_k_unsupported_element_type_for_top[] = "unsupported element type for top-level node: ";
static const char __pyx_k_AsyncIncrementalFileWriter_writ_2[] = "_AsyncIncrementalFileWriter.write_doctype";
static const char __pyx_k_AsyncIncrementalFileWriter_writ_3[] = "_AsyncIncrementalFileWriter.write";
static const char __pyx_k_Syntax_error_while_parsing_an_XM_2[] = "Syntax error while parsing an XML document.\n    ";
static const char __pyx_k_XPathElementEvaluator_register_n_2[] = "XPathElementEvaluator.register_namespaces";
/* #### Code section: decls ### */
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 int __pyx_pf_4lxml_5etree_9LxmlError___init__(struct __pyx_obj_4lxml_5etree_LxmlError *__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_4path___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__bool__(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_2clear(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 int __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value); /* 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, int __pyx_v_keep_tail); /* 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__bool__(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_8_Element_90cssselect(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_translator); /* 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__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, 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, int __pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, PyObject *__pyx_v_compression, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text, PyObject *__pyx_v_docstring); /* 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_14getelementpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16getiterator(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18iter(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findtext(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_24findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xpath(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_30xslt(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_32relaxng(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_relaxng); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_xmlschema); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_38write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, int __pyx_v_exclusive, int __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__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, 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_28indent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_space, Py_ssize_t __pyx_v_level); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_30dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, int __pyx_v_with_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_32tostring(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, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_34tostringlist(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_36tounicode(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_38parse(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 PyObject *__pyx_pf_4lxml_5etree_40adopt_external_document(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capsule, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* 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__bool__(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_5nsmap___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_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_42set_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 PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_obj); /* 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_44FunctionNamespace(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, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError_2position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError_4position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_pos); /* 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_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding, int __pyx_v_resolve_external_entities); /* 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_2set_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_4copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6makeelement(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_collect_ids, 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_46set_default_parser(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_48get_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, PyObject *__pyx_v_default_doctype, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_huge_tree); /* 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 PyObject *__pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message); /* 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, PyObject *__pyx_v_comment_factory, PyObject *__pyx_v_pi_factory, int __pyx_v_insert_comments, int __pyx_v_insert_pis); /* 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 PyObject *__pyx_pf_4lxml_5etree_50_open_utf8_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression); /* 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, PyObject *__pyx_v_close); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_53canonicalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xml_data, PyObject *__pyx_v_out, PyObject *__pyx_v_from_file, PyObject *__pyx_v_options); /* proto */
static int __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_write, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_strip_text, PyObject *__pyx_v_rewrite_prefixes, PyObject *__pyx_v_qname_aware_tags, PyObject *__pyx_v_qname_aware_attrs, PyObject *__pyx_v_exclude_attrs, PyObject *__pyx_v_exclude_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_ns_stack); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self); /* 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, PyObject *__pyx_v_close, PyObject *__pyx_v_buffered); /* 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 PyObject *__pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(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_8htmlfile___init__(struct __pyx_obj_4lxml_5etree_htmlfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* 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, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method); /* 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_8method(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_12write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_async_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error); /* proto */
static int __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer, struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, 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, int __pyx_v_method); /* 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_14_MethodChanger___cinit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, int __pyx_v_method); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__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 PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, PyObject *__pyx_v_args); /* 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, CYTHON_UNUSED PyObject *__pyx_v_collect_ids, 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_8iterwalk_6skip_subtree(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_55XMLID(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_57XMLDTDID(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_59parseid(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_61cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_top_nsmap, PyObject *__pyx_v_keep_ns_prefixes); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_63strip_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_attribute_names); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_65strip_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_67strip_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_69Extension(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_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_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 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 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_71XPathEvaluator(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_10tostring(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_12__deepcopy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_14__copy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__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 PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__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_6__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 PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_10system_url___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 PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_src, PyObject *__pyx_v_base_url); /* 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, int __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__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__Document(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__Element(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_QName(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_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__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__ParserContext(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__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__SaxParserContext(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__TargetParserContext(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_C14NWriterTarget(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__AsyncDataWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement(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__MethodChanger(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__Validator(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_XMLSchema(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_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___open_utf8_file(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type_replace = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type_split = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PySet_Type_update = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type_strip = {0, 0, 0, 0, 0};
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  #ifdef __Pyx_CyFunction_USED
  PyTypeObject *__pyx_CyFunctionType;
  #endif
  #ifdef __Pyx_FusedFunction_USED
  PyTypeObject *__pyx_FusedFunctionType;
  #endif
  #ifdef __Pyx_Generator_USED
  PyTypeObject *__pyx_GeneratorType;
  #endif
  #ifdef __Pyx_IterableCoroutine_USED
  PyTypeObject *__pyx_IterableCoroutineType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineAwaitType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineType;
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  PyObject *__pyx_type_4lxml_5etree_Error;
  PyObject *__pyx_type_4lxml_5etree_LxmlError;
  PyObject *__pyx_type_4lxml_5etree_C14NError;
  PyObject *__pyx_type_4lxml_5etree__TempStore;
  PyObject *__pyx_type_4lxml_5etree__ExceptionContext;
  PyObject *__pyx_type_4lxml_5etree__LogEntry;
  PyObject *__pyx_type_4lxml_5etree__BaseErrorLog;
  PyObject *__pyx_type_4lxml_5etree__ListErrorLog;
  PyObject *__pyx_type_4lxml_5etree__ErrorLogContext;
  PyObject *__pyx_type_4lxml_5etree__ErrorLog;
  PyObject *__pyx_type_4lxml_5etree__DomainErrorLog;
  PyObject *__pyx_type_4lxml_5etree__RotatingErrorLog;
  PyObject *__pyx_type_4lxml_5etree_PyErrorLog;
  PyObject *LxmlDocumentType;
  PyObject *__pyx_type_4lxml_5etree_DocInfo;
  PyObject *LxmlElementType;
  PyObject *__pyx_type_4lxml_5etree___ContentOnlyElement;
  PyObject *__pyx_type_4lxml_5etree__Comment;
  PyObject *__pyx_type_4lxml_5etree__ProcessingInstruction;
  PyObject *__pyx_type_4lxml_5etree__Entity;
  PyObject *__pyx_type_4lxml_5etree_QName;
  PyObject *LxmlElementTreeType;
  PyObject *__pyx_type_4lxml_5etree__Attrib;
  PyObject *__pyx_type_4lxml_5etree__AttribIterator;
  PyObject *LxmlElementTagMatcherType;
  PyObject *LxmlElementIteratorType;
  PyObject *__pyx_type_4lxml_5etree__MultiTagMatcher;
  PyObject *__pyx_type_4lxml_5etree__ElementMatchIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementChildIterator;
  PyObject *__pyx_type_4lxml_5etree_SiblingsIterator;
  PyObject *__pyx_type_4lxml_5etree_AncestorsIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  PyObject *__pyx_type_4lxml_5etree_ElementTextIterator;
  PyObject *__pyx_type_4lxml_5etree_CDATA;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  PyObject *__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  PyObject *__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  PyObject *__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  PyObject *__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  PyObject *__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  PyObject *LxmlElementBaseType;
  PyObject *__pyx_type_4lxml_5etree_CommentBase;
  PyObject *__pyx_type_4lxml_5etree_PIBase;
  PyObject *__pyx_type_4lxml_5etree_EntityBase;
  PyObject *LxmlElementClassLookupType;
  PyObject *LxmlFallbackElementClassLookupType;
  PyObject *__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  PyObject *__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_CustomElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_PythonElementClassLookup;
  PyObject *__pyx_type_4lxml_5etree_LxmlRegistryError;
  PyObject *__pyx_type_4lxml_5etree_NamespaceRegistryError;
  PyObject *__pyx_type_4lxml_5etree__NamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  PyObject *__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  PyObject *__pyx_type_4lxml_5etree__InputDocument;
  PyObject *__pyx_type_4lxml_5etree_Resolver;
  PyObject *__pyx_type_4lxml_5etree__ResolverRegistry;
  PyObject *__pyx_type_4lxml_5etree__ResolverContext;
  PyObject *__pyx_type_4lxml_5etree_ParserError;
  PyObject *__pyx_type_4lxml_5etree__ParserDictionaryContext;
  PyObject *__pyx_type_4lxml_5etree__FileReaderContext;
  PyObject *__pyx_type_4lxml_5etree__ParserContext;
  PyObject *__pyx_type_4lxml_5etree__BaseParser;
  PyObject *__pyx_type_4lxml_5etree__FeedParser;
  PyObject *__pyx_type_4lxml_5etree_XMLParser;
  PyObject *__pyx_type_4lxml_5etree_XMLPullParser;
  PyObject *__pyx_type_4lxml_5etree_ETCompatXMLParser;
  PyObject *__pyx_type_4lxml_5etree_HTMLParser;
  PyObject *__pyx_type_4lxml_5etree_HTMLPullParser;
  PyObject *__pyx_type_4lxml_5etree__SaxParserTarget;
  PyObject *__pyx_type_4lxml_5etree__SaxParserContext;
  PyObject *__pyx_type_4lxml_5etree__ParseEventsIterator;
  PyObject *__pyx_type_4lxml_5etree_TreeBuilder;
  PyObject *__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  PyObject *__pyx_type_4lxml_5etree__TargetParserContext;
  PyObject *__pyx_type_4lxml_5etree_SerialisationError;
  PyObject *__pyx_type_4lxml_5etree__FilelikeWriter;
  PyObject *__pyx_type_4lxml_5etree_C14NWriterTarget;
  PyObject *__pyx_type_4lxml_5etree_xmlfile;
  PyObject *__pyx_type_4lxml_5etree_htmlfile;
  PyObject *__pyx_type_4lxml_5etree__IncrementalFileWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncDataWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter;
  PyObject *__pyx_type_4lxml_5etree__AsyncFileWriterElement;
  PyObject *__pyx_type_4lxml_5etree__FileWriterElement;
  PyObject *__pyx_type_4lxml_5etree__MethodChanger;
  PyObject *__pyx_type_4lxml_5etree_iterparse;
  PyObject *__pyx_type_4lxml_5etree_iterwalk;
  PyObject *__pyx_type_4lxml_5etree__IDDict;
  PyObject *__pyx_type_4lxml_5etree_XIncludeError;
  PyObject *__pyx_type_4lxml_5etree_XInclude;
  PyObject *__pyx_type_4lxml_5etree_XPathError;
  PyObject *__pyx_type_4lxml_5etree_XPathEvalError;
  PyObject *__pyx_type_4lxml_5etree_XPathFunctionError;
  PyObject *__pyx_type_4lxml_5etree_XPathResultError;
  PyObject *__pyx_type_4lxml_5etree__ExsltRegExp;
  PyObject *__pyx_type_4lxml_5etree__BaseContext;
  PyObject *__pyx_type_4lxml_5etree__ElementUnicodeResult;
  PyObject *__pyx_type_4lxml_5etree__XPathContext;
  PyObject *__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  PyObject *__pyx_type_4lxml_5etree_XPathElementEvaluator;
  PyObject *__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  PyObject *__pyx_type_4lxml_5etree_XPath;
  PyObject *__pyx_type_4lxml_5etree_ETXPath;
  PyObject *__pyx_type_4lxml_5etree_XSLTError;
  PyObject *__pyx_type_4lxml_5etree_XSLTParseError;
  PyObject *__pyx_type_4lxml_5etree_XSLTApplyError;
  PyObject *__pyx_type_4lxml_5etree_XSLTExtensionError;
  PyObject *__pyx_type_4lxml_5etree__XSLTResolverContext;
  PyObject *__pyx_type_4lxml_5etree_XSLTAccessControl;
  PyObject *__pyx_type_4lxml_5etree__XSLTContext;
  PyObject *__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  PyObject *__pyx_type_4lxml_5etree_XSLT;
  PyObject *__pyx_type_4lxml_5etree__XSLTResultTree;
  PyObject *__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  PyObject *__pyx_type_4lxml_5etree_XSLTExtension;
  PyObject *__pyx_type_4lxml_5etree_DocumentInvalid;
  PyObject *__pyx_type_4lxml_5etree__Validator;
  PyObject *__pyx_type_4lxml_5etree_DTDError;
  PyObject *__pyx_type_4lxml_5etree_DTDParseError;
  PyObject *__pyx_type_4lxml_5etree_DTDValidateError;
  PyObject *__pyx_type_4lxml_5etree__DTDElementContentDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDAttributeDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDElementDecl;
  PyObject *__pyx_type_4lxml_5etree__DTDEntityDecl;
  PyObject *__pyx_type_4lxml_5etree_DTD;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGParseError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNGValidateError;
  PyObject *__pyx_type_4lxml_5etree_RelaxNG;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaParseError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchemaValidateError;
  PyObject *__pyx_type_4lxml_5etree_XMLSchema;
  PyObject *__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  PyObject *__pyx_type_4lxml_5etree_SchematronError;
  PyObject *__pyx_type_4lxml_5etree_SchematronParseError;
  PyObject *__pyx_type_4lxml_5etree_SchematronValidateError;
  PyObject *__pyx_type_4lxml_5etree_Schematron;
  PyObject *__pyx_type_4lxml_5etree__MemDebug;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_7_write;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_8__close;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements;
  PyObject *__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities;
  #endif
  PyTypeObject *__pyx_ptype_4lxml_5etree_Error;
  PyTypeObject *__pyx_ptype_4lxml_5etree_LxmlError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_C14NError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__TempStore;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ExceptionContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__LogEntry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ListErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLogContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DomainErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__RotatingErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PyErrorLog;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Document;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DocInfo;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Element;
  PyTypeObject *__pyx_ptype_4lxml_5etree___ContentOnlyElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Comment;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ProcessingInstruction;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Entity;
  PyTypeObject *__pyx_ptype_4lxml_5etree_QName;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTree;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Attrib;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AttribIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTagMatcher;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MultiTagMatcher;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementMatchIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementChildIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SiblingsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_AncestorsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementTextIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CDATA;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CommentBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PIBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_EntityBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_CustomElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_PythonElementClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree_LxmlRegistryError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_NamespaceRegistryError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__NamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__InputDocument;
  PyTypeObject *__pyx_ptype_4lxml_5etree_Resolver;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverRegistry;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ParserError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserDictionaryContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FileReaderContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FeedParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLPullParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ETCompatXMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLPullParser;
  PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParseEventsIterator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_TreeBuilder;
  PyTypeObject *__pyx_ptype_4lxml_5etree__PythonSaxParserTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree__TargetParserContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SerialisationError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FilelikeWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree_C14NWriterTarget;
  PyTypeObject *__pyx_ptype_4lxml_5etree_xmlfile;
  PyTypeObject *__pyx_ptype_4lxml_5etree_htmlfile;
  PyTypeObject *__pyx_ptype_4lxml_5etree__IncrementalFileWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncDataWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter;
  PyTypeObject *__pyx_ptype_4lxml_5etree__AsyncFileWriterElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__FileWriterElement;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MethodChanger;
  PyTypeObject *__pyx_ptype_4lxml_5etree_iterparse;
  PyTypeObject *__pyx_ptype_4lxml_5etree_iterwalk;
  PyTypeObject *__pyx_ptype_4lxml_5etree__IDDict;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XIncludeError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XInclude;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathEvalError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathFunctionError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathResultError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ExsltRegExp;
  PyTypeObject *__pyx_ptype_4lxml_5etree__BaseContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ElementUnicodeResult;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XPath;
  PyTypeObject *__pyx_ptype_4lxml_5etree_ETXPath;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTApplyError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtensionError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResolverContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTAccessControl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLT;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResultTree;
  PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtension;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DocumentInvalid;
  PyTypeObject *__pyx_ptype_4lxml_5etree__Validator;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTDValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementContentDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDAttributeDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree__DTDEntityDecl;
  PyTypeObject *__pyx_ptype_4lxml_5etree_DTD;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNGValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNG;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchemaValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchema;
  PyTypeObject *__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronParseError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_SchematronValidateError;
  PyTypeObject *__pyx_ptype_4lxml_5etree_Schematron;
  PyTypeObject *__pyx_ptype_4lxml_5etree__MemDebug;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements;
  PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities;
  PyObject *__pyx_kp_u_0_9;
  PyObject *__pyx_kp_u_1;
  PyObject *__pyx_kp_b_25;
  PyObject *__pyx_n_b_A;
  PyObject *__pyx_n_b_ASCII;
  PyObject *__pyx_n_u_ASCII;
  PyObject *__pyx_kp_u_All_strings_must_be_XML_compatib;
  PyObject *__pyx_kp_s_An_XMLSyntaxError_that_addition;
  PyObject *__pyx_n_s_AncestorsIterator;
  PyObject *__pyx_n_s_AppendOnlyElementProxy_append;
  PyObject *__pyx_n_s_AppendOnlyElementProxy_extend;
  PyObject *__pyx_kp_u_Argument_is_not_a_file_like_obje;
  PyObject *__pyx_kp_u_Argument_must_be_bytes_or_unicod;
  PyObject *__pyx_kp_u_Argument_must_be_string_or_unico;
  PyObject *__pyx_n_s_AssertionError;
  PyObject *__pyx_n_s_AsyncDataWriter_close;
  PyObject *__pyx_n_s_AsyncDataWriter_write;
  PyObject *__pyx_n_s_AsyncFileWriterElement___aenter;
  PyObject *__pyx_n_s_AsyncFileWriterElement___aexit;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter__clo;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_elem;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_flus;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_meth;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_writ;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_writ_2;
  PyObject *__pyx_n_s_AsyncIncrementalFileWriter_writ_3;
  PyObject *__pyx_n_s_Attrib;
  PyObject *__pyx_n_s_Attrib___copy;
  PyObject *__pyx_n_s_Attrib___deepcopy;
  PyObject *__pyx_n_s_Attrib_clear;
  PyObject *__pyx_n_s_Attrib_get;
  PyObject *__pyx_n_s_Attrib_has_key;
  PyObject *__pyx_n_s_Attrib_items;
  PyObject *__pyx_n_s_Attrib_iteritems;
  PyObject *__pyx_n_s_Attrib_iterkeys;
  PyObject *__pyx_n_s_Attrib_itervalues;
  PyObject *__pyx_n_s_Attrib_keys;
  PyObject *__pyx_n_s_Attrib_pop;
  PyObject *__pyx_n_s_Attrib_update;
  PyObject *__pyx_n_s_Attrib_values;
  PyObject *__pyx_n_s_AttributeBasedElementClassLookup;
  PyObject *__pyx_n_u_AttributeBasedElementClassLookup;
  PyObject *__pyx_n_s_AttributeError;
  PyObject *__pyx_n_u_BE;
  PyObject *__pyx_n_s_BaseErrorLog;
  PyObject *__pyx_n_s_BaseErrorLog_copy;
  PyObject *__pyx_n_s_BaseErrorLog_receive;
  PyObject *__pyx_n_s_BaseException;
  PyObject *__pyx_n_s_BaseParser_copy;
  PyObject *__pyx_n_s_BaseParser_makeelement;
  PyObject *__pyx_n_s_BaseParser_set_element_class_lo;
  PyObject *__pyx_kp_s_Base_class_for_all_syntax_errors;
  PyObject *__pyx_n_s_BytesIO;
  PyObject *__pyx_n_s_C14NError;
  PyObject *__pyx_n_u_C14NError;
  PyObject *__pyx_n_s_C14NWriterTarget;
  PyObject *__pyx_n_u_C14NWriterTarget;
  PyObject *__pyx_n_s_C14NWriterTarget__iter_namespace;
  PyObject *__pyx_n_s_C14NWriterTarget__start_locals_l;
  PyObject *__pyx_n_s_C14NWriterTarget_close;
  PyObject *__pyx_n_s_C14NWriterTarget_comment;
  PyObject *__pyx_n_s_C14NWriterTarget_data;
  PyObject *__pyx_n_s_C14NWriterTarget_end;
  PyObject *__pyx_n_s_C14NWriterTarget_pi;
  PyObject *__pyx_n_s_C14NWriterTarget_start;
  PyObject *__pyx_n_s_C14NWriterTarget_start_ns;
  PyObject *__pyx_kp_u_C14N_failed;
  PyObject *__pyx_n_s_CDATA;
  PyObject *__pyx_n_u_CDATA;
  PyObject *__pyx_n_s_CRITICAL;
  PyObject *__pyx_n_s_CSSSelector;
  PyObject *__pyx_kp_u_Can_only_discard_comments_in_C14;
  PyObject *__pyx_kp_u_Can_only_strip_text_in_C14N_2_0;
  PyObject *__pyx_kp_u_Cannot_asynchronously_write_to_a;
  PyObject *__pyx_kp_u_Cannot_change_the_xml_prefix_of;
  PyObject *__pyx_kp_u_Cannot_enable_XML_declaration_in;
  PyObject *__pyx_kp_u_Cannot_parse_stylesheet;
  PyObject *__pyx_kp_u_Cannot_resolve_URI;
  PyObject *__pyx_kp_u_Cannot_specify_encoding_with_C14;
  PyObject *__pyx_kp_b_Char_out_of_XML_range;
  PyObject *__pyx_n_s_Comment;
  PyObject *__pyx_n_u_Comment;
  PyObject *__pyx_n_s_CommentBase;
  PyObject *__pyx_n_u_CommentBase;
  PyObject *__pyx_n_s_Comment_2;
  PyObject *__pyx_kp_u_Comment_may_not_contain_or_end_w;
  PyObject *__pyx_n_s_ContentOnlyElement_append;
  PyObject *__pyx_n_s_ContentOnlyElement_get;
  PyObject *__pyx_n_s_ContentOnlyElement_insert;
  PyObject *__pyx_n_s_ContentOnlyElement_items;
  PyObject *__pyx_n_s_ContentOnlyElement_keys;
  PyObject *__pyx_n_s_ContentOnlyElement_set;
  PyObject *__pyx_n_s_ContentOnlyElement_values;
  PyObject *__pyx_kp_u_Could_not_create_I_O_writer_cont;
  PyObject *__pyx_kp_u_Could_not_find_root_node;
  PyObject *__pyx_n_s_CustomElementClassLookup;
  PyObject *__pyx_n_u_CustomElementClassLookup;
  PyObject *__pyx_n_s_CustomElementClassLookup_lookup;
  PyObject *__pyx_n_s_DEBUG;
  PyObject *__pyx_n_u_DEBUG;
  PyObject *__pyx_n_s_DENY_ALL;
  PyObject *__pyx_n_s_DENY_WRITE;
  PyObject *__pyx_kp_u_DOCTYPE;
  PyObject *__pyx_kp_u_DOCTYPE_already_written_or_canno;
  PyObject *__pyx_n_s_DTD;
  PyObject *__pyx_n_u_DTD;
  PyObject *__pyx_n_s_DTDAttributeDecl_itervalues;
  PyObject *__pyx_n_s_DTDAttributeDecl_values;
  PyObject *__pyx_n_s_DTDElementDecl_attributes;
  PyObject *__pyx_n_s_DTDElementDecl_iterattributes;
  PyObject *__pyx_n_s_DTDError;
  PyObject *__pyx_n_u_DTDError;
  PyObject *__pyx_n_s_DTDParseError;
  PyObject *__pyx_n_u_DTDParseError;
  PyObject *__pyx_n_s_DTDValidateError;
  PyObject *__pyx_n_u_DTDValidateError;
  PyObject *__pyx_n_s_DTD_elements;
  PyObject *__pyx_n_s_DTD_entities;
  PyObject *__pyx_n_s_DTD_iterelements;
  PyObject *__pyx_n_s_DTD_iterentities;
  PyObject *__pyx_kp_u_DTD_not_initialised;
  PyObject *__pyx_n_s_DeprecationWarning;
  PyObject *__pyx_n_s_DocInfo;
  PyObject *__pyx_n_s_DocInfo_clear;
  PyObject *__pyx_n_s_Document;
  PyObject *__pyx_n_s_DocumentInvalid;
  PyObject *__pyx_n_u_DocumentInvalid;
  PyObject *__pyx_kp_u_Document_does_not_comply_with_sc;
  PyObject *__pyx_kp_u_Document_is_not_a_valid_Schematr;
  PyObject *__pyx_kp_u_Document_is_not_parsable_as_Rela;
  PyObject *__pyx_kp_u_Document_is_not_valid_Relax_NG;
  PyObject *__pyx_kp_u_Document_is_not_valid_XML_Schema;
  PyObject *__pyx_kp_u_Document_is_not_well_formed;
  PyObject *__pyx_n_s_DomainErrorLog;
  PyObject *__pyx_n_s_DomainErrorLog_receive;
  PyObject *__pyx_n_s_ERROR;
  PyObject *__pyx_n_s_ERR_INVALID_CHAR;
  PyObject *__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER;
  PyObject *__pyx_n_s_ERR_UNDECLARED_ENTITY;
  PyObject *__pyx_n_s_ETCompatXMLParser;
  PyObject *__pyx_n_u_ETCompatXMLParser;
  PyObject *__pyx_n_s_ETXPath;
  PyObject *__pyx_n_u_ETXPath;
  PyObject *__pyx_kp_u_Either_xml_data_or_from_file_mus;
  PyObject *__pyx_kp_u_Element;
  PyObject *__pyx_n_s_ElementBase;
  PyObject *__pyx_n_u_ElementBase;
  PyObject *__pyx_n_s_ElementChildIterator;
  PyObject *__pyx_n_s_ElementClassLookup;
  PyObject *__pyx_n_u_ElementClassLookup;
  PyObject *__pyx_n_s_ElementDefaultClassLookup;
  PyObject *__pyx_n_u_ElementDefaultClassLookup;
  PyObject *__pyx_n_s_ElementDepthFirstIterator;
  PyObject *__pyx_n_s_ElementIterator;
  PyObject *__pyx_n_s_ElementMatchIterator;
  PyObject *__pyx_n_s_ElementNamespaceClassLookup;
  PyObject *__pyx_n_u_ElementNamespaceClassLookup;
  PyObject *__pyx_n_s_ElementNamespaceClassLookup_get;
  PyObject *__pyx_n_s_ElementTagMatcher;
  PyObject *__pyx_n_s_ElementTextIterator;
  PyObject *__pyx_n_s_ElementTree;
  PyObject *__pyx_n_u_ElementTree;
  PyObject *__pyx_n_s_ElementTree_2;
  PyObject *__pyx_n_s_ElementTree___copy;
  PyObject *__pyx_n_s_ElementTree___deepcopy;
  PyObject *__pyx_n_s_ElementTree__setroot;
  PyObject *__pyx_n_s_ElementTree_find;
  PyObject *__pyx_n_s_ElementTree_findall;
  PyObject *__pyx_n_s_ElementTree_findtext;
  PyObject *__pyx_n_s_ElementTree_getelementpath;
  PyObject *__pyx_n_s_ElementTree_getiterator;
  PyObject *__pyx_n_s_ElementTree_getpath;
  PyObject *__pyx_n_s_ElementTree_getroot;
  PyObject *__pyx_n_s_ElementTree_iter;
  PyObject *__pyx_n_s_ElementTree_iterfind;
  PyObject *__pyx_kp_u_ElementTree_not_initialized_miss;
  PyObject *__pyx_n_s_ElementTree_parse;
  PyObject *__pyx_n_s_ElementTree_relaxng;
  PyObject *__pyx_n_s_ElementTree_write;
  PyObject *__pyx_n_s_ElementTree_write_c14n;
  PyObject *__pyx_n_s_ElementTree_xinclude;
  PyObject *__pyx_n_s_ElementTree_xmlschema;
  PyObject *__pyx_n_s_ElementTree_xpath;
  PyObject *__pyx_n_s_ElementTree_xslt;
  PyObject *__pyx_n_s_ElementUnicodeResult;
  PyObject *__pyx_n_s_ElementUnicodeResult_getparent;
  PyObject *__pyx_n_s_Element_2;
  PyObject *__pyx_n_u_Element_2;
  PyObject *__pyx_n_s_Element_3;
  PyObject *__pyx_n_s_Element___copy;
  PyObject *__pyx_n_s_Element___deepcopy;
  PyObject *__pyx_n_s_Element___reversed;
  PyObject *__pyx_n_s_Element__init;
  PyObject *__pyx_n_s_Element_addnext;
  PyObject *__pyx_n_s_Element_addprevious;
  PyObject *__pyx_n_s_Element_append;
  PyObject *__pyx_n_s_Element_clear;
  PyObject *__pyx_n_s_Element_cssselect;
  PyObject *__pyx_n_s_Element_extend;
  PyObject *__pyx_n_s_Element_find;
  PyObject *__pyx_n_s_Element_findall;
  PyObject *__pyx_n_s_Element_findtext;
  PyObject *__pyx_n_s_Element_get;
  PyObject *__pyx_n_s_Element_getchildren;
  PyObject *__pyx_n_s_Element_getiterator;
  PyObject *__pyx_n_s_Element_getnext;
  PyObject *__pyx_n_s_Element_getparent;
  PyObject *__pyx_n_s_Element_getprevious;
  PyObject *__pyx_n_s_Element_getroottree;
  PyObject *__pyx_n_s_Element_index;
  PyObject *__pyx_n_s_Element_insert;
  PyObject *__pyx_kp_u_Element_is_not_a_child_of_this_n;
  PyObject *__pyx_kp_u_Element_is_not_in_this_tree;
  PyObject *__pyx_kp_u_Element_is_not_in_this_tree_2;
  PyObject *__pyx_n_s_Element_items;
  PyObject *__pyx_n_s_Element_iter;
  PyObject *__pyx_n_s_Element_iterancestors;
  PyObject *__pyx_n_s_Element_iterchildren;
  PyObject *__pyx_n_s_Element_iterdescendants;
  PyObject *__pyx_n_s_Element_iterfind;
  PyObject *__pyx_n_s_Element_itersiblings;
  PyObject *__pyx_n_s_Element_itertext;
  PyObject *__pyx_n_s_Element_keys;
  PyObject *__pyx_n_s_Element_makeelement;
  PyObject *__pyx_n_s_Element_remove;
  PyObject *__pyx_n_s_Element_replace;
  PyObject *__pyx_n_s_Element_set;
  PyObject *__pyx_n_s_Element_values;
  PyObject *__pyx_n_s_Element_xpath;
  PyObject *__pyx_kp_u_Empty_tag_name;
  PyObject *__pyx_kp_b_Encoding_error;
  PyObject *__pyx_n_s_Entity;
  PyObject *__pyx_n_u_Entity;
  PyObject *__pyx_n_s_EntityBase;
  PyObject *__pyx_n_u_EntityBase;
  PyObject *__pyx_n_s_Entity_2;
  PyObject *__pyx_kp_u_Entity_class_must_be_subclass_of;
  PyObject *__pyx_n_s_Error;
  PyObject *__pyx_n_u_Error;
  PyObject *__pyx_n_s_ErrorDomains;
  PyObject *__pyx_n_u_ErrorDomains;
  PyObject *__pyx_n_s_ErrorLevels;
  PyObject *__pyx_n_u_ErrorLevels;
  PyObject *__pyx_n_s_ErrorLog;
  PyObject *__pyx_n_s_ErrorLog___exit;
  PyObject *__pyx_n_s_ErrorLog_clear;
  PyObject *__pyx_n_s_ErrorLog_copy;
  PyObject *__pyx_n_s_ErrorLog_receive;
  PyObject *__pyx_n_s_ErrorTypes;
  PyObject *__pyx_n_u_ErrorTypes;
  PyObject *__pyx_kp_u_Error_applying_stylesheet;
  PyObject *__pyx_kp_u_Error_applying_stylesheet_line;
  PyObject *__pyx_kp_u_Error_during_serialisation_out_o;
  PyObject *__pyx_kp_u_Error_in_xpath_expression;
  PyObject *__pyx_kp_u_Error_reading;
  PyObject *__pyx_kp_u_Error_reading_file;
  PyObject *__pyx_kp_s_Error_serialising_an_XSLT_result;
  PyObject *__pyx_kp_b_Expected_for_variable_reference;
  PyObject *__pyx_n_s_ExsltRegExp_match;
  PyObject *__pyx_n_s_ExsltRegExp_replace;
  PyObject *__pyx_n_s_ExsltRegExp_test;
  PyObject *__pyx_n_s_Extension;
  PyObject *__pyx_n_u_Extension;
  PyObject *__pyx_n_s_FATAL;
  PyObject *__pyx_kp_u_Failed_to_create_file;
  PyObject *__pyx_kp_u_Failed_to_create_validation_cont;
  PyObject *__pyx_n_s_FallbackElementClassLookup;
  PyObject *__pyx_n_u_FallbackElementClassLookup;
  PyObject *__pyx_n_s_FallbackElementClassLookup_set_f;
  PyObject *__pyx_n_s_FeedParser;
  PyObject *__pyx_n_s_FeedParser_close;
  PyObject *__pyx_n_s_FeedParser_feed;
  PyObject *__pyx_n_s_FileWriterElement___enter;
  PyObject *__pyx_n_s_FileWriterElement___exit;
  PyObject *__pyx_kp_u_File_is_already_closed;
  PyObject *__pyx_kp_u_File_or_filename_expected_got;
  PyObject *__pyx_kp_b_Forbidden_variable;
  PyObject *__pyx_n_s_FunctionNamespace;
  PyObject *__pyx_n_u_FunctionNamespace;
  PyObject *__pyx_kp_u_FunctionNamespace_line_207;
  PyObject *__pyx_kp_u_FunctionNamespace_ns_uri_Retriev;
  PyObject *__pyx_kp_u_FunctionNamespace_r;
  PyObject *__pyx_n_s_FutureWarning;
  PyObject *__pyx_n_u_GlobalErrorLog;
  PyObject *__pyx_n_s_GzipFile;
  PyObject *__pyx_n_s_HTML;
  PyObject *__pyx_n_u_HTML;
  PyObject *__pyx_n_s_HTMLParser;
  PyObject *__pyx_n_u_HTMLParser;
  PyObject *__pyx_n_s_HTMLPullParser;
  PyObject *__pyx_n_s_HTMLPullParser_read_events;
  PyObject *__pyx_n_s_ICONV_COMPILED_VERSION;
  PyObject *__pyx_n_s_IDDict;
  PyObject *__pyx_n_s_IDDict_copy;
  PyObject *__pyx_n_s_IDDict_get;
  PyObject *__pyx_n_s_IDDict_has_key;
  PyObject *__pyx_n_s_IDDict_items;
  PyObject *__pyx_n_s_IDDict_iteritems;
  PyObject *__pyx_n_s_IDDict_iterkeys;
  PyObject *__pyx_n_s_IDDict_itervalues;
  PyObject *__pyx_n_s_IDDict_keys;
  PyObject *__pyx_n_s_IDDict_values;
  PyObject *__pyx_kp_u_ID_attribute_not_found;
  PyObject *__pyx_n_s_IGNORECASE;
  PyObject *__pyx_n_s_IOError;
  PyObject *__pyx_kp_u_Illegal_Unicode_kind;
  PyObject *__pyx_kp_u_Illegal_document_provided_NULL;
  PyObject *__pyx_kp_u_Illegal_document_provided_expect;
  PyObject *__pyx_n_s_ImmutableMapping;
  PyObject *__pyx_n_s_ImmutableMapping___contains;
  PyObject *__pyx_n_s_ImmutableMapping___delitem;
  PyObject *__pyx_n_s_ImmutableMapping___getitem;
  PyObject *__pyx_n_s_ImmutableMapping___iter;
  PyObject *__pyx_n_s_ImmutableMapping___len;
  PyObject *__pyx_n_s_ImmutableMapping___setitem;
  PyObject *__pyx_n_s_ImportError;
  PyObject *__pyx_kp_u_Inconsistent_enter_action_in_con;
  PyObject *__pyx_kp_u_Inconsistent_exit_action_in_cont;
  PyObject *__pyx_n_s_IncrementalFileWriter_element;
  PyObject *__pyx_n_s_IncrementalFileWriter_flush;
  PyObject *__pyx_n_s_IncrementalFileWriter_method;
  PyObject *__pyx_n_s_IncrementalFileWriter_write;
  PyObject *__pyx_n_s_IncrementalFileWriter_write_dec;
  PyObject *__pyx_n_s_IncrementalFileWriter_write_doc;
  PyObject *__pyx_n_s_IndexError;
  PyObject *__pyx_kp_u_Initial_indentation_level_must_b;
  PyObject *__pyx_kp_u_Input_object_has_no_document;
  PyObject *__pyx_kp_u_Input_object_is_not_an_XML_eleme;
  PyObject *__pyx_kp_u_Internal_error_in_DTD_validation;
  PyObject *__pyx_kp_u_Internal_error_in_Relax_NG_valid;
  PyObject *__pyx_kp_u_Internal_error_in_Schematron_val;
  PyObject *__pyx_kp_u_Internal_error_in_XML_Schema_val;
  PyObject *__pyx_kp_u_Invalid_HTML_tag_name;
  PyObject *__pyx_kp_u_Invalid_PI_name;
  PyObject *__pyx_kp_u_Invalid_URL_must_not_contain_or;
  PyObject *__pyx_kp_u_Invalid_attribute_dictionary;
  PyObject *__pyx_kp_u_Invalid_attribute_name;
  PyObject *__pyx_kp_u_Invalid_character;
  PyObject *__pyx_kp_u_Invalid_character_reference;
  PyObject *__pyx_kp_u_Invalid_character_s;
  PyObject *__pyx_kp_u_Invalid_child_type;
  PyObject *__pyx_kp_b_Invalid_context_position;
  PyObject *__pyx_kp_b_Invalid_context_size;
  PyObject *__pyx_kp_u_Invalid_entity_name;
  PyObject *__pyx_kp_u_Invalid_entity_reference;
  PyObject *__pyx_kp_b_Invalid_expression;
  PyObject *__pyx_kp_u_Invalid_input_object;
  PyObject *__pyx_kp_u_Invalid_input_tag_of_type;
  PyObject *__pyx_kp_u_Invalid_namespace_URI;
  PyObject *__pyx_kp_u_Invalid_namespace_prefix;
  PyObject *__pyx_kp_b_Invalid_number_of_arguments;
  PyObject *__pyx_kp_b_Invalid_operand;
  PyObject *__pyx_kp_b_Invalid_or_incomplete_context;
  PyObject *__pyx_kp_b_Invalid_predicate;
  PyObject *__pyx_kp_u_Invalid_tag_name;
  PyObject *__pyx_kp_u_Invalid_tag_name_2;
  PyObject *__pyx_kp_b_Invalid_type;
  PyObject *__pyx_n_s_KeyError;
  PyObject *__pyx_n_u_LE;
  PyObject *__pyx_n_s_LIBXML_COMPILED_VERSION;
  PyObject *__pyx_n_u_LIBXML_COMPILED_VERSION;
  PyObject *__pyx_n_s_LIBXML_VERSION;
  PyObject *__pyx_n_u_LIBXML_VERSION;
  PyObject *__pyx_n_s_LIBXSLT_COMPILED_VERSION;
  PyObject *__pyx_n_u_LIBXSLT_COMPILED_VERSION;
  PyObject *__pyx_n_s_LIBXSLT_VERSION;
  PyObject *__pyx_n_u_LIBXSLT_VERSION;
  PyObject *__pyx_n_s_LXML_VERSION;
  PyObject *__pyx_n_u_LXML_VERSION;
  PyObject *__pyx_kp_s_Libxml2_RelaxNG_error_types;
  PyObject *__pyx_kp_s_Libxml2_error_domains;
  PyObject *__pyx_kp_s_Libxml2_error_levels;
  PyObject *__pyx_kp_s_Libxml2_error_types;
  PyObject *__pyx_n_s_ListErrorLog;
  PyObject *__pyx_n_s_ListErrorLog_copy;
  PyObject *__pyx_n_s_ListErrorLog_filter_domains;
  PyObject *__pyx_n_s_ListErrorLog_filter_from_errors;
  PyObject *__pyx_n_s_ListErrorLog_filter_from_fatals;
  PyObject *__pyx_n_s_ListErrorLog_filter_from_level;
  PyObject *__pyx_n_s_ListErrorLog_filter_from_warnin;
  PyObject *__pyx_n_s_ListErrorLog_filter_levels;
  PyObject *__pyx_n_s_ListErrorLog_filter_types;
  PyObject *__pyx_n_s_LogEntry;
  PyObject *__pyx_n_s_LookupError;
  PyObject *__pyx_n_s_LxmlError;
  PyObject *__pyx_n_u_LxmlError;
  PyObject *__pyx_n_s_LxmlRegistryError;
  PyObject *__pyx_n_u_LxmlRegistryError;
  PyObject *__pyx_n_s_LxmlSyntaxError;
  PyObject *__pyx_n_u_LxmlSyntaxError;
  PyObject *__pyx_n_s_MemDebug_blocks_used;
  PyObject *__pyx_n_s_MemDebug_bytes_used;
  PyObject *__pyx_n_s_MemDebug_dict_size;
  PyObject *__pyx_n_s_MemDebug_dump;
  PyObject *__pyx_n_s_MemDebug_show;
  PyObject *__pyx_n_s_MemoryError;
  PyObject *__pyx_kp_b_Memory_allocation_error;
  PyObject *__pyx_n_s_MethodChanger___aenter;
  PyObject *__pyx_n_s_MethodChanger___aexit;
  PyObject *__pyx_n_s_MethodChanger___enter;
  PyObject *__pyx_n_s_MethodChanger___exit;
  PyObject *__pyx_kp_u_Method_changed_outside_of_contex;
  PyObject *__pyx_kp_b_Missing_closing_curly_brace;
  PyObject *__pyx_n_s_MutableMapping;
  PyObject *__pyx_n_u_NAMESPACE;
  PyObject *__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE;
  PyObject *__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3;
  PyObject *__pyx_kp_u_Name_not_registered;
  PyObject *__pyx_kp_u_Namespace;
  PyObject *__pyx_n_s_NamespaceRegistryError;
  PyObject *__pyx_n_u_NamespaceRegistryError;
  PyObject *__pyx_n_s_NamespaceRegistry___deco;
  PyObject *__pyx_n_s_NamespaceRegistry__deco;
  PyObject *__pyx_n_s_NamespaceRegistry_clear;
  PyObject *__pyx_n_s_NamespaceRegistry_items;
  PyObject *__pyx_n_s_NamespaceRegistry_iteritems;
  PyObject *__pyx_n_s_NamespaceRegistry_update;
  PyObject *__pyx_kp_u_Namespace_r;
  PyObject *__pyx_kp_u_No_ID_dictionary_available;
  PyObject *__pyx_kp_u_No_document_to_serialise;
  PyObject *__pyx_kp_u_No_tree_or_file_given;
  PyObject *__pyx_kp_u_Node_must_not_be_None;
  PyObject *__pyx_kp_u_Non_Element_values_not_supported;
  PyObject *__pyx_kp_u_None;
  PyObject *__pyx_n_s_NotImplemented;
  PyObject *__pyx_n_s_NotImplementedError;
  PyObject *__pyx_kp_u_Not_yet_implemented_result_node;
  PyObject *__pyx_kp_b_Number_encoding;
  PyObject *__pyx_n_b_Ok;
  PyObject *__pyx_kp_u_Only_elements_can_be_the_root_of;
  PyObject *__pyx_kp_u_Only_processing_instructions_and;
  PyObject *__pyx_n_s_OpaqueDocumentWrapper_append;
  PyObject *__pyx_n_s_OpaqueDocumentWrapper_extend;
  PyObject *__pyx_n_s_OrderedDict;
  PyObject *__pyx_kp_u_Output_file_needs_an_async_write;
  PyObject *__pyx_n_u_PARSER;
  PyObject *__pyx_n_s_PI;
  PyObject *__pyx_n_u_PI;
  PyObject *__pyx_n_s_PIBase;
  PyObject *__pyx_n_u_PIBase;
  PyObject *__pyx_kp_u_PI_class_must_be_subclass_of_PIB;
  PyObject *__pyx_kp_u_PI_lacks_content;
  PyObject *__pyx_kp_u_PI_text_must_not_contain;
  PyObject *__pyx_kp_u_PUBLIC;
  PyObject *__pyx_n_s_ParseError;
  PyObject *__pyx_n_u_ParseError;
  PyObject *__pyx_n_s_ParseError___init;
  PyObject *__pyx_n_s_ParseError_position;
  PyObject *__pyx_n_s_ParserBasedElementClassLookup;
  PyObject *__pyx_n_u_ParserBasedElementClassLookup;
  PyObject *__pyx_n_u_ParserDictionaryContext;
  PyObject *__pyx_n_s_ParserError;
  PyObject *__pyx_n_u_ParserError;
  PyObject *__pyx_kp_u_ParserSchemaValidationContext_n;
  PyObject *__pyx_kp_u_Parsing_requires_string_data;
  PyObject *__pyx_kp_u_Prefix;
  PyObject *__pyx_kp_u_Prefix_format_reserved_for_inter;
  PyObject *__pyx_n_s_ProcessingInstruction;
  PyObject *__pyx_n_u_ProcessingInstruction;
  PyObject *__pyx_n_s_ProcessingInstruction_2;
  PyObject *__pyx_n_s_ProcessingInstruction_get;
  PyObject *__pyx_kp_u_Proxy_invalidated;
  PyObject *__pyx_n_s_PyErrorLog;
  PyObject *__pyx_n_u_PyErrorLog;
  PyObject *__pyx_n_s_PyErrorLog_copy;
  PyObject *__pyx_n_s_PyErrorLog_log;
  PyObject *__pyx_n_s_PyErrorLog_receive;
  PyObject *__pyx_n_s_PythonElementClassLookup;
  PyObject *__pyx_n_u_PythonElementClassLookup;
  PyObject *__pyx_n_s_PythonElementClassLookup_lookup;
  PyObject *__pyx_n_s_QName;
  PyObject *__pyx_n_u_QName;
  PyObject *__pyx_n_s_RELAXNGV;
  PyObject *__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY;
  PyObject *__pyx_n_s_ReadOnlyElementProxy_get;
  PyObject *__pyx_n_s_ReadOnlyElementProxy_items;
  PyObject *__pyx_n_s_ReadOnlyElementProxy_keys;
  PyObject *__pyx_n_s_ReadOnlyElementProxy_values;
  PyObject *__pyx_n_s_ReadOnlyProxy___copy;
  PyObject *__pyx_n_s_ReadOnlyProxy___deepcopy;
  PyObject *__pyx_n_s_ReadOnlyProxy_getchildren;
  PyObject *__pyx_n_s_ReadOnlyProxy_getnext;
  PyObject *__pyx_n_s_ReadOnlyProxy_getparent;
  PyObject *__pyx_n_s_ReadOnlyProxy_getprevious;
  PyObject *__pyx_n_s_ReadOnlyProxy_iterchildren;
  PyObject *__pyx_n_s_ReferenceError;
  PyObject *__pyx_kp_u_Registered_element_classes_must;
  PyObject *__pyx_kp_u_Registered_functions_must_be_cal;
  PyObject *__pyx_n_s_RelaxNG;
  PyObject *__pyx_n_u_RelaxNG;
  PyObject *__pyx_n_s_RelaxNGError;
  PyObject *__pyx_n_u_RelaxNGError;
  PyObject *__pyx_n_s_RelaxNGErrorTypes;
  PyObject *__pyx_n_u_RelaxNGErrorTypes;
  PyObject *__pyx_n_s_RelaxNGParseError;
  PyObject *__pyx_n_u_RelaxNGParseError;
  PyObject *__pyx_n_s_RelaxNGValidateError;
  PyObject *__pyx_n_u_RelaxNGValidateError;
  PyObject *__pyx_n_s_RelaxNG_from_rnc_string;
  PyObject *__pyx_kp_u_RelaxNG_instance_not_initialised;
  PyObject *__pyx_n_s_Resolver;
  PyObject *__pyx_n_u_Resolver;
  PyObject *__pyx_n_s_ResolverRegistry_add;
  PyObject *__pyx_n_s_ResolverRegistry_copy;
  PyObject *__pyx_n_s_ResolverRegistry_remove;
  PyObject *__pyx_n_s_ResolverRegistry_resolve;
  PyObject *__pyx_n_s_Resolver_resolve;
  PyObject *__pyx_n_s_Resolver_resolve_empty;
  PyObject *__pyx_n_s_Resolver_resolve_file;
  PyObject *__pyx_n_s_Resolver_resolve_filename;
  PyObject *__pyx_n_s_Resolver_resolve_string;
  PyObject *__pyx_kp_b_Resource_error;
  PyObject *__pyx_n_s_RotatingErrorLog;
  PyObject *__pyx_n_s_RotatingErrorLog_receive;
  PyObject *__pyx_kp_u_SYSTEM;
  PyObject *__pyx_n_s_SaxParserTarget;
  PyObject *__pyx_kp_u_Schema_instance_not_initialised;
  PyObject *__pyx_n_s_Schematron;
  PyObject *__pyx_n_u_Schematron;
  PyObject *__pyx_n_s_SchematronError;
  PyObject *__pyx_n_u_SchematronError;
  PyObject *__pyx_n_s_SchematronParseError;
  PyObject *__pyx_n_u_SchematronParseError;
  PyObject *__pyx_n_s_SchematronValidateError;
  PyObject *__pyx_n_u_SchematronValidateError;
  PyObject *__pyx_kp_u_Schematron_instance_not_initiali;
  PyObject *__pyx_n_s_SerialisationError;
  PyObject *__pyx_n_u_SerialisationError;
  PyObject *__pyx_kp_u_Serialisation_to_unicode_must_no;
  PyObject *__pyx_n_s_SiblingsIterator;
  PyObject *__pyx_kp_b_Stack_usage_error;
  PyObject *__pyx_kp_b_Start_of_literal;
  PyObject *__pyx_n_s_StopIteration;
  PyObject *__pyx_n_s_StringIO;
  PyObject *__pyx_n_s_SubElement;
  PyObject *__pyx_n_u_SubElement;
  PyObject *__pyx_kp_b_Sub_resource_error;
  PyObject *__pyx_n_s_SyntaxError;
  PyObject *__pyx_kp_b_Syntax_error;
  PyObject *__pyx_kp_s_Syntax_error_while_parsing_an_XM;
  PyObject *__pyx_kp_s_Syntax_error_while_parsing_an_XM_2;
  PyObject *__pyx_kp_u_System_URL_may_not_contain_both;
  PyObject *__pyx_n_u_TAG;
  PyObject *__pyx_n_s_TargetParserResult;
  PyObject *__pyx_n_s_TargetParserResult___init;
  PyObject *__pyx_kp_u_The_behavior_of_this_method_will;
  PyObject *__pyx_kp_u_The_docstring_option_is_deprecat;
  PyObject *__pyx_kp_u_This_class_cannot_be_instantiate;
  PyObject *__pyx_kp_u_This_is_not_a_supported_node_set;
  PyObject *__pyx_kp_u_This_search_incorrectly_ignores;
  PyObject *__pyx_kp_u_This_type_cannot_be_instantiated;
  PyObject *__pyx_n_s_TreeBuilder;
  PyObject *__pyx_n_u_TreeBuilder;
  PyObject *__pyx_n_s_TreeBuilder_close;
  PyObject *__pyx_n_s_TreeBuilder_comment;
  PyObject *__pyx_n_s_TreeBuilder_data;
  PyObject *__pyx_n_s_TreeBuilder_end;
  PyObject *__pyx_n_s_TreeBuilder_pi;
  PyObject *__pyx_n_s_TreeBuilder_start;
  PyObject *__pyx_kp_u_Tried_to_unregister_unknown_prox;
  PyObject *__pyx_kp_u_Type;
  PyObject *__pyx_n_s_TypeError;
  PyObject *__pyx_n_s_U;
  PyObject *__pyx_n_s_UNICODE;
  PyObject *__pyx_kp_u_US_ASCII;
  PyObject *__pyx_n_u_UTF8;
  PyObject *__pyx_kp_u_UTF_8;
  PyObject *__pyx_kp_b_Undefined_namespace_prefix;
  PyObject *__pyx_kp_b_Undefined_variable;
  PyObject *__pyx_kp_u_Undefined_xpath_result;
  PyObject *__pyx_kp_b_Unfinished_literal;
  PyObject *__pyx_n_s_UnicodeDecodeError;
  PyObject *__pyx_n_s_UnicodeEncodeError;
  PyObject *__pyx_kp_u_Unicode_strings_with_encoding_de;
  PyObject *__pyx_kp_b_Unknown_error;
  PyObject *__pyx_kp_u_Unknown_libxml2_version;
  PyObject *__pyx_kp_u_Unknown_node_type;
  PyObject *__pyx_kp_u_Unknown_return_type;
  PyObject *__pyx_kp_u_Unknown_xpath_result;
  PyObject *__pyx_kp_b_Unregistered_function;
  PyObject *__pyx_kp_u_Unsupported_element_type;
  PyObject *__pyx_kp_u_Unsupported_node_type;
  PyObject *__pyx_n_s_Validator;
  PyObject *__pyx_n_s_Validator__append_log_message;
  PyObject *__pyx_n_s_Validator__clear_error_log;
  PyObject *__pyx_n_s_Validator_assert;
  PyObject *__pyx_n_s_Validator_assertValid;
  PyObject *__pyx_n_s_Validator_validate;
  PyObject *__pyx_n_s_ValueError;
  PyObject *__pyx_n_s_WARNING;
  PyObject *__pyx_n_s_WAR_UNDECLARED_ENTITY;
  PyObject *__pyx_n_u_X;
  PyObject *__pyx_n_s_XInclude;
  PyObject *__pyx_n_u_XInclude;
  PyObject *__pyx_n_s_XIncludeError;
  PyObject *__pyx_n_u_XIncludeError;
  PyObject *__pyx_kp_u_XInclude_instance_not_initialise;
  PyObject *__pyx_kp_u_XInclude_processing_failed;
  PyObject *__pyx_kp_u_XInclude_processor_not_initialis;
  PyObject *__pyx_n_s_XML;
  PyObject *__pyx_n_u_XML;
  PyObject *__pyx_n_s_XMLDTDID;
  PyObject *__pyx_n_u_XMLDTDID;
  PyObject *__pyx_n_s_XMLID;
  PyObject *__pyx_n_u_XMLID;
  PyObject *__pyx_n_s_XMLParser;
  PyObject *__pyx_n_u_XMLParser;
  PyObject *__pyx_n_s_XMLPullParser;
  PyObject *__pyx_n_s_XMLPullParser_read_events;
  PyObject *__pyx_n_s_XMLSchema;
  PyObject *__pyx_n_u_XMLSchema;
  PyObject *__pyx_n_s_XMLSchemaError;
  PyObject *__pyx_n_u_XMLSchemaError;
  PyObject *__pyx_n_s_XMLSchemaParseError;
  PyObject *__pyx_n_u_XMLSchemaParseError;
  PyObject *__pyx_n_s_XMLSchemaValidateError;
  PyObject *__pyx_n_u_XMLSchemaValidateError;
  PyObject *__pyx_n_s_XMLSyntaxAssertionError;
  PyObject *__pyx_n_s_XMLSyntaxAssertionError___init;
  PyObject *__pyx_n_s_XMLSyntaxError;
  PyObject *__pyx_n_u_XMLSyntaxError;
  PyObject *__pyx_n_s_XMLTreeBuilder;
  PyObject *__pyx_n_u_XMLTreeBuilder;
  PyObject *__pyx_kp_u_XML_declaration_already_written;
  PyObject *__pyx_kp_u_XML_line_3261;
  PyObject *__pyx_kp_u_XML_text_parser_None_base_url_No;
  PyObject *__pyx_n_u_XPATH_LOCATIONSET;
  PyObject *__pyx_n_u_XPATH_POINT;
  PyObject *__pyx_n_u_XPATH_RANGE;
  PyObject *__pyx_n_u_XPATH_USERS;
  PyObject *__pyx_n_s_XPath;
  PyObject *__pyx_n_u_XPath;
  PyObject *__pyx_n_s_XPathDocumentEvaluator;
  PyObject *__pyx_n_u_XPathDocumentEvaluator;
  PyObject *__pyx_n_s_XPathElementEvaluator;
  PyObject *__pyx_n_s_XPathElementEvaluator_register_n;
  PyObject *__pyx_n_s_XPathElementEvaluator_register_n_2;
  PyObject *__pyx_n_s_XPathError;
  PyObject *__pyx_n_u_XPathError;
  PyObject *__pyx_n_s_XPathEvalError;
  PyObject *__pyx_n_u_XPathEvalError;
  PyObject *__pyx_n_s_XPathEvaluator;
  PyObject *__pyx_n_u_XPathEvaluator;
  PyObject *__pyx_n_s_XPathEvaluatorBase;
  PyObject *__pyx_n_s_XPathFunctionError;
  PyObject *__pyx_n_u_XPathFunctionError;
  PyObject *__pyx_n_s_XPathResultError;
  PyObject *__pyx_n_u_XPathResultError;
  PyObject *__pyx_n_s_XPathSyntaxError;
  PyObject *__pyx_n_u_XPathSyntaxError;
  PyObject *__pyx_kp_u_XPath_context_is_only_usable_dur;
  PyObject *__pyx_kp_u_XPath_context_not_initialised;
  PyObject *__pyx_kp_u_XPath_evaluator_locking_failed;
  PyObject *__pyx_kp_u_XPath_evaluator_not_initialised;
  PyObject *__pyx_kp_u_XPath_function;
  PyObject *__pyx_n_s_XSLT;
  PyObject *__pyx_n_u_XSLT;
  PyObject *__pyx_n_s_XSLTAccessControl;
  PyObject *__pyx_n_u_XSLTAccessControl;
  PyObject *__pyx_n_s_XSLTApplyError;
  PyObject *__pyx_n_u_XSLTApplyError;
  PyObject *__pyx_n_s_XSLTError;
  PyObject *__pyx_n_u_XSLTError;
  PyObject *__pyx_n_u_XSLTErrorLog;
  PyObject *__pyx_n_s_XSLTExtension;
  PyObject *__pyx_n_u_XSLTExtension;
  PyObject *__pyx_n_s_XSLTExtensionError;
  PyObject *__pyx_n_u_XSLTExtensionError;
  PyObject *__pyx_n_s_XSLTExtension_apply_templates;
  PyObject *__pyx_n_s_XSLTExtension_execute;
  PyObject *__pyx_n_s_XSLTExtension_process_children;
  PyObject *__pyx_n_s_XSLTParseError;
  PyObject *__pyx_n_u_XSLTParseError;
  PyObject *__pyx_n_s_XSLTProcessingInstruction;
  PyObject *__pyx_n_s_XSLTProcessingInstruction_parse;
  PyObject *__pyx_n_s_XSLTProcessingInstruction_set;
  PyObject *__pyx_n_s_XSLTResultTree;
  PyObject *__pyx_n_s_XSLTResultTree_write_output;
  PyObject *__pyx_n_s_XSLTSaveError;
  PyObject *__pyx_n_u_XSLTSaveError;
  PyObject *__pyx_n_s_XSLT___copy;
  PyObject *__pyx_n_s_XSLT___deepcopy;
  PyObject *__pyx_kp_u_XSLT_context_not_initialised;
  PyObject *__pyx_n_s_XSLT_set_global_max_depth;
  PyObject *__pyx_n_s_XSLT_strparam;
  PyObject *__pyx_kp_u_XSLT_stylesheet_not_initialised;
  PyObject *__pyx_n_s_XSLT_tostring;
  PyObject *__pyx_n_s__106;
  PyObject *__pyx_kp_u__11;
  PyObject *__pyx_kp_b__12;
  PyObject *__pyx_kp_u__12;
  PyObject *__pyx_kp_b__17;
  PyObject *__pyx_kp_u__17;
  PyObject *__pyx_kp_u__18;
  PyObject *__pyx_kp_u__19;
  PyObject *__pyx_kp_u__20;
  PyObject *__pyx_kp_b__21;
  PyObject *__pyx_kp_u__21;
  PyObject *__pyx_n_s__22;
  PyObject *__pyx_kp_b__22;
  PyObject *__pyx_kp_u__22;
  PyObject *__pyx_kp_u__24;
  PyObject *__pyx_kp_b__25;
  PyObject *__pyx_kp_u__25;
  PyObject *__pyx_kp_b__26;
  PyObject *__pyx_kp_u__26;
  PyObject *__pyx_kp_u__28;
  PyObject *__pyx_kp_u__29;
  PyObject *__pyx_kp_b__3;
  PyObject *__pyx_kp_u__3;
  PyObject *__pyx_kp_u__30;
  PyObject *__pyx_kp_u__32;
  PyObject *__pyx_kp_b__33;
  PyObject *__pyx_kp_u__33;
  PyObject *__pyx_kp_b__34;
  PyObject *__pyx_kp_u__34;
  PyObject *__pyx_kp_b__35;
  PyObject *__pyx_kp_u__35;
  PyObject *__pyx_kp_b__4;
  PyObject *__pyx_kp_u__4;
  PyObject *__pyx_kp_u__41;
  PyObject *__pyx_kp_u__42;
  PyObject *__pyx_kp_u__43;
  PyObject *__pyx_kp_u__45;
  PyObject *__pyx_kp_b__48;
  PyObject *__pyx_kp_b__489;
  PyObject *__pyx_kp_b__491;
  PyObject *__pyx_kp_b__50;
  PyObject *__pyx_kp_u__52;
  PyObject *__pyx_n_s__56;
  PyObject *__pyx_n_u__56;
  PyObject *__pyx_kp_u__57;
  PyObject *__pyx_kp_u__61;
  PyObject *__pyx_kp_b__63;
  PyObject *__pyx_kp_u__71;
  PyObject *__pyx_kp_u__72;
  PyObject *__pyx_kp_u__73;
  PyObject *__pyx_kp_u__74;
  PyObject *__pyx_kp_u__75;
  PyObject *__pyx_kp_u__95;
  PyObject *__pyx_kp_u__96;
  PyObject *__pyx_n_s_abspath;
  PyObject *__pyx_n_s_accepted_domains;
  PyObject *__pyx_n_s_access_control;
  PyObject *__pyx_n_s_add;
  PyObject *__pyx_n_s_addnext;
  PyObject *__pyx_n_s_addprevious;
  PyObject *__pyx_n_s_adopt_external_document;
  PyObject *__pyx_n_s_aenter;
  PyObject *__pyx_n_s_aexit;
  PyObject *__pyx_n_s_all;
  PyObject *__pyx_n_u_alpha;
  PyObject *__pyx_kp_u_ambiguous_reference_to_embedded;
  PyObject *__pyx_kp_u_amp;
  PyObject *__pyx_n_u_any;
  PyObject *__pyx_n_s_append;
  PyObject *__pyx_n_s_append_log_message;
  PyObject *__pyx_n_s_apply_templates;
  PyObject *__pyx_n_s_args;
  PyObject *__pyx_kp_u_argument_must_be_a_byte_string_o;
  PyObject *__pyx_n_u_ascii;
  PyObject *__pyx_n_s_assert;
  PyObject *__pyx_n_s_assertValid;
  PyObject *__pyx_n_s_async_outfile;
  PyObject *__pyx_n_s_asyncio_coroutines;
  PyObject *__pyx_kp_u_at_0x;
  PyObject *__pyx_kp_u_attempt_to_assign_sequence_of_si;
  PyObject *__pyx_n_s_attrib;
  PyObject *__pyx_n_s_attribute_defaults;
  PyObject *__pyx_n_s_attribute_name;
  PyObject *__pyx_n_s_attribute_names;
  PyObject *__pyx_n_s_attributes;
  PyObject *__pyx_n_s_attrs;
  PyObject *__pyx_n_s_await;
  PyObject *__pyx_n_s_base_url;
  PyObject *__pyx_n_u_beta;
  PyObject *__pyx_n_s_block_count;
  PyObject *__pyx_n_s_blocks_used;
  PyObject *__pyx_kp_u_boolean_xs_attribute_default_or;
  PyObject *__pyx_n_s_bstring;
  PyObject *__pyx_n_s_buffered;
  PyObject *__pyx_n_s_build_smart_strings;
  PyObject *__pyx_n_s_byte_count;
  PyObject *__pyx_n_s_bytes_used;
  PyObject *__pyx_n_u_c14n;
  PyObject *__pyx_n_u_c14n2;
  PyObject *__pyx_n_s_c_attr;
  PyObject *__pyx_n_s_c_attr_next;
  PyObject *__pyx_n_s_c_attrs;
  PyObject *__pyx_n_s_c_buffer;
  PyObject *__pyx_n_s_c_child;
  PyObject *__pyx_n_s_c_compression;
  PyObject *__pyx_n_s_c_context_node;
  PyObject *__pyx_n_s_c_count;
  PyObject *__pyx_n_s_c_ctxt;
  PyObject *__pyx_n_s_c_dict;
  PyObject *__pyx_n_s_c_doc;
  PyObject *__pyx_n_s_c_dtd;
  PyObject *__pyx_n_s_c_element;
  PyObject *__pyx_n_s_c_encoding;
  PyObject *__pyx_n_s_c_href;
  PyObject *__pyx_n_s_c_method;
  PyObject *__pyx_n_s_c_name;
  PyObject *__pyx_n_s_c_new_next;
  PyObject *__pyx_n_s_c_new_node;
  PyObject *__pyx_n_s_c_next;
  PyObject *__pyx_n_s_c_node;
  PyObject *__pyx_n_s_c_node_copy;
  PyObject *__pyx_n_s_c_node_next;
  PyObject *__pyx_n_s_c_old_next;
  PyObject *__pyx_n_s_c_old_node;
  PyObject *__pyx_n_s_c_old_output_parent;
  PyObject *__pyx_n_s_c_parent;
  PyObject *__pyx_n_s_c_path;
  PyObject *__pyx_n_s_c_source_doc;
  PyObject *__pyx_n_s_c_standalone;
  PyObject *__pyx_n_s_c_start;
  PyObject *__pyx_n_s_c_start_node;
  PyObject *__pyx_n_s_c_stop;
  PyObject *__pyx_n_s_c_version;
  PyObject *__pyx_kp_u_can_only_parse_strings;
  PyObject *__pyx_kp_u_cannot_add_ancestor_as_sibling_p;
  PyObject *__pyx_kp_u_cannot_append_document_already_h;
  PyObject *__pyx_kp_u_cannot_append_parent_to_itself;
  PyObject *__pyx_kp_u_cannot_append_trailing_element_t;
  PyObject *__pyx_kp_u_cannot_assign_None;
  PyObject *__pyx_kp_u_cannot_be_serialized;
  PyObject *__pyx_kp_u_cannot_parse_from;
  PyObject *__pyx_kp_u_cannot_serialize;
  PyObject *__pyx_kp_u_cannot_set_a_maximum_stylesheet;
  PyObject *__pyx_n_s_canonicalize;
  PyObject *__pyx_n_u_canonicalize;
  PyObject *__pyx_n_s_capsule;
  PyObject *__pyx_n_u_cdata;
  PyObject *__pyx_n_s_child;
  PyObject *__pyx_n_s_children;
  PyObject *__pyx_n_s_class;
  PyObject *__pyx_n_u_class;
  PyObject *__pyx_n_s_class_dict_iterable;
  PyObject *__pyx_n_s_class_getitem;
  PyObject *__pyx_n_s_class_mapping;
  PyObject *__pyx_n_s_cleanup_namespaces;
  PyObject *__pyx_n_u_cleanup_namespaces;
  PyObject *__pyx_n_s_clear;
  PyObject *__pyx_n_s_clear_error_log;
  PyObject *__pyx_n_s_clear_error_log_2;
  PyObject *__pyx_n_u_clear_error_log_2;
  PyObject *__pyx_n_s_cline_in_traceback;
  PyObject *__pyx_n_s_close;
  PyObject *__pyx_n_s_close_2;
  PyObject *__pyx_n_s_close_file;
  PyObject *__pyx_n_s_cls;
  PyObject *__pyx_n_s_code;
  PyObject *__pyx_n_s_codecs;
  PyObject *__pyx_n_s_collect_ids;
  PyObject *__pyx_n_s_collections;
  PyObject *__pyx_n_s_collections_abc;
  PyObject *__pyx_kp_u_column;
  PyObject *__pyx_n_s_column_2;
  PyObject *__pyx_n_s_comment;
  PyObject *__pyx_n_u_comment;
  PyObject *__pyx_kp_u_comment_class_must_be_subclass_o;
  PyObject *__pyx_n_s_comment_factory;
  PyObject *__pyx_n_s_compact;
  PyObject *__pyx_kp_u_compact_syntax_not_supported_ple;
  PyObject *__pyx_n_s_compile;
  PyObject *__pyx_n_s_compression;
  PyObject *__pyx_n_s_compresslevel;
  PyObject *__pyx_n_s_contains;
  PyObject *__pyx_n_s_content;
  PyObject *__pyx_n_s_context;
  PyObject *__pyx_n_s_contextlib;
  PyObject *__pyx_n_s_contextmanager;
  PyObject *__pyx_n_s_copy;
  PyObject *__pyx_n_s_copy_2;
  PyObject *__pyx_n_s_count;
  PyObject *__pyx_n_s_create_dir;
  PyObject *__pyx_n_u_create_dir;
  PyObject *__pyx_n_s_cssselect;
  PyObject *__pyx_n_s_ctxt;
  PyObject *__pyx_n_u_d;
  PyObject *__pyx_n_s_data;
  PyObject *__pyx_n_b_dc;
  PyObject *__pyx_n_s_deco;
  PyObject *__pyx_n_s_decode;
  PyObject *__pyx_n_s_deepcopy;
  PyObject *__pyx_n_s_default;
  PyObject *__pyx_kp_u_default_2;
  PyObject *__pyx_n_s_default_doctype;
  PyObject *__pyx_n_s_default_resolver;
  PyObject *__pyx_kp_u_default_value;
  PyObject *__pyx_n_s_default_value_2;
  PyObject *__pyx_n_s_delitem;
  PyObject *__pyx_n_u_dev;
  PyObject *__pyx_n_s_dic;
  PyObject *__pyx_n_s_dict;
  PyObject *__pyx_n_u_dict;
  PyObject *__pyx_n_s_dict_size;
  PyObject *__pyx_kp_u_disable;
  PyObject *__pyx_n_s_discard;
  PyObject *__pyx_n_s_doc;
  PyObject *__pyx_n_s_doc_2;
  PyObject *__pyx_n_s_doc_3;
  PyObject *__pyx_n_s_doc_ref;
  PyObject *__pyx_n_s_docformat;
  PyObject *__pyx_n_s_docstring;
  PyObject *__pyx_n_s_doctype;
  PyObject *__pyx_kp_u_document_context_is_missing;
  PyObject *__pyx_kp_u_document_external_context_nodes;
  PyObject *__pyx_n_s_domain;
  PyObject *__pyx_n_s_domain_name;
  PyObject *__pyx_n_s_domains;
  PyObject *__pyx_kp_u_double_registering_proxy;
  PyObject *__pyx_n_s_dtd_validation;
  PyObject *__pyx_n_s_dump;
  PyObject *__pyx_n_u_dump;
  PyObject *__pyx_n_s_dumps;
  PyObject *__pyx_kp_u_either_filename_or_external_ID_r;
  PyObject *__pyx_n_s_el;
  PyObject *__pyx_n_s_elem;
  PyObject *__pyx_n_s_element;
  PyObject *__pyx_n_u_element;
  PyObject *__pyx_kp_u_element_class_must_be_subclass_o;
  PyObject *__pyx_n_s_element_config;
  PyObject *__pyx_n_s_element_factory;
  PyObject *__pyx_n_s_element_or_tree;
  PyObject *__pyx_n_s_element_writer;
  PyObject *__pyx_n_s_elementpath;
  PyObject *__pyx_n_s_elements;
  PyObject *__pyx_n_s_elements_only;
  PyObject *__pyx_kp_u_elemname;
  PyObject *__pyx_n_s_elemname_2;
  PyObject *__pyx_n_u_empty;
  PyObject *__pyx_kp_u_empty_namespace_prefix_is_not_su;
  PyObject *__pyx_kp_u_empty_prefix_is_not_supported_in;
  PyObject *__pyx_kp_u_enable;
  PyObject *__pyx_n_s_enable_regexp;
  PyObject *__pyx_n_s_encode;
  PyObject *__pyx_n_s_encoding;
  PyObject *__pyx_n_s_end;
  PyObject *__pyx_n_u_end;
  PyObject *__pyx_kp_u_end_ns;
  PyObject *__pyx_n_s_end_ns_2;
  PyObject *__pyx_kp_u_end_tag_mismatch_expected;
  PyObject *__pyx_n_s_endswith;
  PyObject *__pyx_n_s_enter;
  PyObject *__pyx_n_s_entities;
  PyObject *__pyx_n_u_entities;
  PyObject *__pyx_n_s_entity;
  PyObject *__pyx_n_u_entity;
  PyObject *__pyx_n_s_entries;
  PyObject *__pyx_n_s_entry;
  PyObject *__pyx_n_s_enumerate;
  PyObject *__pyx_n_u_enumeration;
  PyObject *__pyx_n_s_error_log;
  PyObject *__pyx_kp_u_error_parsing_DTD;
  PyObject *__pyx_n_s_etree;
  PyObject *__pyx_n_s_etree_or_element;
  PyObject *__pyx_n_s_etree_or_element_2;
  PyObject *__pyx_n_s_evaluator;
  PyObject *__pyx_n_s_events;
  PyObject *__pyx_n_s_exc_context;
  PyObject *__pyx_n_s_exc_info;
  PyObject *__pyx_n_s_exc_tb;
  PyObject *__pyx_n_s_exc_type;
  PyObject *__pyx_n_s_exc_val;
  PyObject *__pyx_n_s_exclude_attrs;
  PyObject *__pyx_n_s_exclude_tags;
  PyObject *__pyx_n_s_exclusive;
  PyObject *__pyx_n_s_execute;
  PyObject *__pyx_n_s_exit;
  PyObject *__pyx_kp_u_expected;
  PyObject *__pyx_kp_u_expected_string_or_Element;
  PyObject *__pyx_n_s_expr;
  PyObject *__pyx_n_s_extend;
  PyObject *__pyx_kp_u_extension_element;
  PyObject *__pyx_n_s_extensions;
  PyObject *__pyx_kp_u_extensions_must_have_non_empty_n;
  PyObject *__pyx_kp_u_extensions_must_not_have_empty_n;
  PyObject *__pyx_n_s_external_id;
  PyObject *__pyx_n_s_extra;
  PyObject *__pyx_n_s_f;
  PyObject *__pyx_n_s_fallback;
  PyObject *__pyx_n_s_feed;
  PyObject *__pyx_n_s_feed_error_log;
  PyObject *__pyx_n_s_file;
  PyObject *__pyx_kp_b_file_2;
  PyObject *__pyx_kp_u_file_must_be_a_filename_file_lik;
  PyObject *__pyx_n_s_filelike;
  PyObject *__pyx_n_s_filename;
  PyObject *__pyx_n_s_fileobj;
  PyObject *__pyx_n_s_filter_domains;
  PyObject *__pyx_n_s_filter_from_errors;
  PyObject *__pyx_n_s_filter_from_fatals;
  PyObject *__pyx_n_s_filter_from_level;
  PyObject *__pyx_n_s_filter_from_warnings;
  PyObject *__pyx_n_s_filter_levels;
  PyObject *__pyx_n_s_filter_types;
  PyObject *__pyx_n_s_filtered;
  PyObject *__pyx_n_s_find;
  PyObject *__pyx_n_s_findall;
  PyObject *__pyx_n_s_findtext;
  PyObject *__pyx_n_s_first_error;
  PyObject *__pyx_n_u_fixed;
  PyObject *__pyx_n_s_flags;
  PyObject *__pyx_n_s_flush;
  PyObject *__pyx_n_s_for_html;
  PyObject *__pyx_n_s_from_file;
  PyObject *__pyx_n_s_from_rnc_string;
  PyObject *__pyx_n_s_fromstring;
  PyObject *__pyx_n_u_fromstring;
  PyObject *__pyx_n_s_fromstringlist;
  PyObject *__pyx_n_u_fromstringlist;
  PyObject *__pyx_n_s_function_mapping;
  PyObject *__pyx_n_s_function_name;
  PyObject *__pyx_n_s_functions;
  PyObject *__pyx_n_s_functools;
  PyObject *__pyx_n_u_g;
  PyObject *__pyx_kp_u_g_1_g_2;
  PyObject *__pyx_kp_u_gc;
  PyObject *__pyx_n_s_get;
  PyObject *__pyx_n_s_getLogger;
  PyObject *__pyx_n_s_getName;
  PyObject *__pyx_n_s_get_default_parser;
  PyObject *__pyx_n_u_get_default_parser;
  PyObject *__pyx_n_s_get_namespace;
  PyObject *__pyx_n_s_getargspec;
  PyObject *__pyx_n_s_getattribute;
  PyObject *__pyx_n_s_getchildren;
  PyObject *__pyx_n_s_getdefaultencoding;
  PyObject *__pyx_n_s_getelementpath;
  PyObject *__pyx_n_s_getfilesystemencoding;
  PyObject *__pyx_n_s_getfullargspec;
  PyObject *__pyx_n_s_getitem;
  PyObject *__pyx_n_s_getiterator;
  PyObject *__pyx_n_s_getnext;
  PyObject *__pyx_n_s_getparent;
  PyObject *__pyx_n_s_getpath;
  PyObject *__pyx_n_s_getprevious;
  PyObject *__pyx_n_s_getroot;
  PyObject *__pyx_n_s_getroottree;
  PyObject *__pyx_n_s_geturl;
  PyObject *__pyx_n_s_getvalue;
  PyObject *__pyx_n_u_getvalue;
  PyObject *__pyx_n_s_getwriter;
  PyObject *__pyx_kp_u_got;
  PyObject *__pyx_kp_u_got_invalid_input_value_of_type;
  PyObject *__pyx_n_s_group;
  PyObject *__pyx_n_s_groups;
  PyObject *__pyx_kp_u_gt;
  PyObject *__pyx_n_s_gzip;
  PyObject *__pyx_n_s_has_key;
  PyObject *__pyx_n_u_href;
  PyObject *__pyx_kp_u_href_2;
  PyObject *__pyx_n_s_href_utf;
  PyObject *__pyx_n_s_hrefs;
  PyObject *__pyx_n_b_html;
  PyObject *__pyx_n_s_html;
  PyObject *__pyx_n_u_html;
  PyObject *__pyx_n_s_htmlfile;
  PyObject *__pyx_kp_b_http_codespeak_net_lxml_objectif;
  PyObject *__pyx_kp_b_http_exslt_org_regular_expressio;
  PyObject *__pyx_kp_b_http_purl_org_dc_elements_1_1;
  PyObject *__pyx_kp_b_http_schemas_xmlsoap_org_wsdl;
  PyObject *__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s;
  PyObject *__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo;
  PyObject *__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo;
  PyObject *__pyx_kp_b_http_www_w3_org_1999_xhtml;
  PyObject *__pyx_kp_b_http_www_w3_org_2001_XMLSchema;
  PyObject *__pyx_kp_u_http_www_w3_org_2001_XMLSchema;
  PyObject *__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i;
  PyObject *__pyx_kp_u_http_www_w3_org_XML_1998_namesp;
  PyObject *__pyx_kp_b_http_www_w3_org_XML_1998_namespa;
  PyObject *__pyx_kp_u_http_www_w3_org_XML_1998_namespa;
  PyObject *__pyx_n_s_huge_tree;
  PyObject *__pyx_n_u_i;
  PyObject *__pyx_n_s_id;
  PyObject *__pyx_n_u_id;
  PyObject *__pyx_n_s_id_name;
  PyObject *__pyx_n_u_idref;
  PyObject *__pyx_n_u_idrefs;
  PyObject *__pyx_n_u_implied;
  PyObject *__pyx_n_s_import;
  PyObject *__pyx_kp_u_in_public_id;
  PyObject *__pyx_n_s_inclusive;
  PyObject *__pyx_n_s_inclusive_ns_prefixes;
  PyObject *__pyx_kp_u_inconsistent_exit_action_in_cont;
  PyObject *__pyx_n_s_indent;
  PyObject *__pyx_n_s_index;
  PyObject *__pyx_kp_u_index_out_of_range;
  PyObject *__pyx_n_s_init;
  PyObject *__pyx_n_s_init_2;
  PyObject *__pyx_n_s_init_subclass;
  PyObject *__pyx_n_s_initializing;
  PyObject *__pyx_n_s_input;
  PyObject *__pyx_kp_u_input_is_not_an_Element;
  PyObject *__pyx_n_s_input_node;
  PyObject *__pyx_n_s_insert;
  PyObject *__pyx_n_s_insert_comments;
  PyObject *__pyx_n_s_insert_pis;
  PyObject *__pyx_n_s_inspect;
  PyObject *__pyx_n_s_int;
  PyObject *__pyx_n_s_int1;
  PyObject *__pyx_n_s_int2;
  PyObject *__pyx_n_u_internal;
  PyObject *__pyx_kp_u_internal_error_tail;
  PyObject *__pyx_kp_u_internal_error_text;
  PyObject *__pyx_n_s_intersection;
  PyObject *__pyx_kp_u_invalid_DTD_proxy_at_s;
  PyObject *__pyx_kp_u_invalid_Document_proxy_at_s;
  PyObject *__pyx_kp_u_invalid_Element_proxy_at_s;
  PyObject *__pyx_kp_u_invalid_argument_type;
  PyObject *__pyx_kp_u_invalid_element;
  PyObject *__pyx_kp_u_invalid_event_name;
  PyObject *__pyx_kp_u_invalid_node_type;
  PyObject *__pyx_n_s_io;
  PyObject *__pyx_n_s_is_coroutine;
  PyObject *__pyx_kp_u_is_not_declared_in_scope;
  PyObject *__pyx_n_s_is_owned;
  PyObject *__pyx_n_s_is_standalone;
  PyObject *__pyx_n_s_iselement;
  PyObject *__pyx_n_u_iselement;
  PyObject *__pyx_kp_u_isenabled;
  PyObject *__pyx_n_s_islice;
  PyObject *__pyx_n_s_isspace;
  PyObject *__pyx_n_s_item;
  PyObject *__pyx_n_s_items;
  PyObject *__pyx_n_u_items;
  PyObject *__pyx_n_s_iter;
  PyObject *__pyx_n_s_iter_2;
  PyObject *__pyx_n_s_iter_namespaces;
  PyObject *__pyx_n_s_iterancestors;
  PyObject *__pyx_n_s_iterattributes;
  PyObject *__pyx_n_s_iterchildren;
  PyObject *__pyx_n_s_iterdescendants;
  PyObject *__pyx_n_s_iterelements;
  PyObject *__pyx_n_s_iterentities;
  PyObject *__pyx_n_s_iterfind;
  PyObject *__pyx_n_s_iteritems;
  PyObject *__pyx_n_s_iterkeys;
  PyObject *__pyx_n_s_iterparse;
  PyObject *__pyx_n_u_iterparse;
  PyObject *__pyx_n_s_iterparse_makeelement;
  PyObject *__pyx_n_s_iterparse_set_element_class_look;
  PyObject *__pyx_n_s_itersiblings;
  PyObject *__pyx_n_s_itertext;
  PyObject *__pyx_n_s_itertools;
  PyObject *__pyx_n_s_itervalues;
  PyObject *__pyx_n_s_iterwalk;
  PyObject *__pyx_n_u_iterwalk;
  PyObject *__pyx_n_s_iterwalk_skip_subtree;
  PyObject *__pyx_n_s_join;
  PyObject *__pyx_n_s_k;
  PyObject *__pyx_n_s_keep_ns_prefixes;
  PyObject *__pyx_n_s_keep_tail;
  PyObject *__pyx_n_s_key;
  PyObject *__pyx_kp_u_key_not_found;
  PyObject *__pyx_n_s_keys;
  PyObject *__pyx_n_s_kw;
  PyObject *__pyx_n_s_kwargs;
  PyObject *__pyx_n_s_l;
  PyObject *__pyx_n_s_last_error;
  PyObject *__pyx_n_s_len;
  PyObject *__pyx_n_s_level;
  PyObject *__pyx_n_s_level_name;
  PyObject *__pyx_n_s_levels;
  PyObject *__pyx_kp_u_libxml2_d_d_d;
  PyObject *__pyx_kp_u_line;
  PyObject *__pyx_n_s_line_2;
  PyObject *__pyx_kp_u_line_3;
  PyObject *__pyx_n_s_lineno;
  PyObject *__pyx_kp_u_list_index_out_of_range;
  PyObject *__pyx_kp_u_list_index_x_x_not_in_list;
  PyObject *__pyx_kp_u_list_index_x_x_not_in_slice;
  PyObject *__pyx_n_s_load;
  PyObject *__pyx_n_s_load_dtd;
  PyObject *__pyx_n_s_loads;
  PyObject *__pyx_n_s_log;
  PyObject *__pyx_n_s_log_entry;
  PyObject *__pyx_n_s_logger;
  PyObject *__pyx_n_s_logger_name;
  PyObject *__pyx_n_s_logging;
  PyObject *__pyx_n_s_lookup;
  PyObject *__pyx_n_s_lower;
  PyObject *__pyx_kp_u_lt;
  PyObject *__pyx_n_s_lxml;
  PyObject *__pyx_n_s_lxml_cssselect;
  PyObject *__pyx_n_s_lxml_etree;
  PyObject *__pyx_kp_u_lxml_etree_was_compiled_without;
  PyObject *__pyx_n_s_main;
  PyObject *__pyx_n_s_makeelement;
  PyObject *__pyx_kp_u_malformed_PI_attributes;
  PyObject *__pyx_n_b_match;
  PyObject *__pyx_n_s_match;
  PyObject *__pyx_n_u_match;
  PyObject *__pyx_n_s_matcher;
  PyObject *__pyx_n_u_matches;
  PyObject *__pyx_n_s_max_depth;
  PyObject *__pyx_n_s_max_len;
  PyObject *__pyx_n_s_memo;
  PyObject *__pyx_n_s_memory_debugger;
  PyObject *__pyx_kp_b_memorydump;
  PyObject *__pyx_kp_b_memorylist;
  PyObject *__pyx_n_s_message;
  PyObject *__pyx_n_s_metaclass;
  PyObject *__pyx_n_s_method;
  PyObject *__pyx_kp_u_missing_end_tags;
  PyObject *__pyx_kp_u_missing_toplevel_element;
  PyObject *__pyx_n_u_mixed;
  PyObject *__pyx_n_s_mode;
  PyObject *__pyx_n_s_module;
  PyObject *__pyx_n_s_module_2;
  PyObject *__pyx_n_s_mro_entries;
  PyObject *__pyx_n_u_mult;
  PyObject *__pyx_n_s_n;
  PyObject *__pyx_n_u_n;
  PyObject *__pyx_n_s_name;
  PyObject *__pyx_n_u_name;
  PyObject *__pyx_n_s_name_2;
  PyObject *__pyx_n_s_name_utf;
  PyObject *__pyx_n_s_names;
  PyObject *__pyx_n_s_namespace;
  PyObject *__pyx_n_s_namespaces;
  PyObject *__pyx_n_s_new;
  PyObject *__pyx_n_s_new_doc;
  PyObject *__pyx_n_s_new_element;
  PyObject *__pyx_n_s_new_namespaces;
  PyObject *__pyx_n_s_new_pos;
  PyObject *__pyx_n_u_nmtoken;
  PyObject *__pyx_n_u_nmtokens;
  PyObject *__pyx_kp_u_no_content_written;
  PyObject *__pyx_kp_u_no_context_node;
  PyObject *__pyx_kp_u_no_element_found;
  PyObject *__pyx_n_s_no_network;
  PyObject *__pyx_n_s_node;
  PyObject *__pyx_n_u_none;
  PyObject *__pyx_kp_u_not_allowed_inside_CDATA;
  PyObject *__pyx_kp_u_not_found;
  PyObject *__pyx_kp_u_not_found_2;
  PyObject *__pyx_kp_u_not_in_an_element;
  PyObject *__pyx_n_u_notation;
  PyObject *__pyx_n_s_ns;
  PyObject *__pyx_n_s_ns_clean;
  PyObject *__pyx_kp_u_ns_d;
  PyObject *__pyx_kp_b_ns_d_2;
  PyObject *__pyx_n_s_ns_stack;
  PyObject *__pyx_n_s_ns_uri;
  PyObject *__pyx_n_s_ns_utf;
  PyObject *__pyx_n_s_nsmap;
  PyObject *__pyx_n_s_obj;
  PyObject *__pyx_n_s_object;
  PyObject *__pyx_kp_u_object_name;
  PyObject *__pyx_kp_u_occur;
  PyObject *__pyx_n_s_occur_2;
  PyObject *__pyx_kp_u_of_QName;
  PyObject *__pyx_kp_u_of_name;
  PyObject *__pyx_n_s_offset;
  PyObject *__pyx_n_s_old;
  PyObject *__pyx_n_s_old_element;
  PyObject *__pyx_n_s_old_writer;
  PyObject *__pyx_n_u_once;
  PyObject *__pyx_kp_u_only_XML_documents_have_declarat;
  PyObject *__pyx_kp_u_only_setting_the_href_attribute;
  PyObject *__pyx_n_s_open;
  PyObject *__pyx_n_s_open_utf8_file;
  PyObject *__pyx_n_u_opt;
  PyObject *__pyx_n_s_options;
  PyObject *__pyx_n_u_or;
  PyObject *__pyx_n_s_os_path;
  PyObject *__pyx_n_s_other_element;
  PyObject *__pyx_n_s_out;
  PyObject *__pyx_n_s_outfile;
  PyObject *__pyx_n_s_output_file;
  PyObject *__pyx_n_s_output_parent;
  PyObject *__pyx_n_s_parent;
  PyObject *__pyx_n_s_parse;
  PyObject *__pyx_n_u_parse;
  PyObject *__pyx_n_s_parseXSL;
  PyObject *__pyx_n_s_parse_options;
  PyObject *__pyx_n_s_parseid;
  PyObject *__pyx_n_u_parseid;
  PyObject *__pyx_n_s_parser;
  PyObject *__pyx_kp_u_parser_locking_failed;
  PyObject *__pyx_n_s_partial;
  PyObject *__pyx_kp_u_passing_a_single_string_into_fro;
  PyObject *__pyx_n_s_path;
  PyObject *__pyx_n_s_path_2;
  PyObject *__pyx_n_u_pcdata;
  PyObject *__pyx_kp_u_pending_open_tags_on_close;
  PyObject *__pyx_n_s_pi;
  PyObject *__pyx_n_u_pi;
  PyObject *__pyx_n_s_pi_factory;
  PyObject *__pyx_n_u_plus;
  PyObject *__pyx_n_s_pop;
  PyObject *__pyx_kp_u_pop_expected_at_most_2_arguments;
  PyObject *__pyx_n_s_position;
  PyObject *__pyx_n_s_preceding;
  PyObject *__pyx_n_s_prefix;
  PyObject *__pyx_kp_u_prefix_2;
  PyObject *__pyx_n_s_prefix_utf;
  PyObject *__pyx_n_s_prepare;
  PyObject *__pyx_n_u_preserve;
  PyObject *__pyx_n_s_pretty_print;
  PyObject *__pyx_n_s_print;
  PyObject *__pyx_n_s_process_children;
  PyObject *__pyx_n_s_profile_run;
  PyObject *__pyx_n_s_property;
  PyObject *__pyx_n_s_public_id;
  PyObject *__pyx_n_b_py;
  PyObject *__pyx_n_s_pyucs4_encoding_name;
  PyObject *__pyx_n_s_pyx_vtable;
  PyObject *__pyx_n_s_qname_aware_attrs;
  PyObject *__pyx_n_s_qname_aware_tags;
  PyObject *__pyx_n_s_qualname;
  PyObject *__pyx_kp_u_quot;
  PyObject *__pyx_n_s_r;
  PyObject *__pyx_n_s_raise_on_error;
  PyObject *__pyx_n_s_range;
  PyObject *__pyx_n_u_rb;
  PyObject *__pyx_n_s_rclose;
  PyObject *__pyx_n_b_rdf;
  PyObject *__pyx_n_s_re;
  PyObject *__pyx_n_s_read;
  PyObject *__pyx_n_u_read;
  PyObject *__pyx_n_s_read_events;
  PyObject *__pyx_n_s_read_file;
  PyObject *__pyx_n_u_read_file;
  PyObject *__pyx_n_s_read_network;
  PyObject *__pyx_n_u_read_network;
  PyObject *__pyx_kp_u_reading_file_objects_must_return;
  PyObject *__pyx_kp_u_reading_from_file_like_objects_m;
  PyObject *__pyx_n_s_receive;
  PyObject *__pyx_n_s_recover;
  PyObject *__pyx_kp_u_reference_to_non_existing_embedd;
  PyObject *__pyx_n_s_regexp;
  PyObject *__pyx_n_s_register;
  PyObject *__pyx_n_s_register_namespace;
  PyObject *__pyx_n_u_register_namespace;
  PyObject *__pyx_n_s_register_namespaces;
  PyObject *__pyx_n_s_registry;
  PyObject *__pyx_n_s_relaxng;
  PyObject *__pyx_n_s_remove;
  PyObject *__pyx_n_s_remove_blank_text;
  PyObject *__pyx_n_s_remove_comments;
  PyObject *__pyx_n_s_remove_pis;
  PyObject *__pyx_n_b_replace;
  PyObject *__pyx_n_s_replace;
  PyObject *__pyx_n_s_replacement;
  PyObject *__pyx_n_u_required;
  PyObject *__pyx_n_s_resolve;
  PyObject *__pyx_n_s_resolve_empty;
  PyObject *__pyx_n_s_resolve_entities;
  PyObject *__pyx_n_s_resolve_external_entities;
  PyObject *__pyx_n_s_resolve_file;
  PyObject *__pyx_n_s_resolve_filename;
  PyObject *__pyx_n_s_resolve_string;
  PyObject *__pyx_n_s_resolver;
  PyObject *__pyx_n_s_resolvers;
  PyObject *__pyx_kp_u_restructuredtext_en;
  PyObject *__pyx_n_s_result;
  PyObject *__pyx_n_s_result_container;
  PyObject *__pyx_n_s_result_doc;
  PyObject *__pyx_n_s_result_list;
  PyObject *__pyx_n_s_result_node;
  PyObject *__pyx_kp_u_result_of_class_lookup_must_be_s;
  PyObject *__pyx_n_s_result_tree;
  PyObject *__pyx_n_s_results;
  PyObject *__pyx_n_s_reversed;
  PyObject *__pyx_n_s_reversed_2;
  PyObject *__pyx_n_s_reversed_nsmap;
  PyObject *__pyx_n_s_rewrite_prefixes;
  PyObject *__pyx_n_s_rexp;
  PyObject *__pyx_n_s_rexpc;
  PyObject *__pyx_kp_u_rnc;
  PyObject *__pyx_n_s_rnc2rng;
  PyObject *__pyx_n_s_rng_str;
  PyObject *__pyx_n_s_root;
  PyObject *__pyx_n_s_rsplit;
  PyObject *__pyx_kp_u_s;
  PyObject *__pyx_kp_u_s_2;
  PyObject *__pyx_kp_u_s_3;
  PyObject *__pyx_n_s_s_4;
  PyObject *__pyx_kp_u_s_href_s_s;
  PyObject *__pyx_n_s_s_match;
  PyObject *__pyx_kp_u_s_r;
  PyObject *__pyx_kp_u_s_w_s_s;
  PyObject *__pyx_n_s_schema;
  PyObject *__pyx_n_b_script;
  PyObject *__pyx_n_s_search;
  PyObject *__pyx_n_s_self;
  PyObject *__pyx_n_s_self_node;
  PyObject *__pyx_n_s_send;
  PyObject *__pyx_n_u_seq;
  PyObject *__pyx_n_s_sequence_or_dict;
  PyObject *__pyx_n_s_set;
  PyObject *__pyx_n_s_set_default_parser;
  PyObject *__pyx_n_u_set_default_parser;
  PyObject *__pyx_n_s_set_element_class_lookup;
  PyObject *__pyx_n_u_set_element_class_lookup;
  PyObject *__pyx_n_s_set_fallback;
  PyObject *__pyx_n_s_set_global_max_depth;
  PyObject *__pyx_n_s_set_name;
  PyObject *__pyx_n_s_setitem;
  PyObject *__pyx_n_s_setroot;
  PyObject *__pyx_n_s_setter;
  PyObject *__pyx_kp_u_setting_default_namespace_is_not;
  PyObject *__pyx_n_s_show;
  PyObject *__pyx_n_s_sio;
  PyObject *__pyx_n_s_skip_subtree;
  PyObject *__pyx_n_s_smart_strings;
  PyObject *__pyx_n_s_sorted;
  PyObject *__pyx_n_s_source;
  PyObject *__pyx_n_s_space;
  PyObject *__pyx_n_s_spec;
  PyObject *__pyx_n_s_split;
  PyObject *__pyx_n_s_splitlines;
  PyObject *__pyx_n_s_src;
  PyObject *__pyx_kp_s_src_lxml_classlookup_pxi;
  PyObject *__pyx_kp_s_src_lxml_cleanup_pxi;
  PyObject *__pyx_kp_s_src_lxml_debug_pxi;
  PyObject *__pyx_kp_s_src_lxml_docloader_pxi;
  PyObject *__pyx_kp_s_src_lxml_dtd_pxi;
  PyObject *__pyx_kp_s_src_lxml_etree_pyx;
  PyObject *__pyx_kp_s_src_lxml_extensions_pxi;
  PyObject *__pyx_kp_s_src_lxml_iterparse_pxi;
  PyObject *__pyx_kp_s_src_lxml_nsclasses_pxi;
  PyObject *__pyx_kp_s_src_lxml_parser_pxi;
  PyObject *__pyx_kp_s_src_lxml_parsertarget_pxi;
  PyObject *__pyx_kp_s_src_lxml_readonlytree_pxi;
  PyObject *__pyx_kp_s_src_lxml_relaxng_pxi;
  PyObject *__pyx_kp_s_src_lxml_saxparser_pxi;
  PyObject *__pyx_kp_s_src_lxml_serializer_pxi;
  PyObject *__pyx_kp_s_src_lxml_xmlerror_pxi;
  PyObject *__pyx_kp_s_src_lxml_xmlid_pxi;
  PyObject *__pyx_kp_s_src_lxml_xpath_pxi;
  PyObject *__pyx_kp_s_src_lxml_xslt_pxi;
  PyObject *__pyx_kp_s_src_lxml_xsltext_pxi;
  PyObject *__pyx_n_s_stacklevel;
  PyObject *__pyx_n_s_standalone;
  PyObject *__pyx_n_s_start;
  PyObject *__pyx_n_u_start;
  PyObject *__pyx_kp_u_start_ns;
  PyObject *__pyx_n_s_start_ns_2;
  PyObject *__pyx_n_s_startswith;
  PyObject *__pyx_n_s_staticmethod;
  PyObject *__pyx_n_s_stdout;
  PyObject *__pyx_n_s_stop;
  PyObject *__pyx_n_s_store_exception;
  PyObject *__pyx_n_s_str1;
  PyObject *__pyx_n_s_str2;
  PyObject *__pyx_n_s_str3;
  PyObject *__pyx_kp_u_string;
  PyObject *__pyx_n_s_string_2;
  PyObject *__pyx_kp_u_string___STRING__XSLT;
  PyObject *__pyx_kp_u_string_id;
  PyObject *__pyx_n_s_strings;
  PyObject *__pyx_n_s_strip;
  PyObject *__pyx_n_s_strip_attributes;
  PyObject *__pyx_n_u_strip_attributes;
  PyObject *__pyx_n_s_strip_cdata;
  PyObject *__pyx_n_s_strip_elements;
  PyObject *__pyx_n_u_strip_elements;
  PyObject *__pyx_n_s_strip_tags;
  PyObject *__pyx_n_u_strip_tags;
  PyObject *__pyx_n_s_strip_text;
  PyObject *__pyx_n_s_strparam;
  PyObject *__pyx_n_s_strval;
  PyObject *__pyx_n_b_style;
  PyObject *__pyx_n_s_style;
  PyObject *__pyx_n_s_sub;
  PyObject *__pyx_n_s_super;
  PyObject *__pyx_n_s_sys;
  PyObject *__pyx_n_s_system_url;
  PyObject *__pyx_n_s_tag;
  PyObject *__pyx_n_s_tag_2;
  PyObject *__pyx_n_s_tag_names;
  PyObject *__pyx_n_s_tags;
  PyObject *__pyx_n_s_tail;
  PyObject *__pyx_n_s_target;
  PyObject *__pyx_n_s_tell;
  PyObject *__pyx_n_u_tell;
  PyObject *__pyx_n_b_test;
  PyObject *__pyx_n_s_test;
  PyObject *__pyx_n_s_test_2;
  PyObject *__pyx_n_s_text;
  PyObject *__pyx_n_u_text;
  PyObject *__pyx_n_s_text_or_uri_or_element;
  PyObject *__pyx_kp_u_text_root;
  PyObject *__pyx_kp_u_this_element_does_not_have_child;
  PyObject *__pyx_n_s_throw;
  PyObject *__pyx_kp_u_to_extended_slice_of_size;
  PyObject *__pyx_n_s_top_nsmap;
  PyObject *__pyx_n_s_tostring;
  PyObject *__pyx_n_u_tostring;
  PyObject *__pyx_n_s_tostringlist;
  PyObject *__pyx_n_u_tostringlist;
  PyObject *__pyx_n_s_tounicode;
  PyObject *__pyx_n_u_tounicode;
  PyObject *__pyx_n_s_translator;
  PyObject *__pyx_n_s_tree;
  PyObject *__pyx_n_s_tree_or_element;
  PyObject *__pyx_n_s_type;
  PyObject *__pyx_kp_u_type_2;
  PyObject *__pyx_kp_u_type_3;
  PyObject *__pyx_n_s_type_name;
  PyObject *__pyx_n_s_types;
  PyObject *__pyx_kp_u_undecodable_error_message;
  PyObject *__pyx_n_u_undefined;
  PyObject *__pyx_n_u_unicode;
  PyObject *__pyx_n_u_unknown;
  PyObject *__pyx_kp_u_unknown_encoding;
  PyObject *__pyx_kp_u_unknown_error;
  PyObject *__pyx_kp_u_unknown_error_2;
  PyObject *__pyx_kp_u_unknown_output_method;
  PyObject *__pyx_kp_u_unsupported_XSLT_result_type;
  PyObject *__pyx_kp_u_unsupported_element_type_for_top;
  PyObject *__pyx_n_s_update;
  PyObject *__pyx_n_s_upper;
  PyObject *__pyx_n_s_uri;
  PyObject *__pyx_n_s_uri_utf;
  PyObject *__pyx_n_s_url;
  PyObject *__pyx_n_s_use_global_python_log;
  PyObject *__pyx_n_u_use_global_python_log;
  PyObject *__pyx_n_u_utf8;
  PyObject *__pyx_kp_u_utf_8;
  PyObject *__pyx_n_s_v;
  PyObject *__pyx_n_s_validate;
  PyObject *__pyx_n_s_value;
  PyObject *__pyx_n_s_values;
  PyObject *__pyx_n_s_variables;
  PyObject *__pyx_n_s_variables_2;
  PyObject *__pyx_n_s_version;
  PyObject *__pyx_n_s_version_2;
  PyObject *__pyx_n_u_w;
  PyObject *__pyx_kp_u_w_w;
  PyObject *__pyx_n_s_warn;
  PyObject *__pyx_n_s_warnings;
  PyObject *__pyx_n_u_wb;
  PyObject *__pyx_n_s_with_comments;
  PyObject *__pyx_n_s_with_prefixes;
  PyObject *__pyx_n_s_with_tail;
  PyObject *__pyx_n_s_write;
  PyObject *__pyx_n_u_write;
  PyObject *__pyx_n_s_write_c14n;
  PyObject *__pyx_n_s_write_declaration;
  PyObject *__pyx_n_s_write_doctype;
  PyObject *__pyx_n_s_write_file;
  PyObject *__pyx_n_u_write_file;
  PyObject *__pyx_n_s_write_network;
  PyObject *__pyx_n_u_write_network;
  PyObject *__pyx_n_s_write_output;
  PyObject *__pyx_n_s_writer;
  PyObject *__pyx_n_b_wsdl;
  PyObject *__pyx_n_u_x;
  PyObject *__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9;
  PyObject *__pyx_kp_u_x9;
  PyObject *__pyx_kp_u_xA;
  PyObject *__pyx_kp_u_xD;
  PyObject *__pyx_n_s_xinclude;
  PyObject *__pyx_n_b_xml;
  PyObject *__pyx_n_s_xml;
  PyObject *__pyx_n_u_xml;
  PyObject *__pyx_n_s_xml_data;
  PyObject *__pyx_n_s_xml_declaration;
  PyObject *__pyx_kp_u_xml_s_encoding_s_s_s;
  PyObject *__pyx_kp_u_xml_xml;
  PyObject *__pyx_n_s_xmlfile;
  PyObject *__pyx_n_s_xmlfile___aenter;
  PyObject *__pyx_n_s_xmlfile___aexit;
  PyObject *__pyx_n_s_xmlfile___enter;
  PyObject *__pyx_n_s_xmlfile___exit;
  PyObject *__pyx_kp_u_xmlns;
  PyObject *__pyx_n_b_xmlns_2;
  PyObject *__pyx_n_u_xmlns_2;
  PyObject *__pyx_n_s_xmlschema;
  PyObject *__pyx_n_s_xpath;
  PyObject *__pyx_n_s_xpath_name;
  PyObject *__pyx_n_s_xrange;
  PyObject *__pyx_n_b_xs;
  PyObject *__pyx_n_u_xs;
  PyObject *__pyx_n_b_xsi;
  PyObject *__pyx_n_b_xsl;
  PyObject *__pyx_n_u_xsl;
  PyObject *__pyx_kp_u_xsl_stylesheet_xml_id_id;
  PyObject *__pyx_n_s_xslt;
  PyObject *__pyx_kp_u_xslt_2;
  PyObject *__pyx_n_s_xslt_3;
  PyObject *__pyx_n_s_xslt_input;
  PyObject *__pyx_n_s_zf;
  PyObject *__pyx_int_0;
  PyObject *__pyx_int_1;
  PyObject *__pyx_int_2;
  PyObject *__pyx_int_3;
  PyObject *__pyx_int_4;
  PyObject *__pyx_int_5;
  PyObject *__pyx_int_100;
  PyObject *__pyx_int_32768;
  PyObject *__pyx_int_neg_1;
  PyObject *__pyx_int_neg_4;
  PyObject *__pyx_int_neg_100;
  PyObject *__pyx_int_neg_200;
  PyObject *__pyx_int_neg_300;
  PyObject *__pyx_tuple_;
  PyObject *__pyx_slice__6;
  PyObject *__pyx_slice__7;
  PyObject *__pyx_slice__8;
  PyObject *__pyx_slice__9;
  PyObject *__pyx_tuple__2;
  PyObject *__pyx_tuple__5;
  PyObject *__pyx_slice__44;
  PyObject *__pyx_slice__55;
  PyObject *__pyx_slice__69;
  PyObject *__pyx_slice__80;
  PyObject *__pyx_slice__81;
  PyObject *__pyx_slice__93;
  PyObject *__pyx_slice__94;
  PyObject *__pyx_tuple__10;
  PyObject *__pyx_tuple__13;
  PyObject *__pyx_tuple__14;
  PyObject *__pyx_tuple__15;
  PyObject *__pyx_tuple__16;
  PyObject *__pyx_tuple__23;
  PyObject *__pyx_tuple__27;
  PyObject *__pyx_tuple__31;
  PyObject *__pyx_tuple__36;
  PyObject *__pyx_tuple__37;
  PyObject *__pyx_tuple__38;
  PyObject *__pyx_tuple__39;
  PyObject *__pyx_tuple__40;
  PyObject *__pyx_tuple__46;
  PyObject *__pyx_tuple__47;
  PyObject *__pyx_tuple__49;
  PyObject *__pyx_tuple__51;
  PyObject *__pyx_tuple__53;
  PyObject *__pyx_tuple__54;
  PyObject *__pyx_tuple__58;
  PyObject *__pyx_tuple__59;
  PyObject *__pyx_tuple__60;
  PyObject *__pyx_tuple__64;
  PyObject *__pyx_tuple__65;
  PyObject *__pyx_tuple__66;
  PyObject *__pyx_tuple__68;
  PyObject *__pyx_tuple__70;
  PyObject *__pyx_tuple__77;
  PyObject *__pyx_tuple__78;
  PyObject *__pyx_tuple__91;
  PyObject *__pyx_tuple__92;
  PyObject *__pyx_tuple__97;
  PyObject *__pyx_tuple__98;
  PyObject *__pyx_slice__105;
  PyObject *__pyx_tuple__103;
  PyObject *__pyx_tuple__104;
  PyObject *__pyx_tuple__107;
  PyObject *__pyx_tuple__109;
  PyObject *__pyx_tuple__113;
  PyObject *__pyx_tuple__116;
  PyObject *__pyx_tuple__117;
  PyObject *__pyx_tuple__118;
  PyObject *__pyx_tuple__120;
  PyObject *__pyx_tuple__123;
  PyObject *__pyx_tuple__126;
  PyObject *__pyx_tuple__128;
  PyObject *__pyx_tuple__130;
  PyObject *__pyx_tuple__132;
  PyObject *__pyx_tuple__137;
  PyObject *__pyx_tuple__145;
  PyObject *__pyx_tuple__147;
  PyObject *__pyx_tuple__149;
  PyObject *__pyx_tuple__151;
  PyObject *__pyx_tuple__152;
  PyObject *__pyx_tuple__153;
  PyObject *__pyx_tuple__154;
  PyObject *__pyx_tuple__155;
  PyObject *__pyx_tuple__156;
  PyObject *__pyx_tuple__157;
  PyObject *__pyx_tuple__158;
  PyObject *__pyx_tuple__159;
  PyObject *__pyx_tuple__160;
  PyObject *__pyx_tuple__163;
  PyObject *__pyx_tuple__165;
  PyObject *__pyx_tuple__168;
  PyObject *__pyx_tuple__172;
  PyObject *__pyx_tuple__174;
  PyObject *__pyx_tuple__176;
  PyObject *__pyx_tuple__177;
  PyObject *__pyx_tuple__179;
  PyObject *__pyx_tuple__181;
  PyObject *__pyx_tuple__184;
  PyObject *__pyx_tuple__186;
  PyObject *__pyx_tuple__187;
  PyObject *__pyx_tuple__189;
  PyObject *__pyx_tuple__194;
  PyObject *__pyx_tuple__198;
  PyObject *__pyx_tuple__200;
  PyObject *__pyx_tuple__203;
  PyObject *__pyx_tuple__208;
  PyObject *__pyx_tuple__210;
  PyObject *__pyx_tuple__212;
  PyObject *__pyx_tuple__214;
  PyObject *__pyx_tuple__218;
  PyObject *__pyx_tuple__220;
  PyObject *__pyx_tuple__223;
  PyObject *__pyx_tuple__225;
  PyObject *__pyx_tuple__232;
  PyObject *__pyx_tuple__234;
  PyObject *__pyx_tuple__238;
  PyObject *__pyx_tuple__240;
  PyObject *__pyx_tuple__242;
  PyObject *__pyx_tuple__244;
  PyObject *__pyx_tuple__246;
  PyObject *__pyx_tuple__249;
  PyObject *__pyx_tuple__251;
  PyObject *__pyx_tuple__256;
  PyObject *__pyx_tuple__258;
  PyObject *__pyx_tuple__260;
  PyObject *__pyx_tuple__263;
  PyObject *__pyx_tuple__265;
  PyObject *__pyx_tuple__267;
  PyObject *__pyx_tuple__269;
  PyObject *__pyx_tuple__281;
  PyObject *__pyx_tuple__283;
  PyObject *__pyx_tuple__285;
  PyObject *__pyx_tuple__287;
  PyObject *__pyx_tuple__289;
  PyObject *__pyx_tuple__291;
  PyObject *__pyx_tuple__293;
  PyObject *__pyx_tuple__297;
  PyObject *__pyx_tuple__299;
  PyObject *__pyx_tuple__301;
  PyObject *__pyx_tuple__303;
  PyObject *__pyx_tuple__304;
  PyObject *__pyx_tuple__306;
  PyObject *__pyx_tuple__308;
  PyObject *__pyx_tuple__310;
  PyObject *__pyx_tuple__312;
  PyObject *__pyx_tuple__314;
  PyObject *__pyx_tuple__318;
  PyObject *__pyx_tuple__321;
  PyObject *__pyx_tuple__329;
  PyObject *__pyx_tuple__334;
  PyObject *__pyx_tuple__336;
  PyObject *__pyx_tuple__338;
  PyObject *__pyx_tuple__340;
  PyObject *__pyx_tuple__342;
  PyObject *__pyx_tuple__347;
  PyObject *__pyx_tuple__349;
  PyObject *__pyx_tuple__351;
  PyObject *__pyx_tuple__353;
  PyObject *__pyx_tuple__355;
  PyObject *__pyx_tuple__357;
  PyObject *__pyx_tuple__359;
  PyObject *__pyx_tuple__361;
  PyObject *__pyx_tuple__363;
  PyObject *__pyx_tuple__367;
  PyObject *__pyx_tuple__369;
  PyObject *__pyx_tuple__372;
  PyObject *__pyx_tuple__377;
  PyObject *__pyx_tuple__381;
  PyObject *__pyx_tuple__385;
  PyObject *__pyx_tuple__389;
  PyObject *__pyx_tuple__391;
  PyObject *__pyx_tuple__393;
  PyObject *__pyx_tuple__395;
  PyObject *__pyx_tuple__397;
  PyObject *__pyx_tuple__399;
  PyObject *__pyx_tuple__400;
  PyObject *__pyx_tuple__401;
  PyObject *__pyx_tuple__403;
  PyObject *__pyx_tuple__405;
  PyObject *__pyx_tuple__407;
  PyObject *__pyx_tuple__409;
  PyObject *__pyx_tuple__411;
  PyObject *__pyx_tuple__416;
  PyObject *__pyx_tuple__418;
  PyObject *__pyx_tuple__420;
  PyObject *__pyx_tuple__422;
  PyObject *__pyx_tuple__424;
  PyObject *__pyx_tuple__426;
  PyObject *__pyx_tuple__431;
  PyObject *__pyx_tuple__432;
  PyObject *__pyx_tuple__433;
  PyObject *__pyx_tuple__434;
  PyObject *__pyx_tuple__436;
  PyObject *__pyx_tuple__438;
  PyObject *__pyx_tuple__439;
  PyObject *__pyx_tuple__441;
  PyObject *__pyx_tuple__448;
  PyObject *__pyx_tuple__450;
  PyObject *__pyx_tuple__452;
  PyObject *__pyx_tuple__455;
  PyObject *__pyx_tuple__462;
  PyObject *__pyx_tuple__465;
  PyObject *__pyx_tuple__467;
  PyObject *__pyx_tuple__469;
  PyObject *__pyx_tuple__471;
  PyObject *__pyx_tuple__473;
  PyObject *__pyx_tuple__474;
  PyObject *__pyx_tuple__476;
  PyObject *__pyx_tuple__478;
  PyObject *__pyx_tuple__479;
  PyObject *__pyx_tuple__481;
  PyObject *__pyx_tuple__485;
  PyObject *__pyx_tuple__487;
  PyObject *__pyx_tuple__490;
  PyObject *__pyx_tuple__492;
  PyObject *__pyx_tuple__493;
  PyObject *__pyx_tuple__495;
  PyObject *__pyx_tuple__497;
  PyObject *__pyx_tuple__501;
  PyObject *__pyx_tuple__503;
  PyObject *__pyx_tuple__504;
  PyObject *__pyx_tuple__506;
  PyObject *__pyx_tuple__508;
  PyObject *__pyx_tuple__510;
  PyObject *__pyx_tuple__512;
  PyObject *__pyx_tuple__514;
  PyObject *__pyx_tuple__518;
  PyObject *__pyx_tuple__522;
  PyObject *__pyx_tuple__526;
  PyObject *__pyx_tuple__528;
  PyObject *__pyx_tuple__531;
  PyObject *__pyx_tuple__533;
  PyObject *__pyx_tuple__535;
  PyObject *__pyx_codeobj__62;
  PyObject *__pyx_codeobj__67;
  PyObject *__pyx_codeobj__76;
  PyObject *__pyx_codeobj__79;
  PyObject *__pyx_codeobj__82;
  PyObject *__pyx_codeobj__83;
  PyObject *__pyx_codeobj__84;
  PyObject *__pyx_codeobj__85;
  PyObject *__pyx_codeobj__86;
  PyObject *__pyx_codeobj__87;
  PyObject *__pyx_codeobj__88;
  PyObject *__pyx_codeobj__89;
  PyObject *__pyx_codeobj__90;
  PyObject *__pyx_codeobj__99;
  PyObject *__pyx_codeobj__100;
  PyObject *__pyx_codeobj__101;
  PyObject *__pyx_codeobj__102;
  PyObject *__pyx_codeobj__108;
  PyObject *__pyx_codeobj__110;
  PyObject *__pyx_codeobj__111;
  PyObject *__pyx_codeobj__112;
  PyObject *__pyx_codeobj__114;
  PyObject *__pyx_codeobj__115;
  PyObject *__pyx_codeobj__119;
  PyObject *__pyx_codeobj__121;
  PyObject *__pyx_codeobj__122;
  PyObject *__pyx_codeobj__124;
  PyObject *__pyx_codeobj__125;
  PyObject *__pyx_codeobj__127;
  PyObject *__pyx_codeobj__129;
  PyObject *__pyx_codeobj__131;
  PyObject *__pyx_codeobj__133;
  PyObject *__pyx_codeobj__134;
  PyObject *__pyx_codeobj__135;
  PyObject *__pyx_codeobj__136;
  PyObject *__pyx_codeobj__138;
  PyObject *__pyx_codeobj__139;
  PyObject *__pyx_codeobj__140;
  PyObject *__pyx_codeobj__141;
  PyObject *__pyx_codeobj__142;
  PyObject *__pyx_codeobj__143;
  PyObject *__pyx_codeobj__144;
  PyObject *__pyx_codeobj__146;
  PyObject *__pyx_codeobj__148;
  PyObject *__pyx_codeobj__150;
  PyObject *__pyx_codeobj__161;
  PyObject *__pyx_codeobj__162;
  PyObject *__pyx_codeobj__164;
  PyObject *__pyx_codeobj__166;
  PyObject *__pyx_codeobj__167;
  PyObject *__pyx_codeobj__169;
  PyObject *__pyx_codeobj__170;
  PyObject *__pyx_codeobj__171;
  PyObject *__pyx_codeobj__173;
  PyObject *__pyx_codeobj__175;
  PyObject *__pyx_codeobj__178;
  PyObject *__pyx_codeobj__180;
  PyObject *__pyx_codeobj__182;
  PyObject *__pyx_codeobj__183;
  PyObject *__pyx_codeobj__185;
  PyObject *__pyx_codeobj__188;
  PyObject *__pyx_codeobj__190;
  PyObject *__pyx_codeobj__191;
  PyObject *__pyx_codeobj__192;
  PyObject *__pyx_codeobj__193;
  PyObject *__pyx_codeobj__195;
  PyObject *__pyx_codeobj__196;
  PyObject *__pyx_codeobj__197;
  PyObject *__pyx_codeobj__199;
  PyObject *__pyx_codeobj__201;
  PyObject *__pyx_codeobj__202;
  PyObject *__pyx_codeobj__204;
  PyObject *__pyx_codeobj__205;
  PyObject *__pyx_codeobj__206;
  PyObject *__pyx_codeobj__207;
  PyObject *__pyx_codeobj__209;
  PyObject *__pyx_codeobj__211;
  PyObject *__pyx_codeobj__213;
  PyObject *__pyx_codeobj__215;
  PyObject *__pyx_codeobj__216;
  PyObject *__pyx_codeobj__217;
  PyObject *__pyx_codeobj__219;
  PyObject *__pyx_codeobj__221;
  PyObject *__pyx_codeobj__222;
  PyObject *__pyx_codeobj__224;
  PyObject *__pyx_codeobj__226;
  PyObject *__pyx_codeobj__227;
  PyObject *__pyx_codeobj__228;
  PyObject *__pyx_codeobj__229;
  PyObject *__pyx_codeobj__230;
  PyObject *__pyx_codeobj__231;
  PyObject *__pyx_codeobj__233;
  PyObject *__pyx_codeobj__235;
  PyObject *__pyx_codeobj__236;
  PyObject *__pyx_codeobj__237;
  PyObject *__pyx_codeobj__239;
  PyObject *__pyx_codeobj__241;
  PyObject *__pyx_codeobj__243;
  PyObject *__pyx_codeobj__245;
  PyObject *__pyx_codeobj__247;
  PyObject *__pyx_codeobj__248;
  PyObject *__pyx_codeobj__250;
  PyObject *__pyx_codeobj__252;
  PyObject *__pyx_codeobj__253;
  PyObject *__pyx_codeobj__254;
  PyObject *__pyx_codeobj__255;
  PyObject *__pyx_codeobj__257;
  PyObject *__pyx_codeobj__259;
  PyObject *__pyx_codeobj__261;
  PyObject *__pyx_codeobj__262;
  PyObject *__pyx_codeobj__264;
  PyObject *__pyx_codeobj__266;
  PyObject *__pyx_codeobj__268;
  PyObject *__pyx_codeobj__270;
  PyObject *__pyx_codeobj__271;
  PyObject *__pyx_codeobj__272;
  PyObject *__pyx_codeobj__273;
  PyObject *__pyx_codeobj__274;
  PyObject *__pyx_codeobj__275;
  PyObject *__pyx_codeobj__276;
  PyObject *__pyx_codeobj__277;
  PyObject *__pyx_codeobj__278;
  PyObject *__pyx_codeobj__279;
  PyObject *__pyx_codeobj__280;
  PyObject *__pyx_codeobj__282;
  PyObject *__pyx_codeobj__284;
  PyObject *__pyx_codeobj__286;
  PyObject *__pyx_codeobj__288;
  PyObject *__pyx_codeobj__290;
  PyObject *__pyx_codeobj__292;
  PyObject *__pyx_codeobj__294;
  PyObject *__pyx_codeobj__295;
  PyObject *__pyx_codeobj__296;
  PyObject *__pyx_codeobj__298;
  PyObject *__pyx_codeobj__300;
  PyObject *__pyx_codeobj__302;
  PyObject *__pyx_codeobj__305;
  PyObject *__pyx_codeobj__307;
  PyObject *__pyx_codeobj__309;
  PyObject *__pyx_codeobj__311;
  PyObject *__pyx_codeobj__313;
  PyObject *__pyx_codeobj__315;
  PyObject *__pyx_codeobj__316;
  PyObject *__pyx_codeobj__317;
  PyObject *__pyx_codeobj__319;
  PyObject *__pyx_codeobj__320;
  PyObject *__pyx_codeobj__322;
  PyObject *__pyx_codeobj__323;
  PyObject *__pyx_codeobj__324;
  PyObject *__pyx_codeobj__325;
  PyObject *__pyx_codeobj__326;
  PyObject *__pyx_codeobj__327;
  PyObject *__pyx_codeobj__328;
  PyObject *__pyx_codeobj__330;
  PyObject *__pyx_codeobj__331;
  PyObject *__pyx_codeobj__332;
  PyObject *__pyx_codeobj__333;
  PyObject *__pyx_codeobj__335;
  PyObject *__pyx_codeobj__337;
  PyObject *__pyx_codeobj__339;
  PyObject *__pyx_codeobj__341;
  PyObject *__pyx_codeobj__343;
  PyObject *__pyx_codeobj__344;
  PyObject *__pyx_codeobj__345;
  PyObject *__pyx_codeobj__346;
  PyObject *__pyx_codeobj__348;
  PyObject *__pyx_codeobj__350;
  PyObject *__pyx_codeobj__352;
  PyObject *__pyx_codeobj__354;
  PyObject *__pyx_codeobj__356;
  PyObject *__pyx_codeobj__358;
  PyObject *__pyx_codeobj__360;
  PyObject *__pyx_codeobj__362;
  PyObject *__pyx_codeobj__364;
  PyObject *__pyx_codeobj__365;
  PyObject *__pyx_codeobj__366;
  PyObject *__pyx_codeobj__368;
  PyObject *__pyx_codeobj__370;
  PyObject *__pyx_codeobj__371;
  PyObject *__pyx_codeobj__373;
  PyObject *__pyx_codeobj__374;
  PyObject *__pyx_codeobj__375;
  PyObject *__pyx_codeobj__376;
  PyObject *__pyx_codeobj__378;
  PyObject *__pyx_codeobj__379;
  PyObject *__pyx_codeobj__380;
  PyObject *__pyx_codeobj__382;
  PyObject *__pyx_codeobj__383;
  PyObject *__pyx_codeobj__384;
  PyObject *__pyx_codeobj__386;
  PyObject *__pyx_codeobj__387;
  PyObject *__pyx_codeobj__388;
  PyObject *__pyx_codeobj__390;
  PyObject *__pyx_codeobj__392;
  PyObject *__pyx_codeobj__394;
  PyObject *__pyx_codeobj__396;
  PyObject *__pyx_codeobj__398;
  PyObject *__pyx_codeobj__402;
  PyObject *__pyx_codeobj__404;
  PyObject *__pyx_codeobj__406;
  PyObject *__pyx_codeobj__408;
  PyObject *__pyx_codeobj__410;
  PyObject *__pyx_codeobj__412;
  PyObject *__pyx_codeobj__413;
  PyObject *__pyx_codeobj__414;
  PyObject *__pyx_codeobj__415;
  PyObject *__pyx_codeobj__417;
  PyObject *__pyx_codeobj__419;
  PyObject *__pyx_codeobj__421;
  PyObject *__pyx_codeobj__423;
  PyObject *__pyx_codeobj__425;
  PyObject *__pyx_codeobj__427;
  PyObject *__pyx_codeobj__428;
  PyObject *__pyx_codeobj__429;
  PyObject *__pyx_codeobj__430;
  PyObject *__pyx_codeobj__435;
  PyObject *__pyx_codeobj__437;
  PyObject *__pyx_codeobj__440;
  PyObject *__pyx_codeobj__442;
  PyObject *__pyx_codeobj__443;
  PyObject *__pyx_codeobj__444;
  PyObject *__pyx_codeobj__445;
  PyObject *__pyx_codeobj__446;
  PyObject *__pyx_codeobj__447;
  PyObject *__pyx_codeobj__449;
  PyObject *__pyx_codeobj__451;
  PyObject *__pyx_codeobj__453;
  PyObject *__pyx_codeobj__454;
  PyObject *__pyx_codeobj__456;
  PyObject *__pyx_codeobj__457;
  PyObject *__pyx_codeobj__458;
  PyObject *__pyx_codeobj__459;
  PyObject *__pyx_codeobj__460;
  PyObject *__pyx_codeobj__461;
  PyObject *__pyx_codeobj__463;
  PyObject *__pyx_codeobj__464;
  PyObject *__pyx_codeobj__466;
  PyObject *__pyx_codeobj__468;
  PyObject *__pyx_codeobj__470;
  PyObject *__pyx_codeobj__472;
  PyObject *__pyx_codeobj__475;
  PyObject *__pyx_codeobj__477;
  PyObject *__pyx_codeobj__480;
  PyObject *__pyx_codeobj__482;
  PyObject *__pyx_codeobj__483;
  PyObject *__pyx_codeobj__484;
  PyObject *__pyx_codeobj__486;
  PyObject *__pyx_codeobj__488;
  PyObject *__pyx_codeobj__494;
  PyObject *__pyx_codeobj__496;
  PyObject *__pyx_codeobj__498;
  PyObject *__pyx_codeobj__499;
  PyObject *__pyx_codeobj__500;
  PyObject *__pyx_codeobj__502;
  PyObject *__pyx_codeobj__505;
  PyObject *__pyx_codeobj__507;
  PyObject *__pyx_codeobj__509;
  PyObject *__pyx_codeobj__511;
  PyObject *__pyx_codeobj__513;
  PyObject *__pyx_codeobj__515;
  PyObject *__pyx_codeobj__516;
  PyObject *__pyx_codeobj__517;
  PyObject *__pyx_codeobj__519;
  PyObject *__pyx_codeobj__520;
  PyObject *__pyx_codeobj__521;
  PyObject *__pyx_codeobj__523;
  PyObject *__pyx_codeobj__524;
  PyObject *__pyx_codeobj__525;
  PyObject *__pyx_codeobj__527;
  PyObject *__pyx_codeobj__529;
  PyObject *__pyx_codeobj__530;
  PyObject *__pyx_codeobj__532;
  PyObject *__pyx_codeobj__534;
  PyObject *__pyx_codeobj__536;
} __pyx_mstate;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
  extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))

#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))

#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
#else
static __pyx_mstate __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static int __pyx_m_clear(PyObject *m) {
  __pyx_mstate *clear_module_state = __pyx_mstate(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #ifdef __Pyx_CyFunction_USED
  Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Error);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Error);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_C14NError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_C14NError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__TempStore);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__TempStore);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ExceptionContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ExceptionContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__LogEntry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__LogEntry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ListErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ListErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ErrorLogContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ErrorLogContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DomainErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DomainErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__RotatingErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__RotatingErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Document);
  Py_CLEAR(clear_module_state->LxmlDocumentType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DocInfo);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DocInfo);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Element);
  Py_CLEAR(clear_module_state->LxmlElementType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___ContentOnlyElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___ContentOnlyElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Comment);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Comment);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Entity);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Entity);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_QName);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_QName);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementTree);
  Py_CLEAR(clear_module_state->LxmlElementTreeType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Attrib);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Attrib);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AttribIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AttribIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementTagMatcher);
  Py_CLEAR(clear_module_state->LxmlElementTagMatcherType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementIterator);
  Py_CLEAR(clear_module_state->LxmlElementIteratorType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MultiTagMatcher);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MultiTagMatcher);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementMatchIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ElementMatchIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementChildIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementChildIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SiblingsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SiblingsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_AncestorsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_AncestorsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementDepthFirstIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementTextIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementTextIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CDATA);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CDATA);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ReadOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__OpaqueNodeWrapper);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__OpaqueDocumentWrapper);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AppendOnlyElementProxy);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementBase);
  Py_CLEAR(clear_module_state->LxmlElementBaseType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PIBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PIBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementClassLookup);
  Py_CLEAR(clear_module_state->LxmlElementClassLookupType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  Py_CLEAR(clear_module_state->LxmlFallbackElementClassLookupType);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__NamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__NamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ClassNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__InputDocument);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__InputDocument);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Resolver);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Resolver);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ResolverRegistry);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ResolverRegistry);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ResolverContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ResolverContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ParserError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ParserError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserDictionaryContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserDictionaryContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FileReaderContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FileReaderContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FeedParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FeedParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_HTMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_HTMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__SaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__SaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__SaxParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__SaxParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParseEventsIterator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParseEventsIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__PythonSaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__TargetParserContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__TargetParserContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FilelikeWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FilelikeWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_xmlfile);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_xmlfile);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_htmlfile);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_htmlfile);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__IncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__IncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncDataWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncDataWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__AsyncFileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__FileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__FileWriterElement);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MethodChanger);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MethodChanger);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_iterparse);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_iterparse);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__IDDict);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__IDDict);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XInclude);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XInclude);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ExsltRegExp);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ExsltRegExp);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__BaseContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__BaseContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ElementUnicodeResult);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ElementUnicodeResult);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XPathEvaluatorBase);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathElementEvaluator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XPath);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XPath);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTResolverContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTResolverContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTQuotedStringParam);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLT);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLT);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTResultTree);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTResultTree);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__XSLTProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__Validator);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__Validator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDElementContentDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDElementContentDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDAttributeDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDAttributeDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDElementDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDElementDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__DTDEntityDecl);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__DTDEntityDecl);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_DTD);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_DTD);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__ParserSchemaValidationContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree_Schematron);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree_Schematron);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree__MemDebug);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree__MemDebug);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_7_write);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_8__close);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_CLEAR(clear_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_CLEAR(clear_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_CLEAR(clear_module_state->__pyx_kp_u_0_9);
  Py_CLEAR(clear_module_state->__pyx_kp_u_1);
  Py_CLEAR(clear_module_state->__pyx_kp_b_25);
  Py_CLEAR(clear_module_state->__pyx_n_b_A);
  Py_CLEAR(clear_module_state->__pyx_n_b_ASCII);
  Py_CLEAR(clear_module_state->__pyx_n_u_ASCII);
  Py_CLEAR(clear_module_state->__pyx_kp_u_All_strings_must_be_XML_compatib);
  Py_CLEAR(clear_module_state->__pyx_kp_s_An_XMLSyntaxError_that_addition);
  Py_CLEAR(clear_module_state->__pyx_n_s_AncestorsIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_AppendOnlyElementProxy_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_AppendOnlyElementProxy_extend);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Argument_is_not_a_file_like_obje);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Argument_must_be_bytes_or_unicod);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Argument_must_be_string_or_unico);
  Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncDataWriter_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncDataWriter_write);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncFileWriterElement___aenter);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncFileWriterElement___aexit);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter__clo);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_elem);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_flus);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_meth);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib___copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib___deepcopy);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_has_key);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_Attrib_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_AttributeBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError);
  Py_CLEAR(clear_module_state->__pyx_n_u_BE);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseErrorLog_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseErrorLog_receive);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseException);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseParser_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseParser_makeelement);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseParser_set_element_class_lo);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Base_class_for_all_syntax_errors);
  Py_CLEAR(clear_module_state->__pyx_n_s_BytesIO);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NError);
  Py_CLEAR(clear_module_state->__pyx_n_u_C14NError);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_n_u_C14NWriterTarget);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget__iter_namespace);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget__start_locals_l);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_comment);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_data);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_end);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_pi);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_start);
  Py_CLEAR(clear_module_state->__pyx_n_s_C14NWriterTarget_start_ns);
  Py_CLEAR(clear_module_state->__pyx_kp_u_C14N_failed);
  Py_CLEAR(clear_module_state->__pyx_n_s_CDATA);
  Py_CLEAR(clear_module_state->__pyx_n_u_CDATA);
  Py_CLEAR(clear_module_state->__pyx_n_s_CRITICAL);
  Py_CLEAR(clear_module_state->__pyx_n_s_CSSSelector);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Can_only_discard_comments_in_C14);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Can_only_strip_text_in_C14N_2_0);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_asynchronously_write_to_a);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_change_the_xml_prefix_of);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_enable_XML_declaration_in);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_parse_stylesheet);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_resolve_URI);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_specify_encoding_with_C14);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Char_out_of_XML_range);
  Py_CLEAR(clear_module_state->__pyx_n_s_Comment);
  Py_CLEAR(clear_module_state->__pyx_n_u_Comment);
  Py_CLEAR(clear_module_state->__pyx_n_s_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_n_u_CommentBase);
  Py_CLEAR(clear_module_state->__pyx_n_s_Comment_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Comment_may_not_contain_or_end_w);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_insert);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_set);
  Py_CLEAR(clear_module_state->__pyx_n_s_ContentOnlyElement_values);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Could_not_create_I_O_writer_cont);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Could_not_find_root_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_CustomElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_CustomElementClassLookup_lookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_DEBUG);
  Py_CLEAR(clear_module_state->__pyx_n_u_DEBUG);
  Py_CLEAR(clear_module_state->__pyx_n_s_DENY_ALL);
  Py_CLEAR(clear_module_state->__pyx_n_s_DENY_WRITE);
  Py_CLEAR(clear_module_state->__pyx_kp_u_DOCTYPE);
  Py_CLEAR(clear_module_state->__pyx_kp_u_DOCTYPE_already_written_or_canno);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTD);
  Py_CLEAR(clear_module_state->__pyx_n_u_DTD);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDAttributeDecl_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDAttributeDecl_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDElementDecl_attributes);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDElementDecl_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDError);
  Py_CLEAR(clear_module_state->__pyx_n_u_DTDError);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_DTDParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_u_DTDValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTD_elements);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTD_entities);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTD_iterelements);
  Py_CLEAR(clear_module_state->__pyx_n_s_DTD_iterentities);
  Py_CLEAR(clear_module_state->__pyx_kp_u_DTD_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_n_s_DeprecationWarning);
  Py_CLEAR(clear_module_state->__pyx_n_s_DocInfo);
  Py_CLEAR(clear_module_state->__pyx_n_s_DocInfo_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_Document);
  Py_CLEAR(clear_module_state->__pyx_n_s_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_n_u_DocumentInvalid);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_does_not_comply_with_sc);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_is_not_a_valid_Schematr);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_is_not_parsable_as_Rela);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_is_not_valid_Relax_NG);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_is_not_valid_XML_Schema);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Document_is_not_well_formed);
  Py_CLEAR(clear_module_state->__pyx_n_s_DomainErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_DomainErrorLog_receive);
  Py_CLEAR(clear_module_state->__pyx_n_s_ERROR);
  Py_CLEAR(clear_module_state->__pyx_n_s_ERR_INVALID_CHAR);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  Py_CLEAR(clear_module_state->__pyx_n_s_ERR_UNDECLARED_ENTITY);
  Py_CLEAR(clear_module_state->__pyx_n_s_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_u_ETCompatXMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_n_u_ETXPath);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Either_xml_data_or_from_file_mus);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Element);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementBase);
  Py_CLEAR(clear_module_state->__pyx_n_u_ElementBase);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementChildIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_ElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_ElementDefaultClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementDepthFirstIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementMatchIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_ElementNamespaceClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementNamespaceClassLookup_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTagMatcher);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTextIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree);
  Py_CLEAR(clear_module_state->__pyx_n_u_ElementTree);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree___copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree___deepcopy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree__setroot);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_find);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_findall);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_findtext);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_getelementpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_getiterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_getpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_getroot);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_iterfind);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ElementTree_not_initialized_miss);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_parse);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_relaxng);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_write);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_write_c14n);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_xinclude);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_xmlschema);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_xpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementTree_xslt);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementUnicodeResult);
  Py_CLEAR(clear_module_state->__pyx_n_s_ElementUnicodeResult_getparent);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_Element_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element___copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element___deepcopy);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element___reversed);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element__init);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_addnext);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_addprevious);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_cssselect);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_extend);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_find);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_findall);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_findtext);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getiterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getnext);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getparent);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getprevious);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_getroottree);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_index);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_insert);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Element_is_not_a_child_of_this_n);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Element_is_not_in_this_tree);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Element_is_not_in_this_tree_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_iterancestors);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_iterchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_iterdescendants);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_iterfind);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_itersiblings);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_itertext);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_makeelement);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_remove);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_replace);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_set);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_Element_xpath);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Empty_tag_name);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Encoding_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_Entity);
  Py_CLEAR(clear_module_state->__pyx_n_u_Entity);
  Py_CLEAR(clear_module_state->__pyx_n_s_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_n_u_EntityBase);
  Py_CLEAR(clear_module_state->__pyx_n_s_Entity_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Entity_class_must_be_subclass_of);
  Py_CLEAR(clear_module_state->__pyx_n_s_Error);
  Py_CLEAR(clear_module_state->__pyx_n_u_Error);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorDomains);
  Py_CLEAR(clear_module_state->__pyx_n_u_ErrorDomains);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLevels);
  Py_CLEAR(clear_module_state->__pyx_n_u_ErrorLevels);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLog___exit);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLog_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLog_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorLog_receive);
  Py_CLEAR(clear_module_state->__pyx_n_s_ErrorTypes);
  Py_CLEAR(clear_module_state->__pyx_n_u_ErrorTypes);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_applying_stylesheet);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_applying_stylesheet_line);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_during_serialisation_out_o);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_in_xpath_expression);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_reading);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_reading_file);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Error_serialising_an_XSLT_result);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Expected_for_variable_reference);
  Py_CLEAR(clear_module_state->__pyx_n_s_ExsltRegExp_match);
  Py_CLEAR(clear_module_state->__pyx_n_s_ExsltRegExp_replace);
  Py_CLEAR(clear_module_state->__pyx_n_s_ExsltRegExp_test);
  Py_CLEAR(clear_module_state->__pyx_n_s_Extension);
  Py_CLEAR(clear_module_state->__pyx_n_u_Extension);
  Py_CLEAR(clear_module_state->__pyx_n_s_FATAL);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Failed_to_create_file);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Failed_to_create_validation_cont);
  Py_CLEAR(clear_module_state->__pyx_n_s_FallbackElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_FallbackElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_FallbackElementClassLookup_set_f);
  Py_CLEAR(clear_module_state->__pyx_n_s_FeedParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_FeedParser_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_FeedParser_feed);
  Py_CLEAR(clear_module_state->__pyx_n_s_FileWriterElement___enter);
  Py_CLEAR(clear_module_state->__pyx_n_s_FileWriterElement___exit);
  Py_CLEAR(clear_module_state->__pyx_kp_u_File_is_already_closed);
  Py_CLEAR(clear_module_state->__pyx_kp_u_File_or_filename_expected_got);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Forbidden_variable);
  Py_CLEAR(clear_module_state->__pyx_n_s_FunctionNamespace);
  Py_CLEAR(clear_module_state->__pyx_n_u_FunctionNamespace);
  Py_CLEAR(clear_module_state->__pyx_kp_u_FunctionNamespace_line_207);
  Py_CLEAR(clear_module_state->__pyx_kp_u_FunctionNamespace_ns_uri_Retriev);
  Py_CLEAR(clear_module_state->__pyx_kp_u_FunctionNamespace_r);
  Py_CLEAR(clear_module_state->__pyx_n_s_FutureWarning);
  Py_CLEAR(clear_module_state->__pyx_n_u_GlobalErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_GzipFile);
  Py_CLEAR(clear_module_state->__pyx_n_s_HTML);
  Py_CLEAR(clear_module_state->__pyx_n_u_HTML);
  Py_CLEAR(clear_module_state->__pyx_n_s_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_u_HTMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_HTMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_HTMLPullParser_read_events);
  Py_CLEAR(clear_module_state->__pyx_n_s_ICONV_COMPILED_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_has_key);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_IDDict_values);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ID_attribute_not_found);
  Py_CLEAR(clear_module_state->__pyx_n_s_IGNORECASE);
  Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Illegal_Unicode_kind);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Illegal_document_provided_NULL);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Illegal_document_provided_expect);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___contains);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___delitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___getitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___len);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImmutableMapping___setitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Inconsistent_enter_action_in_con);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Inconsistent_exit_action_in_cont);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_flush);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_method);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_write);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_write_dec);
  Py_CLEAR(clear_module_state->__pyx_n_s_IncrementalFileWriter_write_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_IndexError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Initial_indentation_level_must_b);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Input_object_has_no_document);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Input_object_is_not_an_XML_eleme);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Internal_error_in_DTD_validation);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Internal_error_in_Relax_NG_valid);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Internal_error_in_Schematron_val);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Internal_error_in_XML_Schema_val);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_HTML_tag_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_PI_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_URL_must_not_contain_or);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_attribute_dictionary);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_attribute_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_character);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_character_reference);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_character_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_child_type);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_context_position);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_context_size);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_entity_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_entity_reference);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_expression);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_input_object);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_input_tag_of_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_namespace_URI);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_namespace_prefix);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_number_of_arguments);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_operand);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_or_incomplete_context);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_predicate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_tag_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_tag_name_2);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Invalid_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_KeyError);
  Py_CLEAR(clear_module_state->__pyx_n_u_LE);
  Py_CLEAR(clear_module_state->__pyx_n_s_LIBXML_COMPILED_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_u_LIBXML_COMPILED_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_s_LIBXML_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_u_LIBXML_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_s_LIBXSLT_COMPILED_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_u_LIBXSLT_COMPILED_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_s_LIBXSLT_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_u_LIBXSLT_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_s_LXML_VERSION);
  Py_CLEAR(clear_module_state->__pyx_n_u_LXML_VERSION);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Libxml2_RelaxNG_error_types);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Libxml2_error_domains);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Libxml2_error_levels);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Libxml2_error_types);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_domains);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_from_errors);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_from_fatals);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_from_level);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_from_warnin);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_levels);
  Py_CLEAR(clear_module_state->__pyx_n_s_ListErrorLog_filter_types);
  Py_CLEAR(clear_module_state->__pyx_n_s_LogEntry);
  Py_CLEAR(clear_module_state->__pyx_n_s_LookupError);
  Py_CLEAR(clear_module_state->__pyx_n_s_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_n_u_LxmlError);
  Py_CLEAR(clear_module_state->__pyx_n_s_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_n_u_LxmlRegistryError);
  Py_CLEAR(clear_module_state->__pyx_n_s_LxmlSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_n_u_LxmlSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemDebug_blocks_used);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemDebug_bytes_used);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemDebug_dict_size);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemDebug_dump);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemDebug_show);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Memory_allocation_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_MethodChanger___aenter);
  Py_CLEAR(clear_module_state->__pyx_n_s_MethodChanger___aexit);
  Py_CLEAR(clear_module_state->__pyx_n_s_MethodChanger___enter);
  Py_CLEAR(clear_module_state->__pyx_n_s_MethodChanger___exit);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Method_changed_outside_of_contex);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Missing_closing_curly_brace);
  Py_CLEAR(clear_module_state->__pyx_n_s_MutableMapping);
  Py_CLEAR(clear_module_state->__pyx_n_u_NAMESPACE);
  Py_CLEAR(clear_module_state->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  Py_CLEAR(clear_module_state->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Name_not_registered);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Namespace);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_n_u_NamespaceRegistryError);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry___deco);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry__deco);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_NamespaceRegistry_update);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Namespace_r);
  Py_CLEAR(clear_module_state->__pyx_kp_u_No_ID_dictionary_available);
  Py_CLEAR(clear_module_state->__pyx_kp_u_No_document_to_serialise);
  Py_CLEAR(clear_module_state->__pyx_kp_u_No_tree_or_file_given);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Node_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Non_Element_values_not_supported);
  Py_CLEAR(clear_module_state->__pyx_kp_u_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_NotImplemented);
  Py_CLEAR(clear_module_state->__pyx_n_s_NotImplementedError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Not_yet_implemented_result_node);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Number_encoding);
  Py_CLEAR(clear_module_state->__pyx_n_b_Ok);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Only_elements_can_be_the_root_of);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Only_processing_instructions_and);
  Py_CLEAR(clear_module_state->__pyx_n_s_OpaqueDocumentWrapper_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_OpaqueDocumentWrapper_extend);
  Py_CLEAR(clear_module_state->__pyx_n_s_OrderedDict);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Output_file_needs_an_async_write);
  Py_CLEAR(clear_module_state->__pyx_n_u_PARSER);
  Py_CLEAR(clear_module_state->__pyx_n_s_PI);
  Py_CLEAR(clear_module_state->__pyx_n_u_PI);
  Py_CLEAR(clear_module_state->__pyx_n_s_PIBase);
  Py_CLEAR(clear_module_state->__pyx_n_u_PIBase);
  Py_CLEAR(clear_module_state->__pyx_kp_u_PI_class_must_be_subclass_of_PIB);
  Py_CLEAR(clear_module_state->__pyx_kp_u_PI_lacks_content);
  Py_CLEAR(clear_module_state->__pyx_kp_u_PI_text_must_not_contain);
  Py_CLEAR(clear_module_state->__pyx_kp_u_PUBLIC);
  Py_CLEAR(clear_module_state->__pyx_n_s_ParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_ParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_ParseError___init);
  Py_CLEAR(clear_module_state->__pyx_n_s_ParseError_position);
  Py_CLEAR(clear_module_state->__pyx_n_s_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_ParserBasedElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_ParserDictionaryContext);
  Py_CLEAR(clear_module_state->__pyx_n_s_ParserError);
  Py_CLEAR(clear_module_state->__pyx_n_u_ParserError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ParserSchemaValidationContext_n);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Parsing_requires_string_data);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Prefix);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Prefix_format_reserved_for_inter);
  Py_CLEAR(clear_module_state->__pyx_n_s_ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_n_u_ProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_n_s_ProcessingInstruction_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_ProcessingInstruction_get);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Proxy_invalidated);
  Py_CLEAR(clear_module_state->__pyx_n_s_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_u_PyErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_PyErrorLog_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_PyErrorLog_log);
  Py_CLEAR(clear_module_state->__pyx_n_s_PyErrorLog_receive);
  Py_CLEAR(clear_module_state->__pyx_n_s_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_PythonElementClassLookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_PythonElementClassLookup_lookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_QName);
  Py_CLEAR(clear_module_state->__pyx_n_u_QName);
  Py_CLEAR(clear_module_state->__pyx_n_s_RELAXNGV);
  Py_CLEAR(clear_module_state->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyElementProxy_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyElementProxy_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyElementProxy_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyElementProxy_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy___copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy___deepcopy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy_getchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy_getnext);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy_getparent);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy_getprevious);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReadOnlyProxy_iterchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_ReferenceError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Registered_element_classes_must);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Registered_functions_must_be_cal);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_n_u_RelaxNG);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_n_u_RelaxNGError);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNGErrorTypes);
  Py_CLEAR(clear_module_state->__pyx_n_u_RelaxNGErrorTypes);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_RelaxNGParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_u_RelaxNGValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_s_RelaxNG_from_rnc_string);
  Py_CLEAR(clear_module_state->__pyx_kp_u_RelaxNG_instance_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver);
  Py_CLEAR(clear_module_state->__pyx_n_u_Resolver);
  Py_CLEAR(clear_module_state->__pyx_n_s_ResolverRegistry_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_ResolverRegistry_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_ResolverRegistry_remove);
  Py_CLEAR(clear_module_state->__pyx_n_s_ResolverRegistry_resolve);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver_resolve);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver_resolve_empty);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver_resolve_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver_resolve_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_Resolver_resolve_string);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Resource_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_RotatingErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_RotatingErrorLog_receive);
  Py_CLEAR(clear_module_state->__pyx_kp_u_SYSTEM);
  Py_CLEAR(clear_module_state->__pyx_n_s_SaxParserTarget);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Schema_instance_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_n_s_Schematron);
  Py_CLEAR(clear_module_state->__pyx_n_u_Schematron);
  Py_CLEAR(clear_module_state->__pyx_n_s_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_n_u_SchematronError);
  Py_CLEAR(clear_module_state->__pyx_n_s_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_SchematronParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_u_SchematronValidateError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Schematron_instance_not_initiali);
  Py_CLEAR(clear_module_state->__pyx_n_s_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_n_u_SerialisationError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Serialisation_to_unicode_must_no);
  Py_CLEAR(clear_module_state->__pyx_n_s_SiblingsIterator);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Stack_usage_error);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Start_of_literal);
  Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration);
  Py_CLEAR(clear_module_state->__pyx_n_s_StringIO);
  Py_CLEAR(clear_module_state->__pyx_n_s_SubElement);
  Py_CLEAR(clear_module_state->__pyx_n_u_SubElement);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Sub_resource_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_SyntaxError);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Syntax_error);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Syntax_error_while_parsing_an_XM);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Syntax_error_while_parsing_an_XM_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_System_URL_may_not_contain_both);
  Py_CLEAR(clear_module_state->__pyx_n_u_TAG);
  Py_CLEAR(clear_module_state->__pyx_n_s_TargetParserResult);
  Py_CLEAR(clear_module_state->__pyx_n_s_TargetParserResult___init);
  Py_CLEAR(clear_module_state->__pyx_kp_u_The_behavior_of_this_method_will);
  Py_CLEAR(clear_module_state->__pyx_kp_u_The_docstring_option_is_deprecat);
  Py_CLEAR(clear_module_state->__pyx_kp_u_This_class_cannot_be_instantiate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_This_is_not_a_supported_node_set);
  Py_CLEAR(clear_module_state->__pyx_kp_u_This_search_incorrectly_ignores);
  Py_CLEAR(clear_module_state->__pyx_kp_u_This_type_cannot_be_instantiated);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_n_u_TreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_comment);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_data);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_end);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_pi);
  Py_CLEAR(clear_module_state->__pyx_n_s_TreeBuilder_start);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Tried_to_unregister_unknown_prox);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Type);
  Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
  Py_CLEAR(clear_module_state->__pyx_n_s_U);
  Py_CLEAR(clear_module_state->__pyx_n_s_UNICODE);
  Py_CLEAR(clear_module_state->__pyx_kp_u_US_ASCII);
  Py_CLEAR(clear_module_state->__pyx_n_u_UTF8);
  Py_CLEAR(clear_module_state->__pyx_kp_u_UTF_8);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Undefined_namespace_prefix);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Undefined_variable);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Undefined_xpath_result);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Unfinished_literal);
  Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeDecodeError);
  Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeEncodeError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unicode_strings_with_encoding_de);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Unknown_error);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_libxml2_version);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_node_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_return_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_xpath_result);
  Py_CLEAR(clear_module_state->__pyx_kp_b_Unregistered_function);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unsupported_element_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unsupported_node_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator__append_log_message);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator__clear_error_log);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator_assert);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator_assertValid);
  Py_CLEAR(clear_module_state->__pyx_n_s_Validator_validate);
  Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
  Py_CLEAR(clear_module_state->__pyx_n_s_WARNING);
  Py_CLEAR(clear_module_state->__pyx_n_s_WAR_UNDECLARED_ENTITY);
  Py_CLEAR(clear_module_state->__pyx_n_u_X);
  Py_CLEAR(clear_module_state->__pyx_n_s_XInclude);
  Py_CLEAR(clear_module_state->__pyx_n_u_XInclude);
  Py_CLEAR(clear_module_state->__pyx_n_s_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XIncludeError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XInclude_instance_not_initialise);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XInclude_processing_failed);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XInclude_processor_not_initialis);
  Py_CLEAR(clear_module_state->__pyx_n_s_XML);
  Py_CLEAR(clear_module_state->__pyx_n_u_XML);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLDTDID);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLDTDID);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLID);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLID);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLPullParser);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLPullParser_read_events);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLSchemaError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLSchemaParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLSchemaValidateError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSyntaxAssertionError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSyntaxAssertionError___init);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XMLTreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_n_u_XMLTreeBuilder);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XML_declaration_already_written);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XML_line_3261);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XML_text_parser_None_base_url_No);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPATH_LOCATIONSET);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPATH_POINT);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPATH_RANGE);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPATH_USERS);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPath);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPath);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathDocumentEvaluator);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathElementEvaluator);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathElementEvaluator_register_n);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathElementEvaluator_register_n_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathEvalError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathEvaluator);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathEvaluator);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathEvaluatorBase);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathFunctionError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathResultError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XPathSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XPathSyntaxError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XPath_context_is_only_usable_dur);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XPath_context_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XPath_evaluator_locking_failed);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XPath_evaluator_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XPath_function);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLT);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTAccessControl);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTApplyError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTErrorLog);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTExtension);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTExtensionError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTExtension_apply_templates);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTExtension_execute);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTExtension_process_children);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTParseError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTProcessingInstruction);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTProcessingInstruction_parse);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTProcessingInstruction_set);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTResultTree);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTResultTree_write_output);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLTSaveError);
  Py_CLEAR(clear_module_state->__pyx_n_u_XSLTSaveError);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT___copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT___deepcopy);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XSLT_context_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT_set_global_max_depth);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT_strparam);
  Py_CLEAR(clear_module_state->__pyx_kp_u_XSLT_stylesheet_not_initialised);
  Py_CLEAR(clear_module_state->__pyx_n_s_XSLT_tostring);
  Py_CLEAR(clear_module_state->__pyx_n_s__106);
  Py_CLEAR(clear_module_state->__pyx_kp_u__11);
  Py_CLEAR(clear_module_state->__pyx_kp_b__12);
  Py_CLEAR(clear_module_state->__pyx_kp_u__12);
  Py_CLEAR(clear_module_state->__pyx_kp_b__17);
  Py_CLEAR(clear_module_state->__pyx_kp_u__17);
  Py_CLEAR(clear_module_state->__pyx_kp_u__18);
  Py_CLEAR(clear_module_state->__pyx_kp_u__19);
  Py_CLEAR(clear_module_state->__pyx_kp_u__20);
  Py_CLEAR(clear_module_state->__pyx_kp_b__21);
  Py_CLEAR(clear_module_state->__pyx_kp_u__21);
  Py_CLEAR(clear_module_state->__pyx_n_s__22);
  Py_CLEAR(clear_module_state->__pyx_kp_b__22);
  Py_CLEAR(clear_module_state->__pyx_kp_u__22);
  Py_CLEAR(clear_module_state->__pyx_kp_u__24);
  Py_CLEAR(clear_module_state->__pyx_kp_b__25);
  Py_CLEAR(clear_module_state->__pyx_kp_u__25);
  Py_CLEAR(clear_module_state->__pyx_kp_b__26);
  Py_CLEAR(clear_module_state->__pyx_kp_u__26);
  Py_CLEAR(clear_module_state->__pyx_kp_u__28);
  Py_CLEAR(clear_module_state->__pyx_kp_u__29);
  Py_CLEAR(clear_module_state->__pyx_kp_b__3);
  Py_CLEAR(clear_module_state->__pyx_kp_u__3);
  Py_CLEAR(clear_module_state->__pyx_kp_u__30);
  Py_CLEAR(clear_module_state->__pyx_kp_u__32);
  Py_CLEAR(clear_module_state->__pyx_kp_b__33);
  Py_CLEAR(clear_module_state->__pyx_kp_u__33);
  Py_CLEAR(clear_module_state->__pyx_kp_b__34);
  Py_CLEAR(clear_module_state->__pyx_kp_u__34);
  Py_CLEAR(clear_module_state->__pyx_kp_b__35);
  Py_CLEAR(clear_module_state->__pyx_kp_u__35);
  Py_CLEAR(clear_module_state->__pyx_kp_b__4);
  Py_CLEAR(clear_module_state->__pyx_kp_u__4);
  Py_CLEAR(clear_module_state->__pyx_kp_u__41);
  Py_CLEAR(clear_module_state->__pyx_kp_u__42);
  Py_CLEAR(clear_module_state->__pyx_kp_u__43);
  Py_CLEAR(clear_module_state->__pyx_kp_u__45);
  Py_CLEAR(clear_module_state->__pyx_kp_b__48);
  Py_CLEAR(clear_module_state->__pyx_kp_b__489);
  Py_CLEAR(clear_module_state->__pyx_kp_b__491);
  Py_CLEAR(clear_module_state->__pyx_kp_b__50);
  Py_CLEAR(clear_module_state->__pyx_kp_u__52);
  Py_CLEAR(clear_module_state->__pyx_n_s__56);
  Py_CLEAR(clear_module_state->__pyx_n_u__56);
  Py_CLEAR(clear_module_state->__pyx_kp_u__57);
  Py_CLEAR(clear_module_state->__pyx_kp_u__61);
  Py_CLEAR(clear_module_state->__pyx_kp_b__63);
  Py_CLEAR(clear_module_state->__pyx_kp_u__71);
  Py_CLEAR(clear_module_state->__pyx_kp_u__72);
  Py_CLEAR(clear_module_state->__pyx_kp_u__73);
  Py_CLEAR(clear_module_state->__pyx_kp_u__74);
  Py_CLEAR(clear_module_state->__pyx_kp_u__75);
  Py_CLEAR(clear_module_state->__pyx_kp_u__95);
  Py_CLEAR(clear_module_state->__pyx_kp_u__96);
  Py_CLEAR(clear_module_state->__pyx_n_s_abspath);
  Py_CLEAR(clear_module_state->__pyx_n_s_accepted_domains);
  Py_CLEAR(clear_module_state->__pyx_n_s_access_control);
  Py_CLEAR(clear_module_state->__pyx_n_s_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_addnext);
  Py_CLEAR(clear_module_state->__pyx_n_s_addprevious);
  Py_CLEAR(clear_module_state->__pyx_n_s_adopt_external_document);
  Py_CLEAR(clear_module_state->__pyx_n_s_aenter);
  Py_CLEAR(clear_module_state->__pyx_n_s_aexit);
  Py_CLEAR(clear_module_state->__pyx_n_s_all);
  Py_CLEAR(clear_module_state->__pyx_n_u_alpha);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ambiguous_reference_to_embedded);
  Py_CLEAR(clear_module_state->__pyx_kp_u_amp);
  Py_CLEAR(clear_module_state->__pyx_n_u_any);
  Py_CLEAR(clear_module_state->__pyx_n_s_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_append_log_message);
  Py_CLEAR(clear_module_state->__pyx_n_s_apply_templates);
  Py_CLEAR(clear_module_state->__pyx_n_s_args);
  Py_CLEAR(clear_module_state->__pyx_kp_u_argument_must_be_a_byte_string_o);
  Py_CLEAR(clear_module_state->__pyx_n_u_ascii);
  Py_CLEAR(clear_module_state->__pyx_n_s_assert);
  Py_CLEAR(clear_module_state->__pyx_n_s_assertValid);
  Py_CLEAR(clear_module_state->__pyx_n_s_async_outfile);
  Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
  Py_CLEAR(clear_module_state->__pyx_kp_u_at_0x);
  Py_CLEAR(clear_module_state->__pyx_kp_u_attempt_to_assign_sequence_of_si);
  Py_CLEAR(clear_module_state->__pyx_n_s_attrib);
  Py_CLEAR(clear_module_state->__pyx_n_s_attribute_defaults);
  Py_CLEAR(clear_module_state->__pyx_n_s_attribute_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_attribute_names);
  Py_CLEAR(clear_module_state->__pyx_n_s_attributes);
  Py_CLEAR(clear_module_state->__pyx_n_s_attrs);
  Py_CLEAR(clear_module_state->__pyx_n_s_await);
  Py_CLEAR(clear_module_state->__pyx_n_s_base_url);
  Py_CLEAR(clear_module_state->__pyx_n_u_beta);
  Py_CLEAR(clear_module_state->__pyx_n_s_block_count);
  Py_CLEAR(clear_module_state->__pyx_n_s_blocks_used);
  Py_CLEAR(clear_module_state->__pyx_kp_u_boolean_xs_attribute_default_or);
  Py_CLEAR(clear_module_state->__pyx_n_s_bstring);
  Py_CLEAR(clear_module_state->__pyx_n_s_buffered);
  Py_CLEAR(clear_module_state->__pyx_n_s_build_smart_strings);
  Py_CLEAR(clear_module_state->__pyx_n_s_byte_count);
  Py_CLEAR(clear_module_state->__pyx_n_s_bytes_used);
  Py_CLEAR(clear_module_state->__pyx_n_u_c14n);
  Py_CLEAR(clear_module_state->__pyx_n_u_c14n2);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_attr);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_attr_next);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_attrs);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_buffer);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_child);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_compression);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_context_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_count);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_ctxt);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_dict);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_dtd);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_encoding);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_href);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_method);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_new_next);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_new_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_next);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_node_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_node_next);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_old_next);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_old_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_old_output_parent);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_parent);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_path);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_source_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_standalone);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_start);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_start_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_stop);
  Py_CLEAR(clear_module_state->__pyx_n_s_c_version);
  Py_CLEAR(clear_module_state->__pyx_kp_u_can_only_parse_strings);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_add_ancestor_as_sibling_p);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_append_document_already_h);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_append_parent_to_itself);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_append_trailing_element_t);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_assign_None);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_be_serialized);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_parse_from);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_serialize);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_set_a_maximum_stylesheet);
  Py_CLEAR(clear_module_state->__pyx_n_s_canonicalize);
  Py_CLEAR(clear_module_state->__pyx_n_u_canonicalize);
  Py_CLEAR(clear_module_state->__pyx_n_s_capsule);
  Py_CLEAR(clear_module_state->__pyx_n_u_cdata);
  Py_CLEAR(clear_module_state->__pyx_n_s_child);
  Py_CLEAR(clear_module_state->__pyx_n_s_children);
  Py_CLEAR(clear_module_state->__pyx_n_s_class);
  Py_CLEAR(clear_module_state->__pyx_n_u_class);
  Py_CLEAR(clear_module_state->__pyx_n_s_class_dict_iterable);
  Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_class_mapping);
  Py_CLEAR(clear_module_state->__pyx_n_s_cleanup_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_u_cleanup_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_s_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_clear_error_log);
  Py_CLEAR(clear_module_state->__pyx_n_s_clear_error_log_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_clear_error_log_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
  Py_CLEAR(clear_module_state->__pyx_n_s_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_close_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_close_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_cls);
  Py_CLEAR(clear_module_state->__pyx_n_s_code);
  Py_CLEAR(clear_module_state->__pyx_n_s_codecs);
  Py_CLEAR(clear_module_state->__pyx_n_s_collect_ids);
  Py_CLEAR(clear_module_state->__pyx_n_s_collections);
  Py_CLEAR(clear_module_state->__pyx_n_s_collections_abc);
  Py_CLEAR(clear_module_state->__pyx_kp_u_column);
  Py_CLEAR(clear_module_state->__pyx_n_s_column_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_comment);
  Py_CLEAR(clear_module_state->__pyx_n_u_comment);
  Py_CLEAR(clear_module_state->__pyx_kp_u_comment_class_must_be_subclass_o);
  Py_CLEAR(clear_module_state->__pyx_n_s_comment_factory);
  Py_CLEAR(clear_module_state->__pyx_n_s_compact);
  Py_CLEAR(clear_module_state->__pyx_kp_u_compact_syntax_not_supported_ple);
  Py_CLEAR(clear_module_state->__pyx_n_s_compile);
  Py_CLEAR(clear_module_state->__pyx_n_s_compression);
  Py_CLEAR(clear_module_state->__pyx_n_s_compresslevel);
  Py_CLEAR(clear_module_state->__pyx_n_s_contains);
  Py_CLEAR(clear_module_state->__pyx_n_s_content);
  Py_CLEAR(clear_module_state->__pyx_n_s_context);
  Py_CLEAR(clear_module_state->__pyx_n_s_contextlib);
  Py_CLEAR(clear_module_state->__pyx_n_s_contextmanager);
  Py_CLEAR(clear_module_state->__pyx_n_s_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_copy_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_count);
  Py_CLEAR(clear_module_state->__pyx_n_s_create_dir);
  Py_CLEAR(clear_module_state->__pyx_n_u_create_dir);
  Py_CLEAR(clear_module_state->__pyx_n_s_cssselect);
  Py_CLEAR(clear_module_state->__pyx_n_s_ctxt);
  Py_CLEAR(clear_module_state->__pyx_n_u_d);
  Py_CLEAR(clear_module_state->__pyx_n_s_data);
  Py_CLEAR(clear_module_state->__pyx_n_b_dc);
  Py_CLEAR(clear_module_state->__pyx_n_s_deco);
  Py_CLEAR(clear_module_state->__pyx_n_s_decode);
  Py_CLEAR(clear_module_state->__pyx_n_s_deepcopy);
  Py_CLEAR(clear_module_state->__pyx_n_s_default);
  Py_CLEAR(clear_module_state->__pyx_kp_u_default_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_default_doctype);
  Py_CLEAR(clear_module_state->__pyx_n_s_default_resolver);
  Py_CLEAR(clear_module_state->__pyx_kp_u_default_value);
  Py_CLEAR(clear_module_state->__pyx_n_s_default_value_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_delitem);
  Py_CLEAR(clear_module_state->__pyx_n_u_dev);
  Py_CLEAR(clear_module_state->__pyx_n_s_dic);
  Py_CLEAR(clear_module_state->__pyx_n_s_dict);
  Py_CLEAR(clear_module_state->__pyx_n_u_dict);
  Py_CLEAR(clear_module_state->__pyx_n_s_dict_size);
  Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
  Py_CLEAR(clear_module_state->__pyx_n_s_discard);
  Py_CLEAR(clear_module_state->__pyx_n_s_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_doc_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_doc_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_doc_ref);
  Py_CLEAR(clear_module_state->__pyx_n_s_docformat);
  Py_CLEAR(clear_module_state->__pyx_n_s_docstring);
  Py_CLEAR(clear_module_state->__pyx_n_s_doctype);
  Py_CLEAR(clear_module_state->__pyx_kp_u_document_context_is_missing);
  Py_CLEAR(clear_module_state->__pyx_kp_u_document_external_context_nodes);
  Py_CLEAR(clear_module_state->__pyx_n_s_domain);
  Py_CLEAR(clear_module_state->__pyx_n_s_domain_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_domains);
  Py_CLEAR(clear_module_state->__pyx_kp_u_double_registering_proxy);
  Py_CLEAR(clear_module_state->__pyx_n_s_dtd_validation);
  Py_CLEAR(clear_module_state->__pyx_n_s_dump);
  Py_CLEAR(clear_module_state->__pyx_n_u_dump);
  Py_CLEAR(clear_module_state->__pyx_n_s_dumps);
  Py_CLEAR(clear_module_state->__pyx_kp_u_either_filename_or_external_ID_r);
  Py_CLEAR(clear_module_state->__pyx_n_s_el);
  Py_CLEAR(clear_module_state->__pyx_n_s_elem);
  Py_CLEAR(clear_module_state->__pyx_n_s_element);
  Py_CLEAR(clear_module_state->__pyx_n_u_element);
  Py_CLEAR(clear_module_state->__pyx_kp_u_element_class_must_be_subclass_o);
  Py_CLEAR(clear_module_state->__pyx_n_s_element_config);
  Py_CLEAR(clear_module_state->__pyx_n_s_element_factory);
  Py_CLEAR(clear_module_state->__pyx_n_s_element_or_tree);
  Py_CLEAR(clear_module_state->__pyx_n_s_element_writer);
  Py_CLEAR(clear_module_state->__pyx_n_s_elementpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_elements);
  Py_CLEAR(clear_module_state->__pyx_n_s_elements_only);
  Py_CLEAR(clear_module_state->__pyx_kp_u_elemname);
  Py_CLEAR(clear_module_state->__pyx_n_s_elemname_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_empty);
  Py_CLEAR(clear_module_state->__pyx_kp_u_empty_namespace_prefix_is_not_su);
  Py_CLEAR(clear_module_state->__pyx_kp_u_empty_prefix_is_not_supported_in);
  Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
  Py_CLEAR(clear_module_state->__pyx_n_s_enable_regexp);
  Py_CLEAR(clear_module_state->__pyx_n_s_encode);
  Py_CLEAR(clear_module_state->__pyx_n_s_encoding);
  Py_CLEAR(clear_module_state->__pyx_n_s_end);
  Py_CLEAR(clear_module_state->__pyx_n_u_end);
  Py_CLEAR(clear_module_state->__pyx_kp_u_end_ns);
  Py_CLEAR(clear_module_state->__pyx_n_s_end_ns_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_end_tag_mismatch_expected);
  Py_CLEAR(clear_module_state->__pyx_n_s_endswith);
  Py_CLEAR(clear_module_state->__pyx_n_s_enter);
  Py_CLEAR(clear_module_state->__pyx_n_s_entities);
  Py_CLEAR(clear_module_state->__pyx_n_u_entities);
  Py_CLEAR(clear_module_state->__pyx_n_s_entity);
  Py_CLEAR(clear_module_state->__pyx_n_u_entity);
  Py_CLEAR(clear_module_state->__pyx_n_s_entries);
  Py_CLEAR(clear_module_state->__pyx_n_s_entry);
  Py_CLEAR(clear_module_state->__pyx_n_s_enumerate);
  Py_CLEAR(clear_module_state->__pyx_n_u_enumeration);
  Py_CLEAR(clear_module_state->__pyx_n_s_error_log);
  Py_CLEAR(clear_module_state->__pyx_kp_u_error_parsing_DTD);
  Py_CLEAR(clear_module_state->__pyx_n_s_etree);
  Py_CLEAR(clear_module_state->__pyx_n_s_etree_or_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_etree_or_element_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_evaluator);
  Py_CLEAR(clear_module_state->__pyx_n_s_events);
  Py_CLEAR(clear_module_state->__pyx_n_s_exc_context);
  Py_CLEAR(clear_module_state->__pyx_n_s_exc_info);
  Py_CLEAR(clear_module_state->__pyx_n_s_exc_tb);
  Py_CLEAR(clear_module_state->__pyx_n_s_exc_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_exc_val);
  Py_CLEAR(clear_module_state->__pyx_n_s_exclude_attrs);
  Py_CLEAR(clear_module_state->__pyx_n_s_exclude_tags);
  Py_CLEAR(clear_module_state->__pyx_n_s_exclusive);
  Py_CLEAR(clear_module_state->__pyx_n_s_execute);
  Py_CLEAR(clear_module_state->__pyx_n_s_exit);
  Py_CLEAR(clear_module_state->__pyx_kp_u_expected);
  Py_CLEAR(clear_module_state->__pyx_kp_u_expected_string_or_Element);
  Py_CLEAR(clear_module_state->__pyx_n_s_expr);
  Py_CLEAR(clear_module_state->__pyx_n_s_extend);
  Py_CLEAR(clear_module_state->__pyx_kp_u_extension_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_extensions);
  Py_CLEAR(clear_module_state->__pyx_kp_u_extensions_must_have_non_empty_n);
  Py_CLEAR(clear_module_state->__pyx_kp_u_extensions_must_not_have_empty_n);
  Py_CLEAR(clear_module_state->__pyx_n_s_external_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_extra);
  Py_CLEAR(clear_module_state->__pyx_n_s_f);
  Py_CLEAR(clear_module_state->__pyx_n_s_fallback);
  Py_CLEAR(clear_module_state->__pyx_n_s_feed);
  Py_CLEAR(clear_module_state->__pyx_n_s_feed_error_log);
  Py_CLEAR(clear_module_state->__pyx_n_s_file);
  Py_CLEAR(clear_module_state->__pyx_kp_b_file_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_file_must_be_a_filename_file_lik);
  Py_CLEAR(clear_module_state->__pyx_n_s_filelike);
  Py_CLEAR(clear_module_state->__pyx_n_s_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_fileobj);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_domains);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_from_errors);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_from_fatals);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_from_level);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_from_warnings);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_levels);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter_types);
  Py_CLEAR(clear_module_state->__pyx_n_s_filtered);
  Py_CLEAR(clear_module_state->__pyx_n_s_find);
  Py_CLEAR(clear_module_state->__pyx_n_s_findall);
  Py_CLEAR(clear_module_state->__pyx_n_s_findtext);
  Py_CLEAR(clear_module_state->__pyx_n_s_first_error);
  Py_CLEAR(clear_module_state->__pyx_n_u_fixed);
  Py_CLEAR(clear_module_state->__pyx_n_s_flags);
  Py_CLEAR(clear_module_state->__pyx_n_s_flush);
  Py_CLEAR(clear_module_state->__pyx_n_s_for_html);
  Py_CLEAR(clear_module_state->__pyx_n_s_from_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_from_rnc_string);
  Py_CLEAR(clear_module_state->__pyx_n_s_fromstring);
  Py_CLEAR(clear_module_state->__pyx_n_u_fromstring);
  Py_CLEAR(clear_module_state->__pyx_n_s_fromstringlist);
  Py_CLEAR(clear_module_state->__pyx_n_u_fromstringlist);
  Py_CLEAR(clear_module_state->__pyx_n_s_function_mapping);
  Py_CLEAR(clear_module_state->__pyx_n_s_function_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_functions);
  Py_CLEAR(clear_module_state->__pyx_n_s_functools);
  Py_CLEAR(clear_module_state->__pyx_n_u_g);
  Py_CLEAR(clear_module_state->__pyx_kp_u_g_1_g_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
  Py_CLEAR(clear_module_state->__pyx_n_s_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_getLogger);
  Py_CLEAR(clear_module_state->__pyx_n_s_getName);
  Py_CLEAR(clear_module_state->__pyx_n_s_get_default_parser);
  Py_CLEAR(clear_module_state->__pyx_n_u_get_default_parser);
  Py_CLEAR(clear_module_state->__pyx_n_s_get_namespace);
  Py_CLEAR(clear_module_state->__pyx_n_s_getargspec);
  Py_CLEAR(clear_module_state->__pyx_n_s_getattribute);
  Py_CLEAR(clear_module_state->__pyx_n_s_getchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_getdefaultencoding);
  Py_CLEAR(clear_module_state->__pyx_n_s_getelementpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_getfilesystemencoding);
  Py_CLEAR(clear_module_state->__pyx_n_s_getfullargspec);
  Py_CLEAR(clear_module_state->__pyx_n_s_getitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_getiterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_getnext);
  Py_CLEAR(clear_module_state->__pyx_n_s_getparent);
  Py_CLEAR(clear_module_state->__pyx_n_s_getpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_getprevious);
  Py_CLEAR(clear_module_state->__pyx_n_s_getroot);
  Py_CLEAR(clear_module_state->__pyx_n_s_getroottree);
  Py_CLEAR(clear_module_state->__pyx_n_s_geturl);
  Py_CLEAR(clear_module_state->__pyx_n_s_getvalue);
  Py_CLEAR(clear_module_state->__pyx_n_u_getvalue);
  Py_CLEAR(clear_module_state->__pyx_n_s_getwriter);
  Py_CLEAR(clear_module_state->__pyx_kp_u_got);
  Py_CLEAR(clear_module_state->__pyx_kp_u_got_invalid_input_value_of_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_group);
  Py_CLEAR(clear_module_state->__pyx_n_s_groups);
  Py_CLEAR(clear_module_state->__pyx_kp_u_gt);
  Py_CLEAR(clear_module_state->__pyx_n_s_gzip);
  Py_CLEAR(clear_module_state->__pyx_n_s_has_key);
  Py_CLEAR(clear_module_state->__pyx_n_u_href);
  Py_CLEAR(clear_module_state->__pyx_kp_u_href_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_href_utf);
  Py_CLEAR(clear_module_state->__pyx_n_s_hrefs);
  Py_CLEAR(clear_module_state->__pyx_n_b_html);
  Py_CLEAR(clear_module_state->__pyx_n_s_html);
  Py_CLEAR(clear_module_state->__pyx_n_u_html);
  Py_CLEAR(clear_module_state->__pyx_n_s_htmlfile);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_codespeak_net_lxml_objectif);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_exslt_org_regular_expressio);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_purl_org_dc_elements_1_1);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_schemas_xmlsoap_org_wsdl);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo);
  Py_CLEAR(clear_module_state->__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_1999_xhtml);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_2001_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_kp_u_http_www_w3_org_2001_XMLSchema);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i);
  Py_CLEAR(clear_module_state->__pyx_kp_u_http_www_w3_org_XML_1998_namesp);
  Py_CLEAR(clear_module_state->__pyx_kp_b_http_www_w3_org_XML_1998_namespa);
  Py_CLEAR(clear_module_state->__pyx_kp_u_http_www_w3_org_XML_1998_namespa);
  Py_CLEAR(clear_module_state->__pyx_n_s_huge_tree);
  Py_CLEAR(clear_module_state->__pyx_n_u_i);
  Py_CLEAR(clear_module_state->__pyx_n_s_id);
  Py_CLEAR(clear_module_state->__pyx_n_u_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_id_name);
  Py_CLEAR(clear_module_state->__pyx_n_u_idref);
  Py_CLEAR(clear_module_state->__pyx_n_u_idrefs);
  Py_CLEAR(clear_module_state->__pyx_n_u_implied);
  Py_CLEAR(clear_module_state->__pyx_n_s_import);
  Py_CLEAR(clear_module_state->__pyx_kp_u_in_public_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_inclusive);
  Py_CLEAR(clear_module_state->__pyx_n_s_inclusive_ns_prefixes);
  Py_CLEAR(clear_module_state->__pyx_kp_u_inconsistent_exit_action_in_cont);
  Py_CLEAR(clear_module_state->__pyx_n_s_indent);
  Py_CLEAR(clear_module_state->__pyx_n_s_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_index_out_of_range);
  Py_CLEAR(clear_module_state->__pyx_n_s_init);
  Py_CLEAR(clear_module_state->__pyx_n_s_init_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass);
  Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
  Py_CLEAR(clear_module_state->__pyx_n_s_input);
  Py_CLEAR(clear_module_state->__pyx_kp_u_input_is_not_an_Element);
  Py_CLEAR(clear_module_state->__pyx_n_s_input_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_insert);
  Py_CLEAR(clear_module_state->__pyx_n_s_insert_comments);
  Py_CLEAR(clear_module_state->__pyx_n_s_insert_pis);
  Py_CLEAR(clear_module_state->__pyx_n_s_inspect);
  Py_CLEAR(clear_module_state->__pyx_n_s_int);
  Py_CLEAR(clear_module_state->__pyx_n_s_int1);
  Py_CLEAR(clear_module_state->__pyx_n_s_int2);
  Py_CLEAR(clear_module_state->__pyx_n_u_internal);
  Py_CLEAR(clear_module_state->__pyx_kp_u_internal_error_tail);
  Py_CLEAR(clear_module_state->__pyx_kp_u_internal_error_text);
  Py_CLEAR(clear_module_state->__pyx_n_s_intersection);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_DTD_proxy_at_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_Document_proxy_at_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_Element_proxy_at_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_argument_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_element);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_event_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_node_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_io);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
  Py_CLEAR(clear_module_state->__pyx_kp_u_is_not_declared_in_scope);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_owned);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_standalone);
  Py_CLEAR(clear_module_state->__pyx_n_s_iselement);
  Py_CLEAR(clear_module_state->__pyx_n_u_iselement);
  Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
  Py_CLEAR(clear_module_state->__pyx_n_s_islice);
  Py_CLEAR(clear_module_state->__pyx_n_s_isspace);
  Py_CLEAR(clear_module_state->__pyx_n_s_item);
  Py_CLEAR(clear_module_state->__pyx_n_s_items);
  Py_CLEAR(clear_module_state->__pyx_n_u_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_iter_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_iter_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterancestors);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterattributes);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterchildren);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterdescendants);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterelements);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterentities);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterfind);
  Py_CLEAR(clear_module_state->__pyx_n_s_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterparse);
  Py_CLEAR(clear_module_state->__pyx_n_u_iterparse);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterparse_makeelement);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterparse_set_element_class_look);
  Py_CLEAR(clear_module_state->__pyx_n_s_itersiblings);
  Py_CLEAR(clear_module_state->__pyx_n_s_itertext);
  Py_CLEAR(clear_module_state->__pyx_n_s_itertools);
  Py_CLEAR(clear_module_state->__pyx_n_s_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_n_u_iterwalk);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterwalk_skip_subtree);
  Py_CLEAR(clear_module_state->__pyx_n_s_join);
  Py_CLEAR(clear_module_state->__pyx_n_s_k);
  Py_CLEAR(clear_module_state->__pyx_n_s_keep_ns_prefixes);
  Py_CLEAR(clear_module_state->__pyx_n_s_keep_tail);
  Py_CLEAR(clear_module_state->__pyx_n_s_key);
  Py_CLEAR(clear_module_state->__pyx_kp_u_key_not_found);
  Py_CLEAR(clear_module_state->__pyx_n_s_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_kw);
  Py_CLEAR(clear_module_state->__pyx_n_s_kwargs);
  Py_CLEAR(clear_module_state->__pyx_n_s_l);
  Py_CLEAR(clear_module_state->__pyx_n_s_last_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_len);
  Py_CLEAR(clear_module_state->__pyx_n_s_level);
  Py_CLEAR(clear_module_state->__pyx_n_s_level_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_levels);
  Py_CLEAR(clear_module_state->__pyx_kp_u_libxml2_d_d_d);
  Py_CLEAR(clear_module_state->__pyx_kp_u_line);
  Py_CLEAR(clear_module_state->__pyx_n_s_line_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_line_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_lineno);
  Py_CLEAR(clear_module_state->__pyx_kp_u_list_index_out_of_range);
  Py_CLEAR(clear_module_state->__pyx_kp_u_list_index_x_x_not_in_list);
  Py_CLEAR(clear_module_state->__pyx_kp_u_list_index_x_x_not_in_slice);
  Py_CLEAR(clear_module_state->__pyx_n_s_load);
  Py_CLEAR(clear_module_state->__pyx_n_s_load_dtd);
  Py_CLEAR(clear_module_state->__pyx_n_s_loads);
  Py_CLEAR(clear_module_state->__pyx_n_s_log);
  Py_CLEAR(clear_module_state->__pyx_n_s_log_entry);
  Py_CLEAR(clear_module_state->__pyx_n_s_logger);
  Py_CLEAR(clear_module_state->__pyx_n_s_logger_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_logging);
  Py_CLEAR(clear_module_state->__pyx_n_s_lookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_lower);
  Py_CLEAR(clear_module_state->__pyx_kp_u_lt);
  Py_CLEAR(clear_module_state->__pyx_n_s_lxml);
  Py_CLEAR(clear_module_state->__pyx_n_s_lxml_cssselect);
  Py_CLEAR(clear_module_state->__pyx_n_s_lxml_etree);
  Py_CLEAR(clear_module_state->__pyx_kp_u_lxml_etree_was_compiled_without);
  Py_CLEAR(clear_module_state->__pyx_n_s_main);
  Py_CLEAR(clear_module_state->__pyx_n_s_makeelement);
  Py_CLEAR(clear_module_state->__pyx_kp_u_malformed_PI_attributes);
  Py_CLEAR(clear_module_state->__pyx_n_b_match);
  Py_CLEAR(clear_module_state->__pyx_n_s_match);
  Py_CLEAR(clear_module_state->__pyx_n_u_match);
  Py_CLEAR(clear_module_state->__pyx_n_s_matcher);
  Py_CLEAR(clear_module_state->__pyx_n_u_matches);
  Py_CLEAR(clear_module_state->__pyx_n_s_max_depth);
  Py_CLEAR(clear_module_state->__pyx_n_s_max_len);
  Py_CLEAR(clear_module_state->__pyx_n_s_memo);
  Py_CLEAR(clear_module_state->__pyx_n_s_memory_debugger);
  Py_CLEAR(clear_module_state->__pyx_kp_b_memorydump);
  Py_CLEAR(clear_module_state->__pyx_kp_b_memorylist);
  Py_CLEAR(clear_module_state->__pyx_n_s_message);
  Py_CLEAR(clear_module_state->__pyx_n_s_metaclass);
  Py_CLEAR(clear_module_state->__pyx_n_s_method);
  Py_CLEAR(clear_module_state->__pyx_kp_u_missing_end_tags);
  Py_CLEAR(clear_module_state->__pyx_kp_u_missing_toplevel_element);
  Py_CLEAR(clear_module_state->__pyx_n_u_mixed);
  Py_CLEAR(clear_module_state->__pyx_n_s_mode);
  Py_CLEAR(clear_module_state->__pyx_n_s_module);
  Py_CLEAR(clear_module_state->__pyx_n_s_module_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_mro_entries);
  Py_CLEAR(clear_module_state->__pyx_n_u_mult);
  Py_CLEAR(clear_module_state->__pyx_n_s_n);
  Py_CLEAR(clear_module_state->__pyx_n_u_n);
  Py_CLEAR(clear_module_state->__pyx_n_s_name);
  Py_CLEAR(clear_module_state->__pyx_n_u_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_name_utf);
  Py_CLEAR(clear_module_state->__pyx_n_s_names);
  Py_CLEAR(clear_module_state->__pyx_n_s_namespace);
  Py_CLEAR(clear_module_state->__pyx_n_s_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_s_new);
  Py_CLEAR(clear_module_state->__pyx_n_s_new_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_new_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_new_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_s_new_pos);
  Py_CLEAR(clear_module_state->__pyx_n_u_nmtoken);
  Py_CLEAR(clear_module_state->__pyx_n_u_nmtokens);
  Py_CLEAR(clear_module_state->__pyx_kp_u_no_content_written);
  Py_CLEAR(clear_module_state->__pyx_kp_u_no_context_node);
  Py_CLEAR(clear_module_state->__pyx_kp_u_no_element_found);
  Py_CLEAR(clear_module_state->__pyx_n_s_no_network);
  Py_CLEAR(clear_module_state->__pyx_n_s_node);
  Py_CLEAR(clear_module_state->__pyx_n_u_none);
  Py_CLEAR(clear_module_state->__pyx_kp_u_not_allowed_inside_CDATA);
  Py_CLEAR(clear_module_state->__pyx_kp_u_not_found);
  Py_CLEAR(clear_module_state->__pyx_kp_u_not_found_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_not_in_an_element);
  Py_CLEAR(clear_module_state->__pyx_n_u_notation);
  Py_CLEAR(clear_module_state->__pyx_n_s_ns);
  Py_CLEAR(clear_module_state->__pyx_n_s_ns_clean);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ns_d);
  Py_CLEAR(clear_module_state->__pyx_kp_b_ns_d_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_ns_stack);
  Py_CLEAR(clear_module_state->__pyx_n_s_ns_uri);
  Py_CLEAR(clear_module_state->__pyx_n_s_ns_utf);
  Py_CLEAR(clear_module_state->__pyx_n_s_nsmap);
  Py_CLEAR(clear_module_state->__pyx_n_s_obj);
  Py_CLEAR(clear_module_state->__pyx_n_s_object);
  Py_CLEAR(clear_module_state->__pyx_kp_u_object_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_occur);
  Py_CLEAR(clear_module_state->__pyx_n_s_occur_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_of_QName);
  Py_CLEAR(clear_module_state->__pyx_kp_u_of_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_offset);
  Py_CLEAR(clear_module_state->__pyx_n_s_old);
  Py_CLEAR(clear_module_state->__pyx_n_s_old_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_old_writer);
  Py_CLEAR(clear_module_state->__pyx_n_u_once);
  Py_CLEAR(clear_module_state->__pyx_kp_u_only_XML_documents_have_declarat);
  Py_CLEAR(clear_module_state->__pyx_kp_u_only_setting_the_href_attribute);
  Py_CLEAR(clear_module_state->__pyx_n_s_open);
  Py_CLEAR(clear_module_state->__pyx_n_s_open_utf8_file);
  Py_CLEAR(clear_module_state->__pyx_n_u_opt);
  Py_CLEAR(clear_module_state->__pyx_n_s_options);
  Py_CLEAR(clear_module_state->__pyx_n_u_or);
  Py_CLEAR(clear_module_state->__pyx_n_s_os_path);
  Py_CLEAR(clear_module_state->__pyx_n_s_other_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_out);
  Py_CLEAR(clear_module_state->__pyx_n_s_outfile);
  Py_CLEAR(clear_module_state->__pyx_n_s_output_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_output_parent);
  Py_CLEAR(clear_module_state->__pyx_n_s_parent);
  Py_CLEAR(clear_module_state->__pyx_n_s_parse);
  Py_CLEAR(clear_module_state->__pyx_n_u_parse);
  Py_CLEAR(clear_module_state->__pyx_n_s_parseXSL);
  Py_CLEAR(clear_module_state->__pyx_n_s_parse_options);
  Py_CLEAR(clear_module_state->__pyx_n_s_parseid);
  Py_CLEAR(clear_module_state->__pyx_n_u_parseid);
  Py_CLEAR(clear_module_state->__pyx_n_s_parser);
  Py_CLEAR(clear_module_state->__pyx_kp_u_parser_locking_failed);
  Py_CLEAR(clear_module_state->__pyx_n_s_partial);
  Py_CLEAR(clear_module_state->__pyx_kp_u_passing_a_single_string_into_fro);
  Py_CLEAR(clear_module_state->__pyx_n_s_path);
  Py_CLEAR(clear_module_state->__pyx_n_s_path_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_pcdata);
  Py_CLEAR(clear_module_state->__pyx_kp_u_pending_open_tags_on_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_pi);
  Py_CLEAR(clear_module_state->__pyx_n_u_pi);
  Py_CLEAR(clear_module_state->__pyx_n_s_pi_factory);
  Py_CLEAR(clear_module_state->__pyx_n_u_plus);
  Py_CLEAR(clear_module_state->__pyx_n_s_pop);
  Py_CLEAR(clear_module_state->__pyx_kp_u_pop_expected_at_most_2_arguments);
  Py_CLEAR(clear_module_state->__pyx_n_s_position);
  Py_CLEAR(clear_module_state->__pyx_n_s_preceding);
  Py_CLEAR(clear_module_state->__pyx_n_s_prefix);
  Py_CLEAR(clear_module_state->__pyx_kp_u_prefix_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_prefix_utf);
  Py_CLEAR(clear_module_state->__pyx_n_s_prepare);
  Py_CLEAR(clear_module_state->__pyx_n_u_preserve);
  Py_CLEAR(clear_module_state->__pyx_n_s_pretty_print);
  Py_CLEAR(clear_module_state->__pyx_n_s_print);
  Py_CLEAR(clear_module_state->__pyx_n_s_process_children);
  Py_CLEAR(clear_module_state->__pyx_n_s_profile_run);
  Py_CLEAR(clear_module_state->__pyx_n_s_property);
  Py_CLEAR(clear_module_state->__pyx_n_s_public_id);
  Py_CLEAR(clear_module_state->__pyx_n_b_py);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyucs4_encoding_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
  Py_CLEAR(clear_module_state->__pyx_n_s_qname_aware_attrs);
  Py_CLEAR(clear_module_state->__pyx_n_s_qname_aware_tags);
  Py_CLEAR(clear_module_state->__pyx_n_s_qualname);
  Py_CLEAR(clear_module_state->__pyx_kp_u_quot);
  Py_CLEAR(clear_module_state->__pyx_n_s_r);
  Py_CLEAR(clear_module_state->__pyx_n_s_raise_on_error);
  Py_CLEAR(clear_module_state->__pyx_n_s_range);
  Py_CLEAR(clear_module_state->__pyx_n_u_rb);
  Py_CLEAR(clear_module_state->__pyx_n_s_rclose);
  Py_CLEAR(clear_module_state->__pyx_n_b_rdf);
  Py_CLEAR(clear_module_state->__pyx_n_s_re);
  Py_CLEAR(clear_module_state->__pyx_n_s_read);
  Py_CLEAR(clear_module_state->__pyx_n_u_read);
  Py_CLEAR(clear_module_state->__pyx_n_s_read_events);
  Py_CLEAR(clear_module_state->__pyx_n_s_read_file);
  Py_CLEAR(clear_module_state->__pyx_n_u_read_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_read_network);
  Py_CLEAR(clear_module_state->__pyx_n_u_read_network);
  Py_CLEAR(clear_module_state->__pyx_kp_u_reading_file_objects_must_return);
  Py_CLEAR(clear_module_state->__pyx_kp_u_reading_from_file_like_objects_m);
  Py_CLEAR(clear_module_state->__pyx_n_s_receive);
  Py_CLEAR(clear_module_state->__pyx_n_s_recover);
  Py_CLEAR(clear_module_state->__pyx_kp_u_reference_to_non_existing_embedd);
  Py_CLEAR(clear_module_state->__pyx_n_s_regexp);
  Py_CLEAR(clear_module_state->__pyx_n_s_register);
  Py_CLEAR(clear_module_state->__pyx_n_s_register_namespace);
  Py_CLEAR(clear_module_state->__pyx_n_u_register_namespace);
  Py_CLEAR(clear_module_state->__pyx_n_s_register_namespaces);
  Py_CLEAR(clear_module_state->__pyx_n_s_registry);
  Py_CLEAR(clear_module_state->__pyx_n_s_relaxng);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove_blank_text);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove_comments);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove_pis);
  Py_CLEAR(clear_module_state->__pyx_n_b_replace);
  Py_CLEAR(clear_module_state->__pyx_n_s_replace);
  Py_CLEAR(clear_module_state->__pyx_n_s_replacement);
  Py_CLEAR(clear_module_state->__pyx_n_u_required);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_empty);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_entities);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_external_entities);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolve_string);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolver);
  Py_CLEAR(clear_module_state->__pyx_n_s_resolvers);
  Py_CLEAR(clear_module_state->__pyx_kp_u_restructuredtext_en);
  Py_CLEAR(clear_module_state->__pyx_n_s_result);
  Py_CLEAR(clear_module_state->__pyx_n_s_result_container);
  Py_CLEAR(clear_module_state->__pyx_n_s_result_doc);
  Py_CLEAR(clear_module_state->__pyx_n_s_result_list);
  Py_CLEAR(clear_module_state->__pyx_n_s_result_node);
  Py_CLEAR(clear_module_state->__pyx_kp_u_result_of_class_lookup_must_be_s);
  Py_CLEAR(clear_module_state->__pyx_n_s_result_tree);
  Py_CLEAR(clear_module_state->__pyx_n_s_results);
  Py_CLEAR(clear_module_state->__pyx_n_s_reversed);
  Py_CLEAR(clear_module_state->__pyx_n_s_reversed_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_reversed_nsmap);
  Py_CLEAR(clear_module_state->__pyx_n_s_rewrite_prefixes);
  Py_CLEAR(clear_module_state->__pyx_n_s_rexp);
  Py_CLEAR(clear_module_state->__pyx_n_s_rexpc);
  Py_CLEAR(clear_module_state->__pyx_kp_u_rnc);
  Py_CLEAR(clear_module_state->__pyx_n_s_rnc2rng);
  Py_CLEAR(clear_module_state->__pyx_n_s_rng_str);
  Py_CLEAR(clear_module_state->__pyx_n_s_root);
  Py_CLEAR(clear_module_state->__pyx_n_s_rsplit);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_s_4);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s_href_s_s);
  Py_CLEAR(clear_module_state->__pyx_n_s_s_match);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s_r);
  Py_CLEAR(clear_module_state->__pyx_kp_u_s_w_s_s);
  Py_CLEAR(clear_module_state->__pyx_n_s_schema);
  Py_CLEAR(clear_module_state->__pyx_n_b_script);
  Py_CLEAR(clear_module_state->__pyx_n_s_search);
  Py_CLEAR(clear_module_state->__pyx_n_s_self);
  Py_CLEAR(clear_module_state->__pyx_n_s_self_node);
  Py_CLEAR(clear_module_state->__pyx_n_s_send);
  Py_CLEAR(clear_module_state->__pyx_n_u_seq);
  Py_CLEAR(clear_module_state->__pyx_n_s_sequence_or_dict);
  Py_CLEAR(clear_module_state->__pyx_n_s_set);
  Py_CLEAR(clear_module_state->__pyx_n_s_set_default_parser);
  Py_CLEAR(clear_module_state->__pyx_n_u_set_default_parser);
  Py_CLEAR(clear_module_state->__pyx_n_s_set_element_class_lookup);
  Py_CLEAR(clear_module_state->__pyx_n_u_set_element_class_lookup);
  Py_CLEAR(clear_module_state->__pyx_n_s_set_fallback);
  Py_CLEAR(clear_module_state->__pyx_n_s_set_global_max_depth);
  Py_CLEAR(clear_module_state->__pyx_n_s_set_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_setitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_setroot);
  Py_CLEAR(clear_module_state->__pyx_n_s_setter);
  Py_CLEAR(clear_module_state->__pyx_kp_u_setting_default_namespace_is_not);
  Py_CLEAR(clear_module_state->__pyx_n_s_show);
  Py_CLEAR(clear_module_state->__pyx_n_s_sio);
  Py_CLEAR(clear_module_state->__pyx_n_s_skip_subtree);
  Py_CLEAR(clear_module_state->__pyx_n_s_smart_strings);
  Py_CLEAR(clear_module_state->__pyx_n_s_sorted);
  Py_CLEAR(clear_module_state->__pyx_n_s_source);
  Py_CLEAR(clear_module_state->__pyx_n_s_space);
  Py_CLEAR(clear_module_state->__pyx_n_s_spec);
  Py_CLEAR(clear_module_state->__pyx_n_s_split);
  Py_CLEAR(clear_module_state->__pyx_n_s_splitlines);
  Py_CLEAR(clear_module_state->__pyx_n_s_src);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_classlookup_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_cleanup_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_debug_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_docloader_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_dtd_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_etree_pyx);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_extensions_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_iterparse_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_nsclasses_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_parser_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_parsertarget_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_readonlytree_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_relaxng_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_saxparser_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_serializer_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_xmlerror_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_xmlid_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_xpath_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_xslt_pxi);
  Py_CLEAR(clear_module_state->__pyx_kp_s_src_lxml_xsltext_pxi);
  Py_CLEAR(clear_module_state->__pyx_n_s_stacklevel);
  Py_CLEAR(clear_module_state->__pyx_n_s_standalone);
  Py_CLEAR(clear_module_state->__pyx_n_s_start);
  Py_CLEAR(clear_module_state->__pyx_n_u_start);
  Py_CLEAR(clear_module_state->__pyx_kp_u_start_ns);
  Py_CLEAR(clear_module_state->__pyx_n_s_start_ns_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_startswith);
  Py_CLEAR(clear_module_state->__pyx_n_s_staticmethod);
  Py_CLEAR(clear_module_state->__pyx_n_s_stdout);
  Py_CLEAR(clear_module_state->__pyx_n_s_stop);
  Py_CLEAR(clear_module_state->__pyx_n_s_store_exception);
  Py_CLEAR(clear_module_state->__pyx_n_s_str1);
  Py_CLEAR(clear_module_state->__pyx_n_s_str2);
  Py_CLEAR(clear_module_state->__pyx_n_s_str3);
  Py_CLEAR(clear_module_state->__pyx_kp_u_string);
  Py_CLEAR(clear_module_state->__pyx_n_s_string_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_string___STRING__XSLT);
  Py_CLEAR(clear_module_state->__pyx_kp_u_string_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_strings);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip_attributes);
  Py_CLEAR(clear_module_state->__pyx_n_u_strip_attributes);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip_cdata);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip_elements);
  Py_CLEAR(clear_module_state->__pyx_n_u_strip_elements);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip_tags);
  Py_CLEAR(clear_module_state->__pyx_n_u_strip_tags);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip_text);
  Py_CLEAR(clear_module_state->__pyx_n_s_strparam);
  Py_CLEAR(clear_module_state->__pyx_n_s_strval);
  Py_CLEAR(clear_module_state->__pyx_n_b_style);
  Py_CLEAR(clear_module_state->__pyx_n_s_style);
  Py_CLEAR(clear_module_state->__pyx_n_s_sub);
  Py_CLEAR(clear_module_state->__pyx_n_s_super);
  Py_CLEAR(clear_module_state->__pyx_n_s_sys);
  Py_CLEAR(clear_module_state->__pyx_n_s_system_url);
  Py_CLEAR(clear_module_state->__pyx_n_s_tag);
  Py_CLEAR(clear_module_state->__pyx_n_s_tag_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_tag_names);
  Py_CLEAR(clear_module_state->__pyx_n_s_tags);
  Py_CLEAR(clear_module_state->__pyx_n_s_tail);
  Py_CLEAR(clear_module_state->__pyx_n_s_target);
  Py_CLEAR(clear_module_state->__pyx_n_s_tell);
  Py_CLEAR(clear_module_state->__pyx_n_u_tell);
  Py_CLEAR(clear_module_state->__pyx_n_b_test);
  Py_CLEAR(clear_module_state->__pyx_n_s_test);
  Py_CLEAR(clear_module_state->__pyx_n_s_test_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_text);
  Py_CLEAR(clear_module_state->__pyx_n_u_text);
  Py_CLEAR(clear_module_state->__pyx_n_s_text_or_uri_or_element);
  Py_CLEAR(clear_module_state->__pyx_kp_u_text_root);
  Py_CLEAR(clear_module_state->__pyx_kp_u_this_element_does_not_have_child);
  Py_CLEAR(clear_module_state->__pyx_n_s_throw);
  Py_CLEAR(clear_module_state->__pyx_kp_u_to_extended_slice_of_size);
  Py_CLEAR(clear_module_state->__pyx_n_s_top_nsmap);
  Py_CLEAR(clear_module_state->__pyx_n_s_tostring);
  Py_CLEAR(clear_module_state->__pyx_n_u_tostring);
  Py_CLEAR(clear_module_state->__pyx_n_s_tostringlist);
  Py_CLEAR(clear_module_state->__pyx_n_u_tostringlist);
  Py_CLEAR(clear_module_state->__pyx_n_s_tounicode);
  Py_CLEAR(clear_module_state->__pyx_n_u_tounicode);
  Py_CLEAR(clear_module_state->__pyx_n_s_translator);
  Py_CLEAR(clear_module_state->__pyx_n_s_tree);
  Py_CLEAR(clear_module_state->__pyx_n_s_tree_or_element);
  Py_CLEAR(clear_module_state->__pyx_n_s_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_type_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_type_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_type_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_types);
  Py_CLEAR(clear_module_state->__pyx_kp_u_undecodable_error_message);
  Py_CLEAR(clear_module_state->__pyx_n_u_undefined);
  Py_CLEAR(clear_module_state->__pyx_n_u_unicode);
  Py_CLEAR(clear_module_state->__pyx_n_u_unknown);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_encoding);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_error);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_error_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_output_method);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_XSLT_result_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_element_type_for_top);
  Py_CLEAR(clear_module_state->__pyx_n_s_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_upper);
  Py_CLEAR(clear_module_state->__pyx_n_s_uri);
  Py_CLEAR(clear_module_state->__pyx_n_s_uri_utf);
  Py_CLEAR(clear_module_state->__pyx_n_s_url);
  Py_CLEAR(clear_module_state->__pyx_n_s_use_global_python_log);
  Py_CLEAR(clear_module_state->__pyx_n_u_use_global_python_log);
  Py_CLEAR(clear_module_state->__pyx_n_u_utf8);
  Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8);
  Py_CLEAR(clear_module_state->__pyx_n_s_v);
  Py_CLEAR(clear_module_state->__pyx_n_s_validate);
  Py_CLEAR(clear_module_state->__pyx_n_s_value);
  Py_CLEAR(clear_module_state->__pyx_n_s_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_variables);
  Py_CLEAR(clear_module_state->__pyx_n_s_variables_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_version);
  Py_CLEAR(clear_module_state->__pyx_n_s_version_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_w);
  Py_CLEAR(clear_module_state->__pyx_kp_u_w_w);
  Py_CLEAR(clear_module_state->__pyx_n_s_warn);
  Py_CLEAR(clear_module_state->__pyx_n_s_warnings);
  Py_CLEAR(clear_module_state->__pyx_n_u_wb);
  Py_CLEAR(clear_module_state->__pyx_n_s_with_comments);
  Py_CLEAR(clear_module_state->__pyx_n_s_with_prefixes);
  Py_CLEAR(clear_module_state->__pyx_n_s_with_tail);
  Py_CLEAR(clear_module_state->__pyx_n_s_write);
  Py_CLEAR(clear_module_state->__pyx_n_u_write);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_c14n);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_declaration);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_doctype);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_file);
  Py_CLEAR(clear_module_state->__pyx_n_u_write_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_network);
  Py_CLEAR(clear_module_state->__pyx_n_u_write_network);
  Py_CLEAR(clear_module_state->__pyx_n_s_write_output);
  Py_CLEAR(clear_module_state->__pyx_n_s_writer);
  Py_CLEAR(clear_module_state->__pyx_n_b_wsdl);
  Py_CLEAR(clear_module_state->__pyx_n_u_x);
  Py_CLEAR(clear_module_state->__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9);
  Py_CLEAR(clear_module_state->__pyx_kp_u_x9);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xA);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xD);
  Py_CLEAR(clear_module_state->__pyx_n_s_xinclude);
  Py_CLEAR(clear_module_state->__pyx_n_b_xml);
  Py_CLEAR(clear_module_state->__pyx_n_s_xml);
  Py_CLEAR(clear_module_state->__pyx_n_u_xml);
  Py_CLEAR(clear_module_state->__pyx_n_s_xml_data);
  Py_CLEAR(clear_module_state->__pyx_n_s_xml_declaration);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xml_s_encoding_s_s_s);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xml_xml);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlfile);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlfile___aenter);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlfile___aexit);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlfile___enter);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlfile___exit);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xmlns);
  Py_CLEAR(clear_module_state->__pyx_n_b_xmlns_2);
  Py_CLEAR(clear_module_state->__pyx_n_u_xmlns_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_xmlschema);
  Py_CLEAR(clear_module_state->__pyx_n_s_xpath);
  Py_CLEAR(clear_module_state->__pyx_n_s_xpath_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_xrange);
  Py_CLEAR(clear_module_state->__pyx_n_b_xs);
  Py_CLEAR(clear_module_state->__pyx_n_u_xs);
  Py_CLEAR(clear_module_state->__pyx_n_b_xsi);
  Py_CLEAR(clear_module_state->__pyx_n_b_xsl);
  Py_CLEAR(clear_module_state->__pyx_n_u_xsl);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xsl_stylesheet_xml_id_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_xslt);
  Py_CLEAR(clear_module_state->__pyx_kp_u_xslt_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_xslt_3);
  Py_CLEAR(clear_module_state->__pyx_n_s_xslt_input);
  Py_CLEAR(clear_module_state->__pyx_n_s_zf);
  Py_CLEAR(clear_module_state->__pyx_int_0);
  Py_CLEAR(clear_module_state->__pyx_int_1);
  Py_CLEAR(clear_module_state->__pyx_int_2);
  Py_CLEAR(clear_module_state->__pyx_int_3);
  Py_CLEAR(clear_module_state->__pyx_int_4);
  Py_CLEAR(clear_module_state->__pyx_int_5);
  Py_CLEAR(clear_module_state->__pyx_int_100);
  Py_CLEAR(clear_module_state->__pyx_int_32768);
  Py_CLEAR(clear_module_state->__pyx_int_neg_1);
  Py_CLEAR(clear_module_state->__pyx_int_neg_4);
  Py_CLEAR(clear_module_state->__pyx_int_neg_100);
  Py_CLEAR(clear_module_state->__pyx_int_neg_200);
  Py_CLEAR(clear_module_state->__pyx_int_neg_300);
  Py_CLEAR(clear_module_state->__pyx_tuple_);
  Py_CLEAR(clear_module_state->__pyx_slice__6);
  Py_CLEAR(clear_module_state->__pyx_slice__7);
  Py_CLEAR(clear_module_state->__pyx_slice__8);
  Py_CLEAR(clear_module_state->__pyx_slice__9);
  Py_CLEAR(clear_module_state->__pyx_tuple__2);
  Py_CLEAR(clear_module_state->__pyx_tuple__5);
  Py_CLEAR(clear_module_state->__pyx_slice__44);
  Py_CLEAR(clear_module_state->__pyx_slice__55);
  Py_CLEAR(clear_module_state->__pyx_slice__69);
  Py_CLEAR(clear_module_state->__pyx_slice__80);
  Py_CLEAR(clear_module_state->__pyx_slice__81);
  Py_CLEAR(clear_module_state->__pyx_slice__93);
  Py_CLEAR(clear_module_state->__pyx_slice__94);
  Py_CLEAR(clear_module_state->__pyx_tuple__10);
  Py_CLEAR(clear_module_state->__pyx_tuple__13);
  Py_CLEAR(clear_module_state->__pyx_tuple__14);
  Py_CLEAR(clear_module_state->__pyx_tuple__15);
  Py_CLEAR(clear_module_state->__pyx_tuple__16);
  Py_CLEAR(clear_module_state->__pyx_tuple__23);
  Py_CLEAR(clear_module_state->__pyx_tuple__27);
  Py_CLEAR(clear_module_state->__pyx_tuple__31);
  Py_CLEAR(clear_module_state->__pyx_tuple__36);
  Py_CLEAR(clear_module_state->__pyx_tuple__37);
  Py_CLEAR(clear_module_state->__pyx_tuple__38);
  Py_CLEAR(clear_module_state->__pyx_tuple__39);
  Py_CLEAR(clear_module_state->__pyx_tuple__40);
  Py_CLEAR(clear_module_state->__pyx_tuple__46);
  Py_CLEAR(clear_module_state->__pyx_tuple__47);
  Py_CLEAR(clear_module_state->__pyx_tuple__49);
  Py_CLEAR(clear_module_state->__pyx_tuple__51);
  Py_CLEAR(clear_module_state->__pyx_tuple__53);
  Py_CLEAR(clear_module_state->__pyx_tuple__54);
  Py_CLEAR(clear_module_state->__pyx_tuple__58);
  Py_CLEAR(clear_module_state->__pyx_tuple__59);
  Py_CLEAR(clear_module_state->__pyx_tuple__60);
  Py_CLEAR(clear_module_state->__pyx_tuple__64);
  Py_CLEAR(clear_module_state->__pyx_tuple__65);
  Py_CLEAR(clear_module_state->__pyx_tuple__66);
  Py_CLEAR(clear_module_state->__pyx_tuple__68);
  Py_CLEAR(clear_module_state->__pyx_tuple__70);
  Py_CLEAR(clear_module_state->__pyx_tuple__77);
  Py_CLEAR(clear_module_state->__pyx_tuple__78);
  Py_CLEAR(clear_module_state->__pyx_tuple__91);
  Py_CLEAR(clear_module_state->__pyx_tuple__92);
  Py_CLEAR(clear_module_state->__pyx_tuple__97);
  Py_CLEAR(clear_module_state->__pyx_tuple__98);
  Py_CLEAR(clear_module_state->__pyx_slice__105);
  Py_CLEAR(clear_module_state->__pyx_tuple__103);
  Py_CLEAR(clear_module_state->__pyx_tuple__104);
  Py_CLEAR(clear_module_state->__pyx_tuple__107);
  Py_CLEAR(clear_module_state->__pyx_tuple__109);
  Py_CLEAR(clear_module_state->__pyx_tuple__113);
  Py_CLEAR(clear_module_state->__pyx_tuple__116);
  Py_CLEAR(clear_module_state->__pyx_tuple__117);
  Py_CLEAR(clear_module_state->__pyx_tuple__118);
  Py_CLEAR(clear_module_state->__pyx_tuple__120);
  Py_CLEAR(clear_module_state->__pyx_tuple__123);
  Py_CLEAR(clear_module_state->__pyx_tuple__126);
  Py_CLEAR(clear_module_state->__pyx_tuple__128);
  Py_CLEAR(clear_module_state->__pyx_tuple__130);
  Py_CLEAR(clear_module_state->__pyx_tuple__132);
  Py_CLEAR(clear_module_state->__pyx_tuple__137);
  Py_CLEAR(clear_module_state->__pyx_tuple__145);
  Py_CLEAR(clear_module_state->__pyx_tuple__147);
  Py_CLEAR(clear_module_state->__pyx_tuple__149);
  Py_CLEAR(clear_module_state->__pyx_tuple__151);
  Py_CLEAR(clear_module_state->__pyx_tuple__152);
  Py_CLEAR(clear_module_state->__pyx_tuple__153);
  Py_CLEAR(clear_module_state->__pyx_tuple__154);
  Py_CLEAR(clear_module_state->__pyx_tuple__155);
  Py_CLEAR(clear_module_state->__pyx_tuple__156);
  Py_CLEAR(clear_module_state->__pyx_tuple__157);
  Py_CLEAR(clear_module_state->__pyx_tuple__158);
  Py_CLEAR(clear_module_state->__pyx_tuple__159);
  Py_CLEAR(clear_module_state->__pyx_tuple__160);
  Py_CLEAR(clear_module_state->__pyx_tuple__163);
  Py_CLEAR(clear_module_state->__pyx_tuple__165);
  Py_CLEAR(clear_module_state->__pyx_tuple__168);
  Py_CLEAR(clear_module_state->__pyx_tuple__172);
  Py_CLEAR(clear_module_state->__pyx_tuple__174);
  Py_CLEAR(clear_module_state->__pyx_tuple__176);
  Py_CLEAR(clear_module_state->__pyx_tuple__177);
  Py_CLEAR(clear_module_state->__pyx_tuple__179);
  Py_CLEAR(clear_module_state->__pyx_tuple__181);
  Py_CLEAR(clear_module_state->__pyx_tuple__184);
  Py_CLEAR(clear_module_state->__pyx_tuple__186);
  Py_CLEAR(clear_module_state->__pyx_tuple__187);
  Py_CLEAR(clear_module_state->__pyx_tuple__189);
  Py_CLEAR(clear_module_state->__pyx_tuple__194);
  Py_CLEAR(clear_module_state->__pyx_tuple__198);
  Py_CLEAR(clear_module_state->__pyx_tuple__200);
  Py_CLEAR(clear_module_state->__pyx_tuple__203);
  Py_CLEAR(clear_module_state->__pyx_tuple__208);
  Py_CLEAR(clear_module_state->__pyx_tuple__210);
  Py_CLEAR(clear_module_state->__pyx_tuple__212);
  Py_CLEAR(clear_module_state->__pyx_tuple__214);
  Py_CLEAR(clear_module_state->__pyx_tuple__218);
  Py_CLEAR(clear_module_state->__pyx_tuple__220);
  Py_CLEAR(clear_module_state->__pyx_tuple__223);
  Py_CLEAR(clear_module_state->__pyx_tuple__225);
  Py_CLEAR(clear_module_state->__pyx_tuple__232);
  Py_CLEAR(clear_module_state->__pyx_tuple__234);
  Py_CLEAR(clear_module_state->__pyx_tuple__238);
  Py_CLEAR(clear_module_state->__pyx_tuple__240);
  Py_CLEAR(clear_module_state->__pyx_tuple__242);
  Py_CLEAR(clear_module_state->__pyx_tuple__244);
  Py_CLEAR(clear_module_state->__pyx_tuple__246);
  Py_CLEAR(clear_module_state->__pyx_tuple__249);
  Py_CLEAR(clear_module_state->__pyx_tuple__251);
  Py_CLEAR(clear_module_state->__pyx_tuple__256);
  Py_CLEAR(clear_module_state->__pyx_tuple__258);
  Py_CLEAR(clear_module_state->__pyx_tuple__260);
  Py_CLEAR(clear_module_state->__pyx_tuple__263);
  Py_CLEAR(clear_module_state->__pyx_tuple__265);
  Py_CLEAR(clear_module_state->__pyx_tuple__267);
  Py_CLEAR(clear_module_state->__pyx_tuple__269);
  Py_CLEAR(clear_module_state->__pyx_tuple__281);
  Py_CLEAR(clear_module_state->__pyx_tuple__283);
  Py_CLEAR(clear_module_state->__pyx_tuple__285);
  Py_CLEAR(clear_module_state->__pyx_tuple__287);
  Py_CLEAR(clear_module_state->__pyx_tuple__289);
  Py_CLEAR(clear_module_state->__pyx_tuple__291);
  Py_CLEAR(clear_module_state->__pyx_tuple__293);
  Py_CLEAR(clear_module_state->__pyx_tuple__297);
  Py_CLEAR(clear_module_state->__pyx_tuple__299);
  Py_CLEAR(clear_module_state->__pyx_tuple__301);
  Py_CLEAR(clear_module_state->__pyx_tuple__303);
  Py_CLEAR(clear_module_state->__pyx_tuple__304);
  Py_CLEAR(clear_module_state->__pyx_tuple__306);
  Py_CLEAR(clear_module_state->__pyx_tuple__308);
  Py_CLEAR(clear_module_state->__pyx_tuple__310);
  Py_CLEAR(clear_module_state->__pyx_tuple__312);
  Py_CLEAR(clear_module_state->__pyx_tuple__314);
  Py_CLEAR(clear_module_state->__pyx_tuple__318);
  Py_CLEAR(clear_module_state->__pyx_tuple__321);
  Py_CLEAR(clear_module_state->__pyx_tuple__329);
  Py_CLEAR(clear_module_state->__pyx_tuple__334);
  Py_CLEAR(clear_module_state->__pyx_tuple__336);
  Py_CLEAR(clear_module_state->__pyx_tuple__338);
  Py_CLEAR(clear_module_state->__pyx_tuple__340);
  Py_CLEAR(clear_module_state->__pyx_tuple__342);
  Py_CLEAR(clear_module_state->__pyx_tuple__347);
  Py_CLEAR(clear_module_state->__pyx_tuple__349);
  Py_CLEAR(clear_module_state->__pyx_tuple__351);
  Py_CLEAR(clear_module_state->__pyx_tuple__353);
  Py_CLEAR(clear_module_state->__pyx_tuple__355);
  Py_CLEAR(clear_module_state->__pyx_tuple__357);
  Py_CLEAR(clear_module_state->__pyx_tuple__359);
  Py_CLEAR(clear_module_state->__pyx_tuple__361);
  Py_CLEAR(clear_module_state->__pyx_tuple__363);
  Py_CLEAR(clear_module_state->__pyx_tuple__367);
  Py_CLEAR(clear_module_state->__pyx_tuple__369);
  Py_CLEAR(clear_module_state->__pyx_tuple__372);
  Py_CLEAR(clear_module_state->__pyx_tuple__377);
  Py_CLEAR(clear_module_state->__pyx_tuple__381);
  Py_CLEAR(clear_module_state->__pyx_tuple__385);
  Py_CLEAR(clear_module_state->__pyx_tuple__389);
  Py_CLEAR(clear_module_state->__pyx_tuple__391);
  Py_CLEAR(clear_module_state->__pyx_tuple__393);
  Py_CLEAR(clear_module_state->__pyx_tuple__395);
  Py_CLEAR(clear_module_state->__pyx_tuple__397);
  Py_CLEAR(clear_module_state->__pyx_tuple__399);
  Py_CLEAR(clear_module_state->__pyx_tuple__400);
  Py_CLEAR(clear_module_state->__pyx_tuple__401);
  Py_CLEAR(clear_module_state->__pyx_tuple__403);
  Py_CLEAR(clear_module_state->__pyx_tuple__405);
  Py_CLEAR(clear_module_state->__pyx_tuple__407);
  Py_CLEAR(clear_module_state->__pyx_tuple__409);
  Py_CLEAR(clear_module_state->__pyx_tuple__411);
  Py_CLEAR(clear_module_state->__pyx_tuple__416);
  Py_CLEAR(clear_module_state->__pyx_tuple__418);
  Py_CLEAR(clear_module_state->__pyx_tuple__420);
  Py_CLEAR(clear_module_state->__pyx_tuple__422);
  Py_CLEAR(clear_module_state->__pyx_tuple__424);
  Py_CLEAR(clear_module_state->__pyx_tuple__426);
  Py_CLEAR(clear_module_state->__pyx_tuple__431);
  Py_CLEAR(clear_module_state->__pyx_tuple__432);
  Py_CLEAR(clear_module_state->__pyx_tuple__433);
  Py_CLEAR(clear_module_state->__pyx_tuple__434);
  Py_CLEAR(clear_module_state->__pyx_tuple__436);
  Py_CLEAR(clear_module_state->__pyx_tuple__438);
  Py_CLEAR(clear_module_state->__pyx_tuple__439);
  Py_CLEAR(clear_module_state->__pyx_tuple__441);
  Py_CLEAR(clear_module_state->__pyx_tuple__448);
  Py_CLEAR(clear_module_state->__pyx_tuple__450);
  Py_CLEAR(clear_module_state->__pyx_tuple__452);
  Py_CLEAR(clear_module_state->__pyx_tuple__455);
  Py_CLEAR(clear_module_state->__pyx_tuple__462);
  Py_CLEAR(clear_module_state->__pyx_tuple__465);
  Py_CLEAR(clear_module_state->__pyx_tuple__467);
  Py_CLEAR(clear_module_state->__pyx_tuple__469);
  Py_CLEAR(clear_module_state->__pyx_tuple__471);
  Py_CLEAR(clear_module_state->__pyx_tuple__473);
  Py_CLEAR(clear_module_state->__pyx_tuple__474);
  Py_CLEAR(clear_module_state->__pyx_tuple__476);
  Py_CLEAR(clear_module_state->__pyx_tuple__478);
  Py_CLEAR(clear_module_state->__pyx_tuple__479);
  Py_CLEAR(clear_module_state->__pyx_tuple__481);
  Py_CLEAR(clear_module_state->__pyx_tuple__485);
  Py_CLEAR(clear_module_state->__pyx_tuple__487);
  Py_CLEAR(clear_module_state->__pyx_tuple__490);
  Py_CLEAR(clear_module_state->__pyx_tuple__492);
  Py_CLEAR(clear_module_state->__pyx_tuple__493);
  Py_CLEAR(clear_module_state->__pyx_tuple__495);
  Py_CLEAR(clear_module_state->__pyx_tuple__497);
  Py_CLEAR(clear_module_state->__pyx_tuple__501);
  Py_CLEAR(clear_module_state->__pyx_tuple__503);
  Py_CLEAR(clear_module_state->__pyx_tuple__504);
  Py_CLEAR(clear_module_state->__pyx_tuple__506);
  Py_CLEAR(clear_module_state->__pyx_tuple__508);
  Py_CLEAR(clear_module_state->__pyx_tuple__510);
  Py_CLEAR(clear_module_state->__pyx_tuple__512);
  Py_CLEAR(clear_module_state->__pyx_tuple__514);
  Py_CLEAR(clear_module_state->__pyx_tuple__518);
  Py_CLEAR(clear_module_state->__pyx_tuple__522);
  Py_CLEAR(clear_module_state->__pyx_tuple__526);
  Py_CLEAR(clear_module_state->__pyx_tuple__528);
  Py_CLEAR(clear_module_state->__pyx_tuple__531);
  Py_CLEAR(clear_module_state->__pyx_tuple__533);
  Py_CLEAR(clear_module_state->__pyx_tuple__535);
  Py_CLEAR(clear_module_state->__pyx_codeobj__62);
  Py_CLEAR(clear_module_state->__pyx_codeobj__67);
  Py_CLEAR(clear_module_state->__pyx_codeobj__76);
  Py_CLEAR(clear_module_state->__pyx_codeobj__79);
  Py_CLEAR(clear_module_state->__pyx_codeobj__82);
  Py_CLEAR(clear_module_state->__pyx_codeobj__83);
  Py_CLEAR(clear_module_state->__pyx_codeobj__84);
  Py_CLEAR(clear_module_state->__pyx_codeobj__85);
  Py_CLEAR(clear_module_state->__pyx_codeobj__86);
  Py_CLEAR(clear_module_state->__pyx_codeobj__87);
  Py_CLEAR(clear_module_state->__pyx_codeobj__88);
  Py_CLEAR(clear_module_state->__pyx_codeobj__89);
  Py_CLEAR(clear_module_state->__pyx_codeobj__90);
  Py_CLEAR(clear_module_state->__pyx_codeobj__99);
  Py_CLEAR(clear_module_state->__pyx_codeobj__100);
  Py_CLEAR(clear_module_state->__pyx_codeobj__101);
  Py_CLEAR(clear_module_state->__pyx_codeobj__102);
  Py_CLEAR(clear_module_state->__pyx_codeobj__108);
  Py_CLEAR(clear_module_state->__pyx_codeobj__110);
  Py_CLEAR(clear_module_state->__pyx_codeobj__111);
  Py_CLEAR(clear_module_state->__pyx_codeobj__112);
  Py_CLEAR(clear_module_state->__pyx_codeobj__114);
  Py_CLEAR(clear_module_state->__pyx_codeobj__115);
  Py_CLEAR(clear_module_state->__pyx_codeobj__119);
  Py_CLEAR(clear_module_state->__pyx_codeobj__121);
  Py_CLEAR(clear_module_state->__pyx_codeobj__122);
  Py_CLEAR(clear_module_state->__pyx_codeobj__124);
  Py_CLEAR(clear_module_state->__pyx_codeobj__125);
  Py_CLEAR(clear_module_state->__pyx_codeobj__127);
  Py_CLEAR(clear_module_state->__pyx_codeobj__129);
  Py_CLEAR(clear_module_state->__pyx_codeobj__131);
  Py_CLEAR(clear_module_state->__pyx_codeobj__133);
  Py_CLEAR(clear_module_state->__pyx_codeobj__134);
  Py_CLEAR(clear_module_state->__pyx_codeobj__135);
  Py_CLEAR(clear_module_state->__pyx_codeobj__136);
  Py_CLEAR(clear_module_state->__pyx_codeobj__138);
  Py_CLEAR(clear_module_state->__pyx_codeobj__139);
  Py_CLEAR(clear_module_state->__pyx_codeobj__140);
  Py_CLEAR(clear_module_state->__pyx_codeobj__141);
  Py_CLEAR(clear_module_state->__pyx_codeobj__142);
  Py_CLEAR(clear_module_state->__pyx_codeobj__143);
  Py_CLEAR(clear_module_state->__pyx_codeobj__144);
  Py_CLEAR(clear_module_state->__pyx_codeobj__146);
  Py_CLEAR(clear_module_state->__pyx_codeobj__148);
  Py_CLEAR(clear_module_state->__pyx_codeobj__150);
  Py_CLEAR(clear_module_state->__pyx_codeobj__161);
  Py_CLEAR(clear_module_state->__pyx_codeobj__162);
  Py_CLEAR(clear_module_state->__pyx_codeobj__164);
  Py_CLEAR(clear_module_state->__pyx_codeobj__166);
  Py_CLEAR(clear_module_state->__pyx_codeobj__167);
  Py_CLEAR(clear_module_state->__pyx_codeobj__169);
  Py_CLEAR(clear_module_state->__pyx_codeobj__170);
  Py_CLEAR(clear_module_state->__pyx_codeobj__171);
  Py_CLEAR(clear_module_state->__pyx_codeobj__173);
  Py_CLEAR(clear_module_state->__pyx_codeobj__175);
  Py_CLEAR(clear_module_state->__pyx_codeobj__178);
  Py_CLEAR(clear_module_state->__pyx_codeobj__180);
  Py_CLEAR(clear_module_state->__pyx_codeobj__182);
  Py_CLEAR(clear_module_state->__pyx_codeobj__183);
  Py_CLEAR(clear_module_state->__pyx_codeobj__185);
  Py_CLEAR(clear_module_state->__pyx_codeobj__188);
  Py_CLEAR(clear_module_state->__pyx_codeobj__190);
  Py_CLEAR(clear_module_state->__pyx_codeobj__191);
  Py_CLEAR(clear_module_state->__pyx_codeobj__192);
  Py_CLEAR(clear_module_state->__pyx_codeobj__193);
  Py_CLEAR(clear_module_state->__pyx_codeobj__195);
  Py_CLEAR(clear_module_state->__pyx_codeobj__196);
  Py_CLEAR(clear_module_state->__pyx_codeobj__197);
  Py_CLEAR(clear_module_state->__pyx_codeobj__199);
  Py_CLEAR(clear_module_state->__pyx_codeobj__201);
  Py_CLEAR(clear_module_state->__pyx_codeobj__202);
  Py_CLEAR(clear_module_state->__pyx_codeobj__204);
  Py_CLEAR(clear_module_state->__pyx_codeobj__205);
  Py_CLEAR(clear_module_state->__pyx_codeobj__206);
  Py_CLEAR(clear_module_state->__pyx_codeobj__207);
  Py_CLEAR(clear_module_state->__pyx_codeobj__209);
  Py_CLEAR(clear_module_state->__pyx_codeobj__211);
  Py_CLEAR(clear_module_state->__pyx_codeobj__213);
  Py_CLEAR(clear_module_state->__pyx_codeobj__215);
  Py_CLEAR(clear_module_state->__pyx_codeobj__216);
  Py_CLEAR(clear_module_state->__pyx_codeobj__217);
  Py_CLEAR(clear_module_state->__pyx_codeobj__219);
  Py_CLEAR(clear_module_state->__pyx_codeobj__221);
  Py_CLEAR(clear_module_state->__pyx_codeobj__222);
  Py_CLEAR(clear_module_state->__pyx_codeobj__224);
  Py_CLEAR(clear_module_state->__pyx_codeobj__226);
  Py_CLEAR(clear_module_state->__pyx_codeobj__227);
  Py_CLEAR(clear_module_state->__pyx_codeobj__228);
  Py_CLEAR(clear_module_state->__pyx_codeobj__229);
  Py_CLEAR(clear_module_state->__pyx_codeobj__230);
  Py_CLEAR(clear_module_state->__pyx_codeobj__231);
  Py_CLEAR(clear_module_state->__pyx_codeobj__233);
  Py_CLEAR(clear_module_state->__pyx_codeobj__235);
  Py_CLEAR(clear_module_state->__pyx_codeobj__236);
  Py_CLEAR(clear_module_state->__pyx_codeobj__237);
  Py_CLEAR(clear_module_state->__pyx_codeobj__239);
  Py_CLEAR(clear_module_state->__pyx_codeobj__241);
  Py_CLEAR(clear_module_state->__pyx_codeobj__243);
  Py_CLEAR(clear_module_state->__pyx_codeobj__245);
  Py_CLEAR(clear_module_state->__pyx_codeobj__247);
  Py_CLEAR(clear_module_state->__pyx_codeobj__248);
  Py_CLEAR(clear_module_state->__pyx_codeobj__250);
  Py_CLEAR(clear_module_state->__pyx_codeobj__252);
  Py_CLEAR(clear_module_state->__pyx_codeobj__253);
  Py_CLEAR(clear_module_state->__pyx_codeobj__254);
  Py_CLEAR(clear_module_state->__pyx_codeobj__255);
  Py_CLEAR(clear_module_state->__pyx_codeobj__257);
  Py_CLEAR(clear_module_state->__pyx_codeobj__259);
  Py_CLEAR(clear_module_state->__pyx_codeobj__261);
  Py_CLEAR(clear_module_state->__pyx_codeobj__262);
  Py_CLEAR(clear_module_state->__pyx_codeobj__264);
  Py_CLEAR(clear_module_state->__pyx_codeobj__266);
  Py_CLEAR(clear_module_state->__pyx_codeobj__268);
  Py_CLEAR(clear_module_state->__pyx_codeobj__270);
  Py_CLEAR(clear_module_state->__pyx_codeobj__271);
  Py_CLEAR(clear_module_state->__pyx_codeobj__272);
  Py_CLEAR(clear_module_state->__pyx_codeobj__273);
  Py_CLEAR(clear_module_state->__pyx_codeobj__274);
  Py_CLEAR(clear_module_state->__pyx_codeobj__275);
  Py_CLEAR(clear_module_state->__pyx_codeobj__276);
  Py_CLEAR(clear_module_state->__pyx_codeobj__277);
  Py_CLEAR(clear_module_state->__pyx_codeobj__278);
  Py_CLEAR(clear_module_state->__pyx_codeobj__279);
  Py_CLEAR(clear_module_state->__pyx_codeobj__280);
  Py_CLEAR(clear_module_state->__pyx_codeobj__282);
  Py_CLEAR(clear_module_state->__pyx_codeobj__284);
  Py_CLEAR(clear_module_state->__pyx_codeobj__286);
  Py_CLEAR(clear_module_state->__pyx_codeobj__288);
  Py_CLEAR(clear_module_state->__pyx_codeobj__290);
  Py_CLEAR(clear_module_state->__pyx_codeobj__292);
  Py_CLEAR(clear_module_state->__pyx_codeobj__294);
  Py_CLEAR(clear_module_state->__pyx_codeobj__295);
  Py_CLEAR(clear_module_state->__pyx_codeobj__296);
  Py_CLEAR(clear_module_state->__pyx_codeobj__298);
  Py_CLEAR(clear_module_state->__pyx_codeobj__300);
  Py_CLEAR(clear_module_state->__pyx_codeobj__302);
  Py_CLEAR(clear_module_state->__pyx_codeobj__305);
  Py_CLEAR(clear_module_state->__pyx_codeobj__307);
  Py_CLEAR(clear_module_state->__pyx_codeobj__309);
  Py_CLEAR(clear_module_state->__pyx_codeobj__311);
  Py_CLEAR(clear_module_state->__pyx_codeobj__313);
  Py_CLEAR(clear_module_state->__pyx_codeobj__315);
  Py_CLEAR(clear_module_state->__pyx_codeobj__316);
  Py_CLEAR(clear_module_state->__pyx_codeobj__317);
  Py_CLEAR(clear_module_state->__pyx_codeobj__319);
  Py_CLEAR(clear_module_state->__pyx_codeobj__320);
  Py_CLEAR(clear_module_state->__pyx_codeobj__322);
  Py_CLEAR(clear_module_state->__pyx_codeobj__323);
  Py_CLEAR(clear_module_state->__pyx_codeobj__324);
  Py_CLEAR(clear_module_state->__pyx_codeobj__325);
  Py_CLEAR(clear_module_state->__pyx_codeobj__326);
  Py_CLEAR(clear_module_state->__pyx_codeobj__327);
  Py_CLEAR(clear_module_state->__pyx_codeobj__328);
  Py_CLEAR(clear_module_state->__pyx_codeobj__330);
  Py_CLEAR(clear_module_state->__pyx_codeobj__331);
  Py_CLEAR(clear_module_state->__pyx_codeobj__332);
  Py_CLEAR(clear_module_state->__pyx_codeobj__333);
  Py_CLEAR(clear_module_state->__pyx_codeobj__335);
  Py_CLEAR(clear_module_state->__pyx_codeobj__337);
  Py_CLEAR(clear_module_state->__pyx_codeobj__339);
  Py_CLEAR(clear_module_state->__pyx_codeobj__341);
  Py_CLEAR(clear_module_state->__pyx_codeobj__343);
  Py_CLEAR(clear_module_state->__pyx_codeobj__344);
  Py_CLEAR(clear_module_state->__pyx_codeobj__345);
  Py_CLEAR(clear_module_state->__pyx_codeobj__346);
  Py_CLEAR(clear_module_state->__pyx_codeobj__348);
  Py_CLEAR(clear_module_state->__pyx_codeobj__350);
  Py_CLEAR(clear_module_state->__pyx_codeobj__352);
  Py_CLEAR(clear_module_state->__pyx_codeobj__354);
  Py_CLEAR(clear_module_state->__pyx_codeobj__356);
  Py_CLEAR(clear_module_state->__pyx_codeobj__358);
  Py_CLEAR(clear_module_state->__pyx_codeobj__360);
  Py_CLEAR(clear_module_state->__pyx_codeobj__362);
  Py_CLEAR(clear_module_state->__pyx_codeobj__364);
  Py_CLEAR(clear_module_state->__pyx_codeobj__365);
  Py_CLEAR(clear_module_state->__pyx_codeobj__366);
  Py_CLEAR(clear_module_state->__pyx_codeobj__368);
  Py_CLEAR(clear_module_state->__pyx_codeobj__370);
  Py_CLEAR(clear_module_state->__pyx_codeobj__371);
  Py_CLEAR(clear_module_state->__pyx_codeobj__373);
  Py_CLEAR(clear_module_state->__pyx_codeobj__374);
  Py_CLEAR(clear_module_state->__pyx_codeobj__375);
  Py_CLEAR(clear_module_state->__pyx_codeobj__376);
  Py_CLEAR(clear_module_state->__pyx_codeobj__378);
  Py_CLEAR(clear_module_state->__pyx_codeobj__379);
  Py_CLEAR(clear_module_state->__pyx_codeobj__380);
  Py_CLEAR(clear_module_state->__pyx_codeobj__382);
  Py_CLEAR(clear_module_state->__pyx_codeobj__383);
  Py_CLEAR(clear_module_state->__pyx_codeobj__384);
  Py_CLEAR(clear_module_state->__pyx_codeobj__386);
  Py_CLEAR(clear_module_state->__pyx_codeobj__387);
  Py_CLEAR(clear_module_state->__pyx_codeobj__388);
  Py_CLEAR(clear_module_state->__pyx_codeobj__390);
  Py_CLEAR(clear_module_state->__pyx_codeobj__392);
  Py_CLEAR(clear_module_state->__pyx_codeobj__394);
  Py_CLEAR(clear_module_state->__pyx_codeobj__396);
  Py_CLEAR(clear_module_state->__pyx_codeobj__398);
  Py_CLEAR(clear_module_state->__pyx_codeobj__402);
  Py_CLEAR(clear_module_state->__pyx_codeobj__404);
  Py_CLEAR(clear_module_state->__pyx_codeobj__406);
  Py_CLEAR(clear_module_state->__pyx_codeobj__408);
  Py_CLEAR(clear_module_state->__pyx_codeobj__410);
  Py_CLEAR(clear_module_state->__pyx_codeobj__412);
  Py_CLEAR(clear_module_state->__pyx_codeobj__413);
  Py_CLEAR(clear_module_state->__pyx_codeobj__414);
  Py_CLEAR(clear_module_state->__pyx_codeobj__415);
  Py_CLEAR(clear_module_state->__pyx_codeobj__417);
  Py_CLEAR(clear_module_state->__pyx_codeobj__419);
  Py_CLEAR(clear_module_state->__pyx_codeobj__421);
  Py_CLEAR(clear_module_state->__pyx_codeobj__423);
  Py_CLEAR(clear_module_state->__pyx_codeobj__425);
  Py_CLEAR(clear_module_state->__pyx_codeobj__427);
  Py_CLEAR(clear_module_state->__pyx_codeobj__428);
  Py_CLEAR(clear_module_state->__pyx_codeobj__429);
  Py_CLEAR(clear_module_state->__pyx_codeobj__430);
  Py_CLEAR(clear_module_state->__pyx_codeobj__435);
  Py_CLEAR(clear_module_state->__pyx_codeobj__437);
  Py_CLEAR(clear_module_state->__pyx_codeobj__440);
  Py_CLEAR(clear_module_state->__pyx_codeobj__442);
  Py_CLEAR(clear_module_state->__pyx_codeobj__443);
  Py_CLEAR(clear_module_state->__pyx_codeobj__444);
  Py_CLEAR(clear_module_state->__pyx_codeobj__445);
  Py_CLEAR(clear_module_state->__pyx_codeobj__446);
  Py_CLEAR(clear_module_state->__pyx_codeobj__447);
  Py_CLEAR(clear_module_state->__pyx_codeobj__449);
  Py_CLEAR(clear_module_state->__pyx_codeobj__451);
  Py_CLEAR(clear_module_state->__pyx_codeobj__453);
  Py_CLEAR(clear_module_state->__pyx_codeobj__454);
  Py_CLEAR(clear_module_state->__pyx_codeobj__456);
  Py_CLEAR(clear_module_state->__pyx_codeobj__457);
  Py_CLEAR(clear_module_state->__pyx_codeobj__458);
  Py_CLEAR(clear_module_state->__pyx_codeobj__459);
  Py_CLEAR(clear_module_state->__pyx_codeobj__460);
  Py_CLEAR(clear_module_state->__pyx_codeobj__461);
  Py_CLEAR(clear_module_state->__pyx_codeobj__463);
  Py_CLEAR(clear_module_state->__pyx_codeobj__464);
  Py_CLEAR(clear_module_state->__pyx_codeobj__466);
  Py_CLEAR(clear_module_state->__pyx_codeobj__468);
  Py_CLEAR(clear_module_state->__pyx_codeobj__470);
  Py_CLEAR(clear_module_state->__pyx_codeobj__472);
  Py_CLEAR(clear_module_state->__pyx_codeobj__475);
  Py_CLEAR(clear_module_state->__pyx_codeobj__477);
  Py_CLEAR(clear_module_state->__pyx_codeobj__480);
  Py_CLEAR(clear_module_state->__pyx_codeobj__482);
  Py_CLEAR(clear_module_state->__pyx_codeobj__483);
  Py_CLEAR(clear_module_state->__pyx_codeobj__484);
  Py_CLEAR(clear_module_state->__pyx_codeobj__486);
  Py_CLEAR(clear_module_state->__pyx_codeobj__488);
  Py_CLEAR(clear_module_state->__pyx_codeobj__494);
  Py_CLEAR(clear_module_state->__pyx_codeobj__496);
  Py_CLEAR(clear_module_state->__pyx_codeobj__498);
  Py_CLEAR(clear_module_state->__pyx_codeobj__499);
  Py_CLEAR(clear_module_state->__pyx_codeobj__500);
  Py_CLEAR(clear_module_state->__pyx_codeobj__502);
  Py_CLEAR(clear_module_state->__pyx_codeobj__505);
  Py_CLEAR(clear_module_state->__pyx_codeobj__507);
  Py_CLEAR(clear_module_state->__pyx_codeobj__509);
  Py_CLEAR(clear_module_state->__pyx_codeobj__511);
  Py_CLEAR(clear_module_state->__pyx_codeobj__513);
  Py_CLEAR(clear_module_state->__pyx_codeobj__515);
  Py_CLEAR(clear_module_state->__pyx_codeobj__516);
  Py_CLEAR(clear_module_state->__pyx_codeobj__517);
  Py_CLEAR(clear_module_state->__pyx_codeobj__519);
  Py_CLEAR(clear_module_state->__pyx_codeobj__520);
  Py_CLEAR(clear_module_state->__pyx_codeobj__521);
  Py_CLEAR(clear_module_state->__pyx_codeobj__523);
  Py_CLEAR(clear_module_state->__pyx_codeobj__524);
  Py_CLEAR(clear_module_state->__pyx_codeobj__525);
  Py_CLEAR(clear_module_state->__pyx_codeobj__527);
  Py_CLEAR(clear_module_state->__pyx_codeobj__529);
  Py_CLEAR(clear_module_state->__pyx_codeobj__530);
  Py_CLEAR(clear_module_state->__pyx_codeobj__532);
  Py_CLEAR(clear_module_state->__pyx_codeobj__534);
  Py_CLEAR(clear_module_state->__pyx_codeobj__536);
  return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstate *traverse_module_state = __pyx_mstate(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  Py_VISIT(traverse_module_state->__pyx_empty_tuple);
  Py_VISIT(traverse_module_state->__pyx_empty_bytes);
  Py_VISIT(traverse_module_state->__pyx_empty_unicode);
  #ifdef __Pyx_CyFunction_USED
  Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
  #endif
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Error);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Error);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_C14NError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_C14NError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__TempStore);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__TempStore);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ExceptionContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ExceptionContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__LogEntry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__LogEntry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ListErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ListErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ErrorLogContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ErrorLogContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DomainErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DomainErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__RotatingErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__RotatingErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Document);
  Py_VISIT(traverse_module_state->LxmlDocumentType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DocInfo);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DocInfo);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Element);
  Py_VISIT(traverse_module_state->LxmlElementType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___ContentOnlyElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___ContentOnlyElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Comment);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Comment);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Entity);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Entity);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_QName);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_QName);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementTree);
  Py_VISIT(traverse_module_state->LxmlElementTreeType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Attrib);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Attrib);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AttribIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AttribIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementTagMatcher);
  Py_VISIT(traverse_module_state->LxmlElementTagMatcherType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementIterator);
  Py_VISIT(traverse_module_state->LxmlElementIteratorType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MultiTagMatcher);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MultiTagMatcher);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementMatchIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ElementMatchIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementChildIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementChildIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SiblingsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SiblingsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_AncestorsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_AncestorsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementDepthFirstIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementTextIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementTextIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CDATA);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CDATA);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ReadOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__OpaqueNodeWrapper);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__OpaqueDocumentWrapper);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AppendOnlyElementProxy);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementBase);
  Py_VISIT(traverse_module_state->LxmlElementBaseType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PIBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PIBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementClassLookup);
  Py_VISIT(traverse_module_state->LxmlElementClassLookupType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);
  Py_VISIT(traverse_module_state->LxmlFallbackElementClassLookupType);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__NamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__NamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ClassNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__InputDocument);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__InputDocument);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Resolver);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Resolver);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ResolverRegistry);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ResolverRegistry);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ResolverContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ResolverContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ParserError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ParserError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserDictionaryContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserDictionaryContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FileReaderContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FileReaderContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FeedParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FeedParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_HTMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_HTMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__SaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__SaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__SaxParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__SaxParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParseEventsIterator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParseEventsIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__PythonSaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__TargetParserContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__TargetParserContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FilelikeWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FilelikeWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_xmlfile);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_xmlfile);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_htmlfile);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_htmlfile);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__IncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__IncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncDataWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncDataWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__AsyncFileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__FileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__FileWriterElement);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MethodChanger);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MethodChanger);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_iterparse);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_iterparse);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__IDDict);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__IDDict);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XInclude);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XInclude);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ExsltRegExp);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ExsltRegExp);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__BaseContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__BaseContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ElementUnicodeResult);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ElementUnicodeResult);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XPathEvaluatorBase);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathElementEvaluator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathElementEvaluator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XPath);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XPath);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTResolverContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTResolverContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTQuotedStringParam);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLT);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLT);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTResultTree);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTResultTree);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__XSLTProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__Validator);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__Validator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDElementContentDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDElementContentDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDAttributeDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDAttributeDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDElementDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDElementDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__DTDEntityDecl);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__DTDEntityDecl);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_DTD);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_DTD);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__ParserSchemaValidationContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree_Schematron);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree_Schematron);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree__MemDebug);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree__MemDebug);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_7_write);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_8__close);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements);
  Py_VISIT(traverse_module_state->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_VISIT(traverse_module_state->__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities);
  Py_VISIT(traverse_module_state->__pyx_kp_u_0_9);
  Py_VISIT(traverse_module_state->__pyx_kp_u_1);
  Py_VISIT(traverse_module_state->__pyx_kp_b_25);
  Py_VISIT(traverse_module_state->__pyx_n_b_A);
  Py_VISIT(traverse_module_state->__pyx_n_b_ASCII);
  Py_VISIT(traverse_module_state->__pyx_n_u_ASCII);
  Py_VISIT(traverse_module_state->__pyx_kp_u_All_strings_must_be_XML_compatib);
  Py_VISIT(traverse_module_state->__pyx_kp_s_An_XMLSyntaxError_that_addition);
  Py_VISIT(traverse_module_state->__pyx_n_s_AncestorsIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_AppendOnlyElementProxy_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_AppendOnlyElementProxy_extend);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Argument_is_not_a_file_like_obje);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Argument_must_be_bytes_or_unicod);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Argument_must_be_string_or_unico);
  Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncDataWriter_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncDataWriter_write);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncFileWriterElement___aenter);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncFileWriterElement___aexit);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter__clo);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_elem);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_flus);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_meth);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_AsyncIncrementalFileWriter_writ_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib___copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib___deepcopy);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_has_key);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_Attrib_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_AttributeBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError);
  Py_VISIT(traverse_module_state->__pyx_n_u_BE);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseErrorLog_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseErrorLog_receive);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseException);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseParser_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseParser_makeelement);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseParser_set_element_class_lo);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Base_class_for_all_syntax_errors);
  Py_VISIT(traverse_module_state->__pyx_n_s_BytesIO);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NError);
  Py_VISIT(traverse_module_state->__pyx_n_u_C14NError);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_n_u_C14NWriterTarget);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget__iter_namespace);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget__start_locals_l);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_comment);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_data);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_end);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_pi);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_start);
  Py_VISIT(traverse_module_state->__pyx_n_s_C14NWriterTarget_start_ns);
  Py_VISIT(traverse_module_state->__pyx_kp_u_C14N_failed);
  Py_VISIT(traverse_module_state->__pyx_n_s_CDATA);
  Py_VISIT(traverse_module_state->__pyx_n_u_CDATA);
  Py_VISIT(traverse_module_state->__pyx_n_s_CRITICAL);
  Py_VISIT(traverse_module_state->__pyx_n_s_CSSSelector);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Can_only_discard_comments_in_C14);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Can_only_strip_text_in_C14N_2_0);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_asynchronously_write_to_a);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_change_the_xml_prefix_of);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_enable_XML_declaration_in);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_parse_stylesheet);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_resolve_URI);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_specify_encoding_with_C14);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Char_out_of_XML_range);
  Py_VISIT(traverse_module_state->__pyx_n_s_Comment);
  Py_VISIT(traverse_module_state->__pyx_n_u_Comment);
  Py_VISIT(traverse_module_state->__pyx_n_s_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_n_u_CommentBase);
  Py_VISIT(traverse_module_state->__pyx_n_s_Comment_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Comment_may_not_contain_or_end_w);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_insert);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_set);
  Py_VISIT(traverse_module_state->__pyx_n_s_ContentOnlyElement_values);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Could_not_create_I_O_writer_cont);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Could_not_find_root_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_CustomElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_CustomElementClassLookup_lookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_DEBUG);
  Py_VISIT(traverse_module_state->__pyx_n_u_DEBUG);
  Py_VISIT(traverse_module_state->__pyx_n_s_DENY_ALL);
  Py_VISIT(traverse_module_state->__pyx_n_s_DENY_WRITE);
  Py_VISIT(traverse_module_state->__pyx_kp_u_DOCTYPE);
  Py_VISIT(traverse_module_state->__pyx_kp_u_DOCTYPE_already_written_or_canno);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTD);
  Py_VISIT(traverse_module_state->__pyx_n_u_DTD);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDAttributeDecl_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDAttributeDecl_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDElementDecl_attributes);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDElementDecl_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDError);
  Py_VISIT(traverse_module_state->__pyx_n_u_DTDError);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_DTDParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_u_DTDValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTD_elements);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTD_entities);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTD_iterelements);
  Py_VISIT(traverse_module_state->__pyx_n_s_DTD_iterentities);
  Py_VISIT(traverse_module_state->__pyx_kp_u_DTD_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_n_s_DeprecationWarning);
  Py_VISIT(traverse_module_state->__pyx_n_s_DocInfo);
  Py_VISIT(traverse_module_state->__pyx_n_s_DocInfo_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_Document);
  Py_VISIT(traverse_module_state->__pyx_n_s_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_n_u_DocumentInvalid);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_does_not_comply_with_sc);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_is_not_a_valid_Schematr);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_is_not_parsable_as_Rela);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_is_not_valid_Relax_NG);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_is_not_valid_XML_Schema);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Document_is_not_well_formed);
  Py_VISIT(traverse_module_state->__pyx_n_s_DomainErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_DomainErrorLog_receive);
  Py_VISIT(traverse_module_state->__pyx_n_s_ERROR);
  Py_VISIT(traverse_module_state->__pyx_n_s_ERR_INVALID_CHAR);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  Py_VISIT(traverse_module_state->__pyx_n_s_ERR_UNDECLARED_ENTITY);
  Py_VISIT(traverse_module_state->__pyx_n_s_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_u_ETCompatXMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_n_u_ETXPath);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Either_xml_data_or_from_file_mus);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Element);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementBase);
  Py_VISIT(traverse_module_state->__pyx_n_u_ElementBase);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementChildIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_ElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_ElementDefaultClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementDepthFirstIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementMatchIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_ElementNamespaceClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementNamespaceClassLookup_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTagMatcher);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTextIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree);
  Py_VISIT(traverse_module_state->__pyx_n_u_ElementTree);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree___copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree___deepcopy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree__setroot);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_find);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_findall);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_findtext);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_getelementpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_getiterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_getpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_getroot);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_iterfind);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ElementTree_not_initialized_miss);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_parse);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_relaxng);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_write);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_write_c14n);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_xinclude);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_xmlschema);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_xpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementTree_xslt);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementUnicodeResult);
  Py_VISIT(traverse_module_state->__pyx_n_s_ElementUnicodeResult_getparent);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_Element_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element___copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element___deepcopy);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element___reversed);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element__init);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_addnext);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_addprevious);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_cssselect);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_extend);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_find);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_findall);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_findtext);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getiterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getnext);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getparent);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getprevious);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_getroottree);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_index);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_insert);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Element_is_not_a_child_of_this_n);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Element_is_not_in_this_tree);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Element_is_not_in_this_tree_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_iterancestors);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_iterchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_iterdescendants);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_iterfind);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_itersiblings);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_itertext);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_makeelement);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_remove);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_replace);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_set);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_Element_xpath);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Empty_tag_name);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Encoding_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_Entity);
  Py_VISIT(traverse_module_state->__pyx_n_u_Entity);
  Py_VISIT(traverse_module_state->__pyx_n_s_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_n_u_EntityBase);
  Py_VISIT(traverse_module_state->__pyx_n_s_Entity_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Entity_class_must_be_subclass_of);
  Py_VISIT(traverse_module_state->__pyx_n_s_Error);
  Py_VISIT(traverse_module_state->__pyx_n_u_Error);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorDomains);
  Py_VISIT(traverse_module_state->__pyx_n_u_ErrorDomains);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLevels);
  Py_VISIT(traverse_module_state->__pyx_n_u_ErrorLevels);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLog___exit);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLog_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLog_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorLog_receive);
  Py_VISIT(traverse_module_state->__pyx_n_s_ErrorTypes);
  Py_VISIT(traverse_module_state->__pyx_n_u_ErrorTypes);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_applying_stylesheet);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_applying_stylesheet_line);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_during_serialisation_out_o);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_in_xpath_expression);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_reading);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_reading_file);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Error_serialising_an_XSLT_result);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Expected_for_variable_reference);
  Py_VISIT(traverse_module_state->__pyx_n_s_ExsltRegExp_match);
  Py_VISIT(traverse_module_state->__pyx_n_s_ExsltRegExp_replace);
  Py_VISIT(traverse_module_state->__pyx_n_s_ExsltRegExp_test);
  Py_VISIT(traverse_module_state->__pyx_n_s_Extension);
  Py_VISIT(traverse_module_state->__pyx_n_u_Extension);
  Py_VISIT(traverse_module_state->__pyx_n_s_FATAL);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Failed_to_create_file);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Failed_to_create_validation_cont);
  Py_VISIT(traverse_module_state->__pyx_n_s_FallbackElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_FallbackElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_FallbackElementClassLookup_set_f);
  Py_VISIT(traverse_module_state->__pyx_n_s_FeedParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_FeedParser_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_FeedParser_feed);
  Py_VISIT(traverse_module_state->__pyx_n_s_FileWriterElement___enter);
  Py_VISIT(traverse_module_state->__pyx_n_s_FileWriterElement___exit);
  Py_VISIT(traverse_module_state->__pyx_kp_u_File_is_already_closed);
  Py_VISIT(traverse_module_state->__pyx_kp_u_File_or_filename_expected_got);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Forbidden_variable);
  Py_VISIT(traverse_module_state->__pyx_n_s_FunctionNamespace);
  Py_VISIT(traverse_module_state->__pyx_n_u_FunctionNamespace);
  Py_VISIT(traverse_module_state->__pyx_kp_u_FunctionNamespace_line_207);
  Py_VISIT(traverse_module_state->__pyx_kp_u_FunctionNamespace_ns_uri_Retriev);
  Py_VISIT(traverse_module_state->__pyx_kp_u_FunctionNamespace_r);
  Py_VISIT(traverse_module_state->__pyx_n_s_FutureWarning);
  Py_VISIT(traverse_module_state->__pyx_n_u_GlobalErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_GzipFile);
  Py_VISIT(traverse_module_state->__pyx_n_s_HTML);
  Py_VISIT(traverse_module_state->__pyx_n_u_HTML);
  Py_VISIT(traverse_module_state->__pyx_n_s_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_u_HTMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_HTMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_HTMLPullParser_read_events);
  Py_VISIT(traverse_module_state->__pyx_n_s_ICONV_COMPILED_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_has_key);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_IDDict_values);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ID_attribute_not_found);
  Py_VISIT(traverse_module_state->__pyx_n_s_IGNORECASE);
  Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Illegal_Unicode_kind);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Illegal_document_provided_NULL);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Illegal_document_provided_expect);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___contains);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___delitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___getitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___len);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImmutableMapping___setitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Inconsistent_enter_action_in_con);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Inconsistent_exit_action_in_cont);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_flush);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_method);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_write);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_write_dec);
  Py_VISIT(traverse_module_state->__pyx_n_s_IncrementalFileWriter_write_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_IndexError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Initial_indentation_level_must_b);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Input_object_has_no_document);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Input_object_is_not_an_XML_eleme);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Internal_error_in_DTD_validation);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Internal_error_in_Relax_NG_valid);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Internal_error_in_Schematron_val);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Internal_error_in_XML_Schema_val);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_HTML_tag_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_PI_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_URL_must_not_contain_or);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_attribute_dictionary);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_attribute_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_character);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_character_reference);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_character_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_child_type);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_context_position);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_context_size);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_entity_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_entity_reference);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_expression);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_input_object);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_input_tag_of_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_namespace_URI);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_namespace_prefix);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_number_of_arguments);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_operand);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_or_incomplete_context);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_predicate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_tag_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_tag_name_2);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Invalid_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_KeyError);
  Py_VISIT(traverse_module_state->__pyx_n_u_LE);
  Py_VISIT(traverse_module_state->__pyx_n_s_LIBXML_COMPILED_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_u_LIBXML_COMPILED_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_s_LIBXML_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_u_LIBXML_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_s_LIBXSLT_COMPILED_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_u_LIBXSLT_COMPILED_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_s_LIBXSLT_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_u_LIBXSLT_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_s_LXML_VERSION);
  Py_VISIT(traverse_module_state->__pyx_n_u_LXML_VERSION);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Libxml2_RelaxNG_error_types);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Libxml2_error_domains);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Libxml2_error_levels);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Libxml2_error_types);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_domains);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_from_errors);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_from_fatals);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_from_level);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_from_warnin);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_levels);
  Py_VISIT(traverse_module_state->__pyx_n_s_ListErrorLog_filter_types);
  Py_VISIT(traverse_module_state->__pyx_n_s_LogEntry);
  Py_VISIT(traverse_module_state->__pyx_n_s_LookupError);
  Py_VISIT(traverse_module_state->__pyx_n_s_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_n_u_LxmlError);
  Py_VISIT(traverse_module_state->__pyx_n_s_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_n_u_LxmlRegistryError);
  Py_VISIT(traverse_module_state->__pyx_n_s_LxmlSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_n_u_LxmlSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemDebug_blocks_used);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemDebug_bytes_used);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemDebug_dict_size);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemDebug_dump);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemDebug_show);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Memory_allocation_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_MethodChanger___aenter);
  Py_VISIT(traverse_module_state->__pyx_n_s_MethodChanger___aexit);
  Py_VISIT(traverse_module_state->__pyx_n_s_MethodChanger___enter);
  Py_VISIT(traverse_module_state->__pyx_n_s_MethodChanger___exit);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Method_changed_outside_of_contex);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Missing_closing_curly_brace);
  Py_VISIT(traverse_module_state->__pyx_n_s_MutableMapping);
  Py_VISIT(traverse_module_state->__pyx_n_u_NAMESPACE);
  Py_VISIT(traverse_module_state->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  Py_VISIT(traverse_module_state->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Name_not_registered);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Namespace);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_n_u_NamespaceRegistryError);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry___deco);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry__deco);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_NamespaceRegistry_update);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Namespace_r);
  Py_VISIT(traverse_module_state->__pyx_kp_u_No_ID_dictionary_available);
  Py_VISIT(traverse_module_state->__pyx_kp_u_No_document_to_serialise);
  Py_VISIT(traverse_module_state->__pyx_kp_u_No_tree_or_file_given);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Node_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Non_Element_values_not_supported);
  Py_VISIT(traverse_module_state->__pyx_kp_u_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_NotImplemented);
  Py_VISIT(traverse_module_state->__pyx_n_s_NotImplementedError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Not_yet_implemented_result_node);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Number_encoding);
  Py_VISIT(traverse_module_state->__pyx_n_b_Ok);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Only_elements_can_be_the_root_of);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Only_processing_instructions_and);
  Py_VISIT(traverse_module_state->__pyx_n_s_OpaqueDocumentWrapper_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_OpaqueDocumentWrapper_extend);
  Py_VISIT(traverse_module_state->__pyx_n_s_OrderedDict);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Output_file_needs_an_async_write);
  Py_VISIT(traverse_module_state->__pyx_n_u_PARSER);
  Py_VISIT(traverse_module_state->__pyx_n_s_PI);
  Py_VISIT(traverse_module_state->__pyx_n_u_PI);
  Py_VISIT(traverse_module_state->__pyx_n_s_PIBase);
  Py_VISIT(traverse_module_state->__pyx_n_u_PIBase);
  Py_VISIT(traverse_module_state->__pyx_kp_u_PI_class_must_be_subclass_of_PIB);
  Py_VISIT(traverse_module_state->__pyx_kp_u_PI_lacks_content);
  Py_VISIT(traverse_module_state->__pyx_kp_u_PI_text_must_not_contain);
  Py_VISIT(traverse_module_state->__pyx_kp_u_PUBLIC);
  Py_VISIT(traverse_module_state->__pyx_n_s_ParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_ParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_ParseError___init);
  Py_VISIT(traverse_module_state->__pyx_n_s_ParseError_position);
  Py_VISIT(traverse_module_state->__pyx_n_s_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_ParserBasedElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_ParserDictionaryContext);
  Py_VISIT(traverse_module_state->__pyx_n_s_ParserError);
  Py_VISIT(traverse_module_state->__pyx_n_u_ParserError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ParserSchemaValidationContext_n);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Parsing_requires_string_data);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Prefix);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Prefix_format_reserved_for_inter);
  Py_VISIT(traverse_module_state->__pyx_n_s_ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_n_u_ProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_n_s_ProcessingInstruction_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_ProcessingInstruction_get);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Proxy_invalidated);
  Py_VISIT(traverse_module_state->__pyx_n_s_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_u_PyErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_PyErrorLog_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_PyErrorLog_log);
  Py_VISIT(traverse_module_state->__pyx_n_s_PyErrorLog_receive);
  Py_VISIT(traverse_module_state->__pyx_n_s_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_PythonElementClassLookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_PythonElementClassLookup_lookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_QName);
  Py_VISIT(traverse_module_state->__pyx_n_u_QName);
  Py_VISIT(traverse_module_state->__pyx_n_s_RELAXNGV);
  Py_VISIT(traverse_module_state->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyElementProxy_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyElementProxy_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyElementProxy_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyElementProxy_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy___copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy___deepcopy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy_getchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy_getnext);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy_getparent);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy_getprevious);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReadOnlyProxy_iterchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_ReferenceError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Registered_element_classes_must);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Registered_functions_must_be_cal);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_n_u_RelaxNG);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_n_u_RelaxNGError);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNGErrorTypes);
  Py_VISIT(traverse_module_state->__pyx_n_u_RelaxNGErrorTypes);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_RelaxNGParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_u_RelaxNGValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_s_RelaxNG_from_rnc_string);
  Py_VISIT(traverse_module_state->__pyx_kp_u_RelaxNG_instance_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver);
  Py_VISIT(traverse_module_state->__pyx_n_u_Resolver);
  Py_VISIT(traverse_module_state->__pyx_n_s_ResolverRegistry_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_ResolverRegistry_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_ResolverRegistry_remove);
  Py_VISIT(traverse_module_state->__pyx_n_s_ResolverRegistry_resolve);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver_resolve);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver_resolve_empty);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver_resolve_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver_resolve_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_Resolver_resolve_string);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Resource_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_RotatingErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_RotatingErrorLog_receive);
  Py_VISIT(traverse_module_state->__pyx_kp_u_SYSTEM);
  Py_VISIT(traverse_module_state->__pyx_n_s_SaxParserTarget);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Schema_instance_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_n_s_Schematron);
  Py_VISIT(traverse_module_state->__pyx_n_u_Schematron);
  Py_VISIT(traverse_module_state->__pyx_n_s_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_n_u_SchematronError);
  Py_VISIT(traverse_module_state->__pyx_n_s_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_SchematronParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_u_SchematronValidateError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Schematron_instance_not_initiali);
  Py_VISIT(traverse_module_state->__pyx_n_s_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_n_u_SerialisationError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Serialisation_to_unicode_must_no);
  Py_VISIT(traverse_module_state->__pyx_n_s_SiblingsIterator);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Stack_usage_error);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Start_of_literal);
  Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration);
  Py_VISIT(traverse_module_state->__pyx_n_s_StringIO);
  Py_VISIT(traverse_module_state->__pyx_n_s_SubElement);
  Py_VISIT(traverse_module_state->__pyx_n_u_SubElement);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Sub_resource_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_SyntaxError);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Syntax_error);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Syntax_error_while_parsing_an_XM);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Syntax_error_while_parsing_an_XM_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_System_URL_may_not_contain_both);
  Py_VISIT(traverse_module_state->__pyx_n_u_TAG);
  Py_VISIT(traverse_module_state->__pyx_n_s_TargetParserResult);
  Py_VISIT(traverse_module_state->__pyx_n_s_TargetParserResult___init);
  Py_VISIT(traverse_module_state->__pyx_kp_u_The_behavior_of_this_method_will);
  Py_VISIT(traverse_module_state->__pyx_kp_u_The_docstring_option_is_deprecat);
  Py_VISIT(traverse_module_state->__pyx_kp_u_This_class_cannot_be_instantiate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_This_is_not_a_supported_node_set);
  Py_VISIT(traverse_module_state->__pyx_kp_u_This_search_incorrectly_ignores);
  Py_VISIT(traverse_module_state->__pyx_kp_u_This_type_cannot_be_instantiated);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_n_u_TreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_comment);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_data);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_end);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_pi);
  Py_VISIT(traverse_module_state->__pyx_n_s_TreeBuilder_start);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Tried_to_unregister_unknown_prox);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Type);
  Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
  Py_VISIT(traverse_module_state->__pyx_n_s_U);
  Py_VISIT(traverse_module_state->__pyx_n_s_UNICODE);
  Py_VISIT(traverse_module_state->__pyx_kp_u_US_ASCII);
  Py_VISIT(traverse_module_state->__pyx_n_u_UTF8);
  Py_VISIT(traverse_module_state->__pyx_kp_u_UTF_8);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Undefined_namespace_prefix);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Undefined_variable);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Undefined_xpath_result);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Unfinished_literal);
  Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeDecodeError);
  Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeEncodeError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unicode_strings_with_encoding_de);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Unknown_error);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_libxml2_version);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_node_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_return_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_xpath_result);
  Py_VISIT(traverse_module_state->__pyx_kp_b_Unregistered_function);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unsupported_element_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unsupported_node_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator__append_log_message);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator__clear_error_log);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator_assert);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator_assertValid);
  Py_VISIT(traverse_module_state->__pyx_n_s_Validator_validate);
  Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
  Py_VISIT(traverse_module_state->__pyx_n_s_WARNING);
  Py_VISIT(traverse_module_state->__pyx_n_s_WAR_UNDECLARED_ENTITY);
  Py_VISIT(traverse_module_state->__pyx_n_u_X);
  Py_VISIT(traverse_module_state->__pyx_n_s_XInclude);
  Py_VISIT(traverse_module_state->__pyx_n_u_XInclude);
  Py_VISIT(traverse_module_state->__pyx_n_s_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XIncludeError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XInclude_instance_not_initialise);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XInclude_processing_failed);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XInclude_processor_not_initialis);
  Py_VISIT(traverse_module_state->__pyx_n_s_XML);
  Py_VISIT(traverse_module_state->__pyx_n_u_XML);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLDTDID);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLDTDID);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLID);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLID);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLPullParser);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLPullParser_read_events);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLSchemaError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLSchemaParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLSchemaValidateError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSyntaxAssertionError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSyntaxAssertionError___init);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XMLTreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_n_u_XMLTreeBuilder);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XML_declaration_already_written);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XML_line_3261);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XML_text_parser_None_base_url_No);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPATH_LOCATIONSET);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPATH_POINT);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPATH_RANGE);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPATH_USERS);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPath);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPath);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathDocumentEvaluator);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathElementEvaluator);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathElementEvaluator_register_n);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathElementEvaluator_register_n_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathEvalError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathEvaluator);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathEvaluator);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathEvaluatorBase);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathFunctionError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathResultError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XPathSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XPathSyntaxError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XPath_context_is_only_usable_dur);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XPath_context_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XPath_evaluator_locking_failed);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XPath_evaluator_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XPath_function);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLT);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTAccessControl);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTApplyError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTErrorLog);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTExtension);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTExtensionError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTExtension_apply_templates);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTExtension_execute);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTExtension_process_children);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTParseError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTProcessingInstruction);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTProcessingInstruction_parse);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTProcessingInstruction_set);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTResultTree);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTResultTree_write_output);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLTSaveError);
  Py_VISIT(traverse_module_state->__pyx_n_u_XSLTSaveError);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT___copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT___deepcopy);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XSLT_context_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT_set_global_max_depth);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT_strparam);
  Py_VISIT(traverse_module_state->__pyx_kp_u_XSLT_stylesheet_not_initialised);
  Py_VISIT(traverse_module_state->__pyx_n_s_XSLT_tostring);
  Py_VISIT(traverse_module_state->__pyx_n_s__106);
  Py_VISIT(traverse_module_state->__pyx_kp_u__11);
  Py_VISIT(traverse_module_state->__pyx_kp_b__12);
  Py_VISIT(traverse_module_state->__pyx_kp_u__12);
  Py_VISIT(traverse_module_state->__pyx_kp_b__17);
  Py_VISIT(traverse_module_state->__pyx_kp_u__17);
  Py_VISIT(traverse_module_state->__pyx_kp_u__18);
  Py_VISIT(traverse_module_state->__pyx_kp_u__19);
  Py_VISIT(traverse_module_state->__pyx_kp_u__20);
  Py_VISIT(traverse_module_state->__pyx_kp_b__21);
  Py_VISIT(traverse_module_state->__pyx_kp_u__21);
  Py_VISIT(traverse_module_state->__pyx_n_s__22);
  Py_VISIT(traverse_module_state->__pyx_kp_b__22);
  Py_VISIT(traverse_module_state->__pyx_kp_u__22);
  Py_VISIT(traverse_module_state->__pyx_kp_u__24);
  Py_VISIT(traverse_module_state->__pyx_kp_b__25);
  Py_VISIT(traverse_module_state->__pyx_kp_u__25);
  Py_VISIT(traverse_module_state->__pyx_kp_b__26);
  Py_VISIT(traverse_module_state->__pyx_kp_u__26);
  Py_VISIT(traverse_module_state->__pyx_kp_u__28);
  Py_VISIT(traverse_module_state->__pyx_kp_u__29);
  Py_VISIT(traverse_module_state->__pyx_kp_b__3);
  Py_VISIT(traverse_module_state->__pyx_kp_u__3);
  Py_VISIT(traverse_module_state->__pyx_kp_u__30);
  Py_VISIT(traverse_module_state->__pyx_kp_u__32);
  Py_VISIT(traverse_module_state->__pyx_kp_b__33);
  Py_VISIT(traverse_module_state->__pyx_kp_u__33);
  Py_VISIT(traverse_module_state->__pyx_kp_b__34);
  Py_VISIT(traverse_module_state->__pyx_kp_u__34);
  Py_VISIT(traverse_module_state->__pyx_kp_b__35);
  Py_VISIT(traverse_module_state->__pyx_kp_u__35);
  Py_VISIT(traverse_module_state->__pyx_kp_b__4);
  Py_VISIT(traverse_module_state->__pyx_kp_u__4);
  Py_VISIT(traverse_module_state->__pyx_kp_u__41);
  Py_VISIT(traverse_module_state->__pyx_kp_u__42);
  Py_VISIT(traverse_module_state->__pyx_kp_u__43);
  Py_VISIT(traverse_module_state->__pyx_kp_u__45);
  Py_VISIT(traverse_module_state->__pyx_kp_b__48);
  Py_VISIT(traverse_module_state->__pyx_kp_b__489);
  Py_VISIT(traverse_module_state->__pyx_kp_b__491);
  Py_VISIT(traverse_module_state->__pyx_kp_b__50);
  Py_VISIT(traverse_module_state->__pyx_kp_u__52);
  Py_VISIT(traverse_module_state->__pyx_n_s__56);
  Py_VISIT(traverse_module_state->__pyx_n_u__56);
  Py_VISIT(traverse_module_state->__pyx_kp_u__57);
  Py_VISIT(traverse_module_state->__pyx_kp_u__61);
  Py_VISIT(traverse_module_state->__pyx_kp_b__63);
  Py_VISIT(traverse_module_state->__pyx_kp_u__71);
  Py_VISIT(traverse_module_state->__pyx_kp_u__72);
  Py_VISIT(traverse_module_state->__pyx_kp_u__73);
  Py_VISIT(traverse_module_state->__pyx_kp_u__74);
  Py_VISIT(traverse_module_state->__pyx_kp_u__75);
  Py_VISIT(traverse_module_state->__pyx_kp_u__95);
  Py_VISIT(traverse_module_state->__pyx_kp_u__96);
  Py_VISIT(traverse_module_state->__pyx_n_s_abspath);
  Py_VISIT(traverse_module_state->__pyx_n_s_accepted_domains);
  Py_VISIT(traverse_module_state->__pyx_n_s_access_control);
  Py_VISIT(traverse_module_state->__pyx_n_s_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_addnext);
  Py_VISIT(traverse_module_state->__pyx_n_s_addprevious);
  Py_VISIT(traverse_module_state->__pyx_n_s_adopt_external_document);
  Py_VISIT(traverse_module_state->__pyx_n_s_aenter);
  Py_VISIT(traverse_module_state->__pyx_n_s_aexit);
  Py_VISIT(traverse_module_state->__pyx_n_s_all);
  Py_VISIT(traverse_module_state->__pyx_n_u_alpha);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ambiguous_reference_to_embedded);
  Py_VISIT(traverse_module_state->__pyx_kp_u_amp);
  Py_VISIT(traverse_module_state->__pyx_n_u_any);
  Py_VISIT(traverse_module_state->__pyx_n_s_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_append_log_message);
  Py_VISIT(traverse_module_state->__pyx_n_s_apply_templates);
  Py_VISIT(traverse_module_state->__pyx_n_s_args);
  Py_VISIT(traverse_module_state->__pyx_kp_u_argument_must_be_a_byte_string_o);
  Py_VISIT(traverse_module_state->__pyx_n_u_ascii);
  Py_VISIT(traverse_module_state->__pyx_n_s_assert);
  Py_VISIT(traverse_module_state->__pyx_n_s_assertValid);
  Py_VISIT(traverse_module_state->__pyx_n_s_async_outfile);
  Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
  Py_VISIT(traverse_module_state->__pyx_kp_u_at_0x);
  Py_VISIT(traverse_module_state->__pyx_kp_u_attempt_to_assign_sequence_of_si);
  Py_VISIT(traverse_module_state->__pyx_n_s_attrib);
  Py_VISIT(traverse_module_state->__pyx_n_s_attribute_defaults);
  Py_VISIT(traverse_module_state->__pyx_n_s_attribute_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_attribute_names);
  Py_VISIT(traverse_module_state->__pyx_n_s_attributes);
  Py_VISIT(traverse_module_state->__pyx_n_s_attrs);
  Py_VISIT(traverse_module_state->__pyx_n_s_await);
  Py_VISIT(traverse_module_state->__pyx_n_s_base_url);
  Py_VISIT(traverse_module_state->__pyx_n_u_beta);
  Py_VISIT(traverse_module_state->__pyx_n_s_block_count);
  Py_VISIT(traverse_module_state->__pyx_n_s_blocks_used);
  Py_VISIT(traverse_module_state->__pyx_kp_u_boolean_xs_attribute_default_or);
  Py_VISIT(traverse_module_state->__pyx_n_s_bstring);
  Py_VISIT(traverse_module_state->__pyx_n_s_buffered);
  Py_VISIT(traverse_module_state->__pyx_n_s_build_smart_strings);
  Py_VISIT(traverse_module_state->__pyx_n_s_byte_count);
  Py_VISIT(traverse_module_state->__pyx_n_s_bytes_used);
  Py_VISIT(traverse_module_state->__pyx_n_u_c14n);
  Py_VISIT(traverse_module_state->__pyx_n_u_c14n2);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_attr);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_attr_next);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_attrs);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_buffer);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_child);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_compression);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_context_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_count);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_ctxt);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_dict);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_dtd);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_encoding);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_href);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_method);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_new_next);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_new_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_next);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_node_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_node_next);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_old_next);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_old_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_old_output_parent);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_parent);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_path);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_source_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_standalone);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_start);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_start_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_stop);
  Py_VISIT(traverse_module_state->__pyx_n_s_c_version);
  Py_VISIT(traverse_module_state->__pyx_kp_u_can_only_parse_strings);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_add_ancestor_as_sibling_p);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_append_document_already_h);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_append_parent_to_itself);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_append_trailing_element_t);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_assign_None);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_be_serialized);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_parse_from);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_serialize);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_set_a_maximum_stylesheet);
  Py_VISIT(traverse_module_state->__pyx_n_s_canonicalize);
  Py_VISIT(traverse_module_state->__pyx_n_u_canonicalize);
  Py_VISIT(traverse_module_state->__pyx_n_s_capsule);
  Py_VISIT(traverse_module_state->__pyx_n_u_cdata);
  Py_VISIT(traverse_module_state->__pyx_n_s_child);
  Py_VISIT(traverse_module_state->__pyx_n_s_children);
  Py_VISIT(traverse_module_state->__pyx_n_s_class);
  Py_VISIT(traverse_module_state->__pyx_n_u_class);
  Py_VISIT(traverse_module_state->__pyx_n_s_class_dict_iterable);
  Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_class_mapping);
  Py_VISIT(traverse_module_state->__pyx_n_s_cleanup_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_u_cleanup_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_s_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_clear_error_log);
  Py_VISIT(traverse_module_state->__pyx_n_s_clear_error_log_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_clear_error_log_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
  Py_VISIT(traverse_module_state->__pyx_n_s_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_close_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_close_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_cls);
  Py_VISIT(traverse_module_state->__pyx_n_s_code);
  Py_VISIT(traverse_module_state->__pyx_n_s_codecs);
  Py_VISIT(traverse_module_state->__pyx_n_s_collect_ids);
  Py_VISIT(traverse_module_state->__pyx_n_s_collections);
  Py_VISIT(traverse_module_state->__pyx_n_s_collections_abc);
  Py_VISIT(traverse_module_state->__pyx_kp_u_column);
  Py_VISIT(traverse_module_state->__pyx_n_s_column_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_comment);
  Py_VISIT(traverse_module_state->__pyx_n_u_comment);
  Py_VISIT(traverse_module_state->__pyx_kp_u_comment_class_must_be_subclass_o);
  Py_VISIT(traverse_module_state->__pyx_n_s_comment_factory);
  Py_VISIT(traverse_module_state->__pyx_n_s_compact);
  Py_VISIT(traverse_module_state->__pyx_kp_u_compact_syntax_not_supported_ple);
  Py_VISIT(traverse_module_state->__pyx_n_s_compile);
  Py_VISIT(traverse_module_state->__pyx_n_s_compression);
  Py_VISIT(traverse_module_state->__pyx_n_s_compresslevel);
  Py_VISIT(traverse_module_state->__pyx_n_s_contains);
  Py_VISIT(traverse_module_state->__pyx_n_s_content);
  Py_VISIT(traverse_module_state->__pyx_n_s_context);
  Py_VISIT(traverse_module_state->__pyx_n_s_contextlib);
  Py_VISIT(traverse_module_state->__pyx_n_s_contextmanager);
  Py_VISIT(traverse_module_state->__pyx_n_s_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_copy_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_count);
  Py_VISIT(traverse_module_state->__pyx_n_s_create_dir);
  Py_VISIT(traverse_module_state->__pyx_n_u_create_dir);
  Py_VISIT(traverse_module_state->__pyx_n_s_cssselect);
  Py_VISIT(traverse_module_state->__pyx_n_s_ctxt);
  Py_VISIT(traverse_module_state->__pyx_n_u_d);
  Py_VISIT(traverse_module_state->__pyx_n_s_data);
  Py_VISIT(traverse_module_state->__pyx_n_b_dc);
  Py_VISIT(traverse_module_state->__pyx_n_s_deco);
  Py_VISIT(traverse_module_state->__pyx_n_s_decode);
  Py_VISIT(traverse_module_state->__pyx_n_s_deepcopy);
  Py_VISIT(traverse_module_state->__pyx_n_s_default);
  Py_VISIT(traverse_module_state->__pyx_kp_u_default_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_default_doctype);
  Py_VISIT(traverse_module_state->__pyx_n_s_default_resolver);
  Py_VISIT(traverse_module_state->__pyx_kp_u_default_value);
  Py_VISIT(traverse_module_state->__pyx_n_s_default_value_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_delitem);
  Py_VISIT(traverse_module_state->__pyx_n_u_dev);
  Py_VISIT(traverse_module_state->__pyx_n_s_dic);
  Py_VISIT(traverse_module_state->__pyx_n_s_dict);
  Py_VISIT(traverse_module_state->__pyx_n_u_dict);
  Py_VISIT(traverse_module_state->__pyx_n_s_dict_size);
  Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
  Py_VISIT(traverse_module_state->__pyx_n_s_discard);
  Py_VISIT(traverse_module_state->__pyx_n_s_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_doc_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_doc_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_doc_ref);
  Py_VISIT(traverse_module_state->__pyx_n_s_docformat);
  Py_VISIT(traverse_module_state->__pyx_n_s_docstring);
  Py_VISIT(traverse_module_state->__pyx_n_s_doctype);
  Py_VISIT(traverse_module_state->__pyx_kp_u_document_context_is_missing);
  Py_VISIT(traverse_module_state->__pyx_kp_u_document_external_context_nodes);
  Py_VISIT(traverse_module_state->__pyx_n_s_domain);
  Py_VISIT(traverse_module_state->__pyx_n_s_domain_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_domains);
  Py_VISIT(traverse_module_state->__pyx_kp_u_double_registering_proxy);
  Py_VISIT(traverse_module_state->__pyx_n_s_dtd_validation);
  Py_VISIT(traverse_module_state->__pyx_n_s_dump);
  Py_VISIT(traverse_module_state->__pyx_n_u_dump);
  Py_VISIT(traverse_module_state->__pyx_n_s_dumps);
  Py_VISIT(traverse_module_state->__pyx_kp_u_either_filename_or_external_ID_r);
  Py_VISIT(traverse_module_state->__pyx_n_s_el);
  Py_VISIT(traverse_module_state->__pyx_n_s_elem);
  Py_VISIT(traverse_module_state->__pyx_n_s_element);
  Py_VISIT(traverse_module_state->__pyx_n_u_element);
  Py_VISIT(traverse_module_state->__pyx_kp_u_element_class_must_be_subclass_o);
  Py_VISIT(traverse_module_state->__pyx_n_s_element_config);
  Py_VISIT(traverse_module_state->__pyx_n_s_element_factory);
  Py_VISIT(traverse_module_state->__pyx_n_s_element_or_tree);
  Py_VISIT(traverse_module_state->__pyx_n_s_element_writer);
  Py_VISIT(traverse_module_state->__pyx_n_s_elementpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_elements);
  Py_VISIT(traverse_module_state->__pyx_n_s_elements_only);
  Py_VISIT(traverse_module_state->__pyx_kp_u_elemname);
  Py_VISIT(traverse_module_state->__pyx_n_s_elemname_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_empty);
  Py_VISIT(traverse_module_state->__pyx_kp_u_empty_namespace_prefix_is_not_su);
  Py_VISIT(traverse_module_state->__pyx_kp_u_empty_prefix_is_not_supported_in);
  Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
  Py_VISIT(traverse_module_state->__pyx_n_s_enable_regexp);
  Py_VISIT(traverse_module_state->__pyx_n_s_encode);
  Py_VISIT(traverse_module_state->__pyx_n_s_encoding);
  Py_VISIT(traverse_module_state->__pyx_n_s_end);
  Py_VISIT(traverse_module_state->__pyx_n_u_end);
  Py_VISIT(traverse_module_state->__pyx_kp_u_end_ns);
  Py_VISIT(traverse_module_state->__pyx_n_s_end_ns_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_end_tag_mismatch_expected);
  Py_VISIT(traverse_module_state->__pyx_n_s_endswith);
  Py_VISIT(traverse_module_state->__pyx_n_s_enter);
  Py_VISIT(traverse_module_state->__pyx_n_s_entities);
  Py_VISIT(traverse_module_state->__pyx_n_u_entities);
  Py_VISIT(traverse_module_state->__pyx_n_s_entity);
  Py_VISIT(traverse_module_state->__pyx_n_u_entity);
  Py_VISIT(traverse_module_state->__pyx_n_s_entries);
  Py_VISIT(traverse_module_state->__pyx_n_s_entry);
  Py_VISIT(traverse_module_state->__pyx_n_s_enumerate);
  Py_VISIT(traverse_module_state->__pyx_n_u_enumeration);
  Py_VISIT(traverse_module_state->__pyx_n_s_error_log);
  Py_VISIT(traverse_module_state->__pyx_kp_u_error_parsing_DTD);
  Py_VISIT(traverse_module_state->__pyx_n_s_etree);
  Py_VISIT(traverse_module_state->__pyx_n_s_etree_or_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_etree_or_element_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_evaluator);
  Py_VISIT(traverse_module_state->__pyx_n_s_events);
  Py_VISIT(traverse_module_state->__pyx_n_s_exc_context);
  Py_VISIT(traverse_module_state->__pyx_n_s_exc_info);
  Py_VISIT(traverse_module_state->__pyx_n_s_exc_tb);
  Py_VISIT(traverse_module_state->__pyx_n_s_exc_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_exc_val);
  Py_VISIT(traverse_module_state->__pyx_n_s_exclude_attrs);
  Py_VISIT(traverse_module_state->__pyx_n_s_exclude_tags);
  Py_VISIT(traverse_module_state->__pyx_n_s_exclusive);
  Py_VISIT(traverse_module_state->__pyx_n_s_execute);
  Py_VISIT(traverse_module_state->__pyx_n_s_exit);
  Py_VISIT(traverse_module_state->__pyx_kp_u_expected);
  Py_VISIT(traverse_module_state->__pyx_kp_u_expected_string_or_Element);
  Py_VISIT(traverse_module_state->__pyx_n_s_expr);
  Py_VISIT(traverse_module_state->__pyx_n_s_extend);
  Py_VISIT(traverse_module_state->__pyx_kp_u_extension_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_extensions);
  Py_VISIT(traverse_module_state->__pyx_kp_u_extensions_must_have_non_empty_n);
  Py_VISIT(traverse_module_state->__pyx_kp_u_extensions_must_not_have_empty_n);
  Py_VISIT(traverse_module_state->__pyx_n_s_external_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_extra);
  Py_VISIT(traverse_module_state->__pyx_n_s_f);
  Py_VISIT(traverse_module_state->__pyx_n_s_fallback);
  Py_VISIT(traverse_module_state->__pyx_n_s_feed);
  Py_VISIT(traverse_module_state->__pyx_n_s_feed_error_log);
  Py_VISIT(traverse_module_state->__pyx_n_s_file);
  Py_VISIT(traverse_module_state->__pyx_kp_b_file_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_file_must_be_a_filename_file_lik);
  Py_VISIT(traverse_module_state->__pyx_n_s_filelike);
  Py_VISIT(traverse_module_state->__pyx_n_s_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_fileobj);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_domains);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_from_errors);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_from_fatals);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_from_level);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_from_warnings);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_levels);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter_types);
  Py_VISIT(traverse_module_state->__pyx_n_s_filtered);
  Py_VISIT(traverse_module_state->__pyx_n_s_find);
  Py_VISIT(traverse_module_state->__pyx_n_s_findall);
  Py_VISIT(traverse_module_state->__pyx_n_s_findtext);
  Py_VISIT(traverse_module_state->__pyx_n_s_first_error);
  Py_VISIT(traverse_module_state->__pyx_n_u_fixed);
  Py_VISIT(traverse_module_state->__pyx_n_s_flags);
  Py_VISIT(traverse_module_state->__pyx_n_s_flush);
  Py_VISIT(traverse_module_state->__pyx_n_s_for_html);
  Py_VISIT(traverse_module_state->__pyx_n_s_from_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_from_rnc_string);
  Py_VISIT(traverse_module_state->__pyx_n_s_fromstring);
  Py_VISIT(traverse_module_state->__pyx_n_u_fromstring);
  Py_VISIT(traverse_module_state->__pyx_n_s_fromstringlist);
  Py_VISIT(traverse_module_state->__pyx_n_u_fromstringlist);
  Py_VISIT(traverse_module_state->__pyx_n_s_function_mapping);
  Py_VISIT(traverse_module_state->__pyx_n_s_function_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_functions);
  Py_VISIT(traverse_module_state->__pyx_n_s_functools);
  Py_VISIT(traverse_module_state->__pyx_n_u_g);
  Py_VISIT(traverse_module_state->__pyx_kp_u_g_1_g_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
  Py_VISIT(traverse_module_state->__pyx_n_s_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_getLogger);
  Py_VISIT(traverse_module_state->__pyx_n_s_getName);
  Py_VISIT(traverse_module_state->__pyx_n_s_get_default_parser);
  Py_VISIT(traverse_module_state->__pyx_n_u_get_default_parser);
  Py_VISIT(traverse_module_state->__pyx_n_s_get_namespace);
  Py_VISIT(traverse_module_state->__pyx_n_s_getargspec);
  Py_VISIT(traverse_module_state->__pyx_n_s_getattribute);
  Py_VISIT(traverse_module_state->__pyx_n_s_getchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_getdefaultencoding);
  Py_VISIT(traverse_module_state->__pyx_n_s_getelementpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_getfilesystemencoding);
  Py_VISIT(traverse_module_state->__pyx_n_s_getfullargspec);
  Py_VISIT(traverse_module_state->__pyx_n_s_getitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_getiterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_getnext);
  Py_VISIT(traverse_module_state->__pyx_n_s_getparent);
  Py_VISIT(traverse_module_state->__pyx_n_s_getpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_getprevious);
  Py_VISIT(traverse_module_state->__pyx_n_s_getroot);
  Py_VISIT(traverse_module_state->__pyx_n_s_getroottree);
  Py_VISIT(traverse_module_state->__pyx_n_s_geturl);
  Py_VISIT(traverse_module_state->__pyx_n_s_getvalue);
  Py_VISIT(traverse_module_state->__pyx_n_u_getvalue);
  Py_VISIT(traverse_module_state->__pyx_n_s_getwriter);
  Py_VISIT(traverse_module_state->__pyx_kp_u_got);
  Py_VISIT(traverse_module_state->__pyx_kp_u_got_invalid_input_value_of_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_group);
  Py_VISIT(traverse_module_state->__pyx_n_s_groups);
  Py_VISIT(traverse_module_state->__pyx_kp_u_gt);
  Py_VISIT(traverse_module_state->__pyx_n_s_gzip);
  Py_VISIT(traverse_module_state->__pyx_n_s_has_key);
  Py_VISIT(traverse_module_state->__pyx_n_u_href);
  Py_VISIT(traverse_module_state->__pyx_kp_u_href_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_href_utf);
  Py_VISIT(traverse_module_state->__pyx_n_s_hrefs);
  Py_VISIT(traverse_module_state->__pyx_n_b_html);
  Py_VISIT(traverse_module_state->__pyx_n_s_html);
  Py_VISIT(traverse_module_state->__pyx_n_u_html);
  Py_VISIT(traverse_module_state->__pyx_n_s_htmlfile);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_codespeak_net_lxml_objectif);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_exslt_org_regular_expressio);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_purl_org_dc_elements_1_1);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_schemas_xmlsoap_org_wsdl);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo);
  Py_VISIT(traverse_module_state->__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_1999_xhtml);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_2001_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_kp_u_http_www_w3_org_2001_XMLSchema);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i);
  Py_VISIT(traverse_module_state->__pyx_kp_u_http_www_w3_org_XML_1998_namesp);
  Py_VISIT(traverse_module_state->__pyx_kp_b_http_www_w3_org_XML_1998_namespa);
  Py_VISIT(traverse_module_state->__pyx_kp_u_http_www_w3_org_XML_1998_namespa);
  Py_VISIT(traverse_module_state->__pyx_n_s_huge_tree);
  Py_VISIT(traverse_module_state->__pyx_n_u_i);
  Py_VISIT(traverse_module_state->__pyx_n_s_id);
  Py_VISIT(traverse_module_state->__pyx_n_u_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_id_name);
  Py_VISIT(traverse_module_state->__pyx_n_u_idref);
  Py_VISIT(traverse_module_state->__pyx_n_u_idrefs);
  Py_VISIT(traverse_module_state->__pyx_n_u_implied);
  Py_VISIT(traverse_module_state->__pyx_n_s_import);
  Py_VISIT(traverse_module_state->__pyx_kp_u_in_public_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_inclusive);
  Py_VISIT(traverse_module_state->__pyx_n_s_inclusive_ns_prefixes);
  Py_VISIT(traverse_module_state->__pyx_kp_u_inconsistent_exit_action_in_cont);
  Py_VISIT(traverse_module_state->__pyx_n_s_indent);
  Py_VISIT(traverse_module_state->__pyx_n_s_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_index_out_of_range);
  Py_VISIT(traverse_module_state->__pyx_n_s_init);
  Py_VISIT(traverse_module_state->__pyx_n_s_init_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass);
  Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
  Py_VISIT(traverse_module_state->__pyx_n_s_input);
  Py_VISIT(traverse_module_state->__pyx_kp_u_input_is_not_an_Element);
  Py_VISIT(traverse_module_state->__pyx_n_s_input_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_insert);
  Py_VISIT(traverse_module_state->__pyx_n_s_insert_comments);
  Py_VISIT(traverse_module_state->__pyx_n_s_insert_pis);
  Py_VISIT(traverse_module_state->__pyx_n_s_inspect);
  Py_VISIT(traverse_module_state->__pyx_n_s_int);
  Py_VISIT(traverse_module_state->__pyx_n_s_int1);
  Py_VISIT(traverse_module_state->__pyx_n_s_int2);
  Py_VISIT(traverse_module_state->__pyx_n_u_internal);
  Py_VISIT(traverse_module_state->__pyx_kp_u_internal_error_tail);
  Py_VISIT(traverse_module_state->__pyx_kp_u_internal_error_text);
  Py_VISIT(traverse_module_state->__pyx_n_s_intersection);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_DTD_proxy_at_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_Document_proxy_at_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_Element_proxy_at_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_argument_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_element);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_event_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_node_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_io);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
  Py_VISIT(traverse_module_state->__pyx_kp_u_is_not_declared_in_scope);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_owned);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_standalone);
  Py_VISIT(traverse_module_state->__pyx_n_s_iselement);
  Py_VISIT(traverse_module_state->__pyx_n_u_iselement);
  Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
  Py_VISIT(traverse_module_state->__pyx_n_s_islice);
  Py_VISIT(traverse_module_state->__pyx_n_s_isspace);
  Py_VISIT(traverse_module_state->__pyx_n_s_item);
  Py_VISIT(traverse_module_state->__pyx_n_s_items);
  Py_VISIT(traverse_module_state->__pyx_n_u_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_iter_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_iter_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterancestors);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterattributes);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterchildren);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterdescendants);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterelements);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterentities);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterfind);
  Py_VISIT(traverse_module_state->__pyx_n_s_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterparse);
  Py_VISIT(traverse_module_state->__pyx_n_u_iterparse);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterparse_makeelement);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterparse_set_element_class_look);
  Py_VISIT(traverse_module_state->__pyx_n_s_itersiblings);
  Py_VISIT(traverse_module_state->__pyx_n_s_itertext);
  Py_VISIT(traverse_module_state->__pyx_n_s_itertools);
  Py_VISIT(traverse_module_state->__pyx_n_s_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_n_u_iterwalk);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterwalk_skip_subtree);
  Py_VISIT(traverse_module_state->__pyx_n_s_join);
  Py_VISIT(traverse_module_state->__pyx_n_s_k);
  Py_VISIT(traverse_module_state->__pyx_n_s_keep_ns_prefixes);
  Py_VISIT(traverse_module_state->__pyx_n_s_keep_tail);
  Py_VISIT(traverse_module_state->__pyx_n_s_key);
  Py_VISIT(traverse_module_state->__pyx_kp_u_key_not_found);
  Py_VISIT(traverse_module_state->__pyx_n_s_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_kw);
  Py_VISIT(traverse_module_state->__pyx_n_s_kwargs);
  Py_VISIT(traverse_module_state->__pyx_n_s_l);
  Py_VISIT(traverse_module_state->__pyx_n_s_last_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_len);
  Py_VISIT(traverse_module_state->__pyx_n_s_level);
  Py_VISIT(traverse_module_state->__pyx_n_s_level_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_levels);
  Py_VISIT(traverse_module_state->__pyx_kp_u_libxml2_d_d_d);
  Py_VISIT(traverse_module_state->__pyx_kp_u_line);
  Py_VISIT(traverse_module_state->__pyx_n_s_line_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_line_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_lineno);
  Py_VISIT(traverse_module_state->__pyx_kp_u_list_index_out_of_range);
  Py_VISIT(traverse_module_state->__pyx_kp_u_list_index_x_x_not_in_list);
  Py_VISIT(traverse_module_state->__pyx_kp_u_list_index_x_x_not_in_slice);
  Py_VISIT(traverse_module_state->__pyx_n_s_load);
  Py_VISIT(traverse_module_state->__pyx_n_s_load_dtd);
  Py_VISIT(traverse_module_state->__pyx_n_s_loads);
  Py_VISIT(traverse_module_state->__pyx_n_s_log);
  Py_VISIT(traverse_module_state->__pyx_n_s_log_entry);
  Py_VISIT(traverse_module_state->__pyx_n_s_logger);
  Py_VISIT(traverse_module_state->__pyx_n_s_logger_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_logging);
  Py_VISIT(traverse_module_state->__pyx_n_s_lookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_lower);
  Py_VISIT(traverse_module_state->__pyx_kp_u_lt);
  Py_VISIT(traverse_module_state->__pyx_n_s_lxml);
  Py_VISIT(traverse_module_state->__pyx_n_s_lxml_cssselect);
  Py_VISIT(traverse_module_state->__pyx_n_s_lxml_etree);
  Py_VISIT(traverse_module_state->__pyx_kp_u_lxml_etree_was_compiled_without);
  Py_VISIT(traverse_module_state->__pyx_n_s_main);
  Py_VISIT(traverse_module_state->__pyx_n_s_makeelement);
  Py_VISIT(traverse_module_state->__pyx_kp_u_malformed_PI_attributes);
  Py_VISIT(traverse_module_state->__pyx_n_b_match);
  Py_VISIT(traverse_module_state->__pyx_n_s_match);
  Py_VISIT(traverse_module_state->__pyx_n_u_match);
  Py_VISIT(traverse_module_state->__pyx_n_s_matcher);
  Py_VISIT(traverse_module_state->__pyx_n_u_matches);
  Py_VISIT(traverse_module_state->__pyx_n_s_max_depth);
  Py_VISIT(traverse_module_state->__pyx_n_s_max_len);
  Py_VISIT(traverse_module_state->__pyx_n_s_memo);
  Py_VISIT(traverse_module_state->__pyx_n_s_memory_debugger);
  Py_VISIT(traverse_module_state->__pyx_kp_b_memorydump);
  Py_VISIT(traverse_module_state->__pyx_kp_b_memorylist);
  Py_VISIT(traverse_module_state->__pyx_n_s_message);
  Py_VISIT(traverse_module_state->__pyx_n_s_metaclass);
  Py_VISIT(traverse_module_state->__pyx_n_s_method);
  Py_VISIT(traverse_module_state->__pyx_kp_u_missing_end_tags);
  Py_VISIT(traverse_module_state->__pyx_kp_u_missing_toplevel_element);
  Py_VISIT(traverse_module_state->__pyx_n_u_mixed);
  Py_VISIT(traverse_module_state->__pyx_n_s_mode);
  Py_VISIT(traverse_module_state->__pyx_n_s_module);
  Py_VISIT(traverse_module_state->__pyx_n_s_module_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_mro_entries);
  Py_VISIT(traverse_module_state->__pyx_n_u_mult);
  Py_VISIT(traverse_module_state->__pyx_n_s_n);
  Py_VISIT(traverse_module_state->__pyx_n_u_n);
  Py_VISIT(traverse_module_state->__pyx_n_s_name);
  Py_VISIT(traverse_module_state->__pyx_n_u_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_name_utf);
  Py_VISIT(traverse_module_state->__pyx_n_s_names);
  Py_VISIT(traverse_module_state->__pyx_n_s_namespace);
  Py_VISIT(traverse_module_state->__pyx_n_s_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_s_new);
  Py_VISIT(traverse_module_state->__pyx_n_s_new_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_new_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_new_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_s_new_pos);
  Py_VISIT(traverse_module_state->__pyx_n_u_nmtoken);
  Py_VISIT(traverse_module_state->__pyx_n_u_nmtokens);
  Py_VISIT(traverse_module_state->__pyx_kp_u_no_content_written);
  Py_VISIT(traverse_module_state->__pyx_kp_u_no_context_node);
  Py_VISIT(traverse_module_state->__pyx_kp_u_no_element_found);
  Py_VISIT(traverse_module_state->__pyx_n_s_no_network);
  Py_VISIT(traverse_module_state->__pyx_n_s_node);
  Py_VISIT(traverse_module_state->__pyx_n_u_none);
  Py_VISIT(traverse_module_state->__pyx_kp_u_not_allowed_inside_CDATA);
  Py_VISIT(traverse_module_state->__pyx_kp_u_not_found);
  Py_VISIT(traverse_module_state->__pyx_kp_u_not_found_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_not_in_an_element);
  Py_VISIT(traverse_module_state->__pyx_n_u_notation);
  Py_VISIT(traverse_module_state->__pyx_n_s_ns);
  Py_VISIT(traverse_module_state->__pyx_n_s_ns_clean);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ns_d);
  Py_VISIT(traverse_module_state->__pyx_kp_b_ns_d_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_ns_stack);
  Py_VISIT(traverse_module_state->__pyx_n_s_ns_uri);
  Py_VISIT(traverse_module_state->__pyx_n_s_ns_utf);
  Py_VISIT(traverse_module_state->__pyx_n_s_nsmap);
  Py_VISIT(traverse_module_state->__pyx_n_s_obj);
  Py_VISIT(traverse_module_state->__pyx_n_s_object);
  Py_VISIT(traverse_module_state->__pyx_kp_u_object_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_occur);
  Py_VISIT(traverse_module_state->__pyx_n_s_occur_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_of_QName);
  Py_VISIT(traverse_module_state->__pyx_kp_u_of_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_offset);
  Py_VISIT(traverse_module_state->__pyx_n_s_old);
  Py_VISIT(traverse_module_state->__pyx_n_s_old_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_old_writer);
  Py_VISIT(traverse_module_state->__pyx_n_u_once);
  Py_VISIT(traverse_module_state->__pyx_kp_u_only_XML_documents_have_declarat);
  Py_VISIT(traverse_module_state->__pyx_kp_u_only_setting_the_href_attribute);
  Py_VISIT(traverse_module_state->__pyx_n_s_open);
  Py_VISIT(traverse_module_state->__pyx_n_s_open_utf8_file);
  Py_VISIT(traverse_module_state->__pyx_n_u_opt);
  Py_VISIT(traverse_module_state->__pyx_n_s_options);
  Py_VISIT(traverse_module_state->__pyx_n_u_or);
  Py_VISIT(traverse_module_state->__pyx_n_s_os_path);
  Py_VISIT(traverse_module_state->__pyx_n_s_other_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_out);
  Py_VISIT(traverse_module_state->__pyx_n_s_outfile);
  Py_VISIT(traverse_module_state->__pyx_n_s_output_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_output_parent);
  Py_VISIT(traverse_module_state->__pyx_n_s_parent);
  Py_VISIT(traverse_module_state->__pyx_n_s_parse);
  Py_VISIT(traverse_module_state->__pyx_n_u_parse);
  Py_VISIT(traverse_module_state->__pyx_n_s_parseXSL);
  Py_VISIT(traverse_module_state->__pyx_n_s_parse_options);
  Py_VISIT(traverse_module_state->__pyx_n_s_parseid);
  Py_VISIT(traverse_module_state->__pyx_n_u_parseid);
  Py_VISIT(traverse_module_state->__pyx_n_s_parser);
  Py_VISIT(traverse_module_state->__pyx_kp_u_parser_locking_failed);
  Py_VISIT(traverse_module_state->__pyx_n_s_partial);
  Py_VISIT(traverse_module_state->__pyx_kp_u_passing_a_single_string_into_fro);
  Py_VISIT(traverse_module_state->__pyx_n_s_path);
  Py_VISIT(traverse_module_state->__pyx_n_s_path_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_pcdata);
  Py_VISIT(traverse_module_state->__pyx_kp_u_pending_open_tags_on_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_pi);
  Py_VISIT(traverse_module_state->__pyx_n_u_pi);
  Py_VISIT(traverse_module_state->__pyx_n_s_pi_factory);
  Py_VISIT(traverse_module_state->__pyx_n_u_plus);
  Py_VISIT(traverse_module_state->__pyx_n_s_pop);
  Py_VISIT(traverse_module_state->__pyx_kp_u_pop_expected_at_most_2_arguments);
  Py_VISIT(traverse_module_state->__pyx_n_s_position);
  Py_VISIT(traverse_module_state->__pyx_n_s_preceding);
  Py_VISIT(traverse_module_state->__pyx_n_s_prefix);
  Py_VISIT(traverse_module_state->__pyx_kp_u_prefix_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_prefix_utf);
  Py_VISIT(traverse_module_state->__pyx_n_s_prepare);
  Py_VISIT(traverse_module_state->__pyx_n_u_preserve);
  Py_VISIT(traverse_module_state->__pyx_n_s_pretty_print);
  Py_VISIT(traverse_module_state->__pyx_n_s_print);
  Py_VISIT(traverse_module_state->__pyx_n_s_process_children);
  Py_VISIT(traverse_module_state->__pyx_n_s_profile_run);
  Py_VISIT(traverse_module_state->__pyx_n_s_property);
  Py_VISIT(traverse_module_state->__pyx_n_s_public_id);
  Py_VISIT(traverse_module_state->__pyx_n_b_py);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyucs4_encoding_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
  Py_VISIT(traverse_module_state->__pyx_n_s_qname_aware_attrs);
  Py_VISIT(traverse_module_state->__pyx_n_s_qname_aware_tags);
  Py_VISIT(traverse_module_state->__pyx_n_s_qualname);
  Py_VISIT(traverse_module_state->__pyx_kp_u_quot);
  Py_VISIT(traverse_module_state->__pyx_n_s_r);
  Py_VISIT(traverse_module_state->__pyx_n_s_raise_on_error);
  Py_VISIT(traverse_module_state->__pyx_n_s_range);
  Py_VISIT(traverse_module_state->__pyx_n_u_rb);
  Py_VISIT(traverse_module_state->__pyx_n_s_rclose);
  Py_VISIT(traverse_module_state->__pyx_n_b_rdf);
  Py_VISIT(traverse_module_state->__pyx_n_s_re);
  Py_VISIT(traverse_module_state->__pyx_n_s_read);
  Py_VISIT(traverse_module_state->__pyx_n_u_read);
  Py_VISIT(traverse_module_state->__pyx_n_s_read_events);
  Py_VISIT(traverse_module_state->__pyx_n_s_read_file);
  Py_VISIT(traverse_module_state->__pyx_n_u_read_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_read_network);
  Py_VISIT(traverse_module_state->__pyx_n_u_read_network);
  Py_VISIT(traverse_module_state->__pyx_kp_u_reading_file_objects_must_return);
  Py_VISIT(traverse_module_state->__pyx_kp_u_reading_from_file_like_objects_m);
  Py_VISIT(traverse_module_state->__pyx_n_s_receive);
  Py_VISIT(traverse_module_state->__pyx_n_s_recover);
  Py_VISIT(traverse_module_state->__pyx_kp_u_reference_to_non_existing_embedd);
  Py_VISIT(traverse_module_state->__pyx_n_s_regexp);
  Py_VISIT(traverse_module_state->__pyx_n_s_register);
  Py_VISIT(traverse_module_state->__pyx_n_s_register_namespace);
  Py_VISIT(traverse_module_state->__pyx_n_u_register_namespace);
  Py_VISIT(traverse_module_state->__pyx_n_s_register_namespaces);
  Py_VISIT(traverse_module_state->__pyx_n_s_registry);
  Py_VISIT(traverse_module_state->__pyx_n_s_relaxng);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove_blank_text);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove_comments);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove_pis);
  Py_VISIT(traverse_module_state->__pyx_n_b_replace);
  Py_VISIT(traverse_module_state->__pyx_n_s_replace);
  Py_VISIT(traverse_module_state->__pyx_n_s_replacement);
  Py_VISIT(traverse_module_state->__pyx_n_u_required);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_empty);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_entities);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_external_entities);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolve_string);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolver);
  Py_VISIT(traverse_module_state->__pyx_n_s_resolvers);
  Py_VISIT(traverse_module_state->__pyx_kp_u_restructuredtext_en);
  Py_VISIT(traverse_module_state->__pyx_n_s_result);
  Py_VISIT(traverse_module_state->__pyx_n_s_result_container);
  Py_VISIT(traverse_module_state->__pyx_n_s_result_doc);
  Py_VISIT(traverse_module_state->__pyx_n_s_result_list);
  Py_VISIT(traverse_module_state->__pyx_n_s_result_node);
  Py_VISIT(traverse_module_state->__pyx_kp_u_result_of_class_lookup_must_be_s);
  Py_VISIT(traverse_module_state->__pyx_n_s_result_tree);
  Py_VISIT(traverse_module_state->__pyx_n_s_results);
  Py_VISIT(traverse_module_state->__pyx_n_s_reversed);
  Py_VISIT(traverse_module_state->__pyx_n_s_reversed_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_reversed_nsmap);
  Py_VISIT(traverse_module_state->__pyx_n_s_rewrite_prefixes);
  Py_VISIT(traverse_module_state->__pyx_n_s_rexp);
  Py_VISIT(traverse_module_state->__pyx_n_s_rexpc);
  Py_VISIT(traverse_module_state->__pyx_kp_u_rnc);
  Py_VISIT(traverse_module_state->__pyx_n_s_rnc2rng);
  Py_VISIT(traverse_module_state->__pyx_n_s_rng_str);
  Py_VISIT(traverse_module_state->__pyx_n_s_root);
  Py_VISIT(traverse_module_state->__pyx_n_s_rsplit);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_s_4);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s_href_s_s);
  Py_VISIT(traverse_module_state->__pyx_n_s_s_match);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s_r);
  Py_VISIT(traverse_module_state->__pyx_kp_u_s_w_s_s);
  Py_VISIT(traverse_module_state->__pyx_n_s_schema);
  Py_VISIT(traverse_module_state->__pyx_n_b_script);
  Py_VISIT(traverse_module_state->__pyx_n_s_search);
  Py_VISIT(traverse_module_state->__pyx_n_s_self);
  Py_VISIT(traverse_module_state->__pyx_n_s_self_node);
  Py_VISIT(traverse_module_state->__pyx_n_s_send);
  Py_VISIT(traverse_module_state->__pyx_n_u_seq);
  Py_VISIT(traverse_module_state->__pyx_n_s_sequence_or_dict);
  Py_VISIT(traverse_module_state->__pyx_n_s_set);
  Py_VISIT(traverse_module_state->__pyx_n_s_set_default_parser);
  Py_VISIT(traverse_module_state->__pyx_n_u_set_default_parser);
  Py_VISIT(traverse_module_state->__pyx_n_s_set_element_class_lookup);
  Py_VISIT(traverse_module_state->__pyx_n_u_set_element_class_lookup);
  Py_VISIT(traverse_module_state->__pyx_n_s_set_fallback);
  Py_VISIT(traverse_module_state->__pyx_n_s_set_global_max_depth);
  Py_VISIT(traverse_module_state->__pyx_n_s_set_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_setitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_setroot);
  Py_VISIT(traverse_module_state->__pyx_n_s_setter);
  Py_VISIT(traverse_module_state->__pyx_kp_u_setting_default_namespace_is_not);
  Py_VISIT(traverse_module_state->__pyx_n_s_show);
  Py_VISIT(traverse_module_state->__pyx_n_s_sio);
  Py_VISIT(traverse_module_state->__pyx_n_s_skip_subtree);
  Py_VISIT(traverse_module_state->__pyx_n_s_smart_strings);
  Py_VISIT(traverse_module_state->__pyx_n_s_sorted);
  Py_VISIT(traverse_module_state->__pyx_n_s_source);
  Py_VISIT(traverse_module_state->__pyx_n_s_space);
  Py_VISIT(traverse_module_state->__pyx_n_s_spec);
  Py_VISIT(traverse_module_state->__pyx_n_s_split);
  Py_VISIT(traverse_module_state->__pyx_n_s_splitlines);
  Py_VISIT(traverse_module_state->__pyx_n_s_src);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_classlookup_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_cleanup_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_debug_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_docloader_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_dtd_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_etree_pyx);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_extensions_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_iterparse_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_nsclasses_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_parser_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_parsertarget_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_readonlytree_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_relaxng_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_saxparser_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_serializer_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_xmlerror_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_xmlid_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_xpath_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_xslt_pxi);
  Py_VISIT(traverse_module_state->__pyx_kp_s_src_lxml_xsltext_pxi);
  Py_VISIT(traverse_module_state->__pyx_n_s_stacklevel);
  Py_VISIT(traverse_module_state->__pyx_n_s_standalone);
  Py_VISIT(traverse_module_state->__pyx_n_s_start);
  Py_VISIT(traverse_module_state->__pyx_n_u_start);
  Py_VISIT(traverse_module_state->__pyx_kp_u_start_ns);
  Py_VISIT(traverse_module_state->__pyx_n_s_start_ns_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_startswith);
  Py_VISIT(traverse_module_state->__pyx_n_s_staticmethod);
  Py_VISIT(traverse_module_state->__pyx_n_s_stdout);
  Py_VISIT(traverse_module_state->__pyx_n_s_stop);
  Py_VISIT(traverse_module_state->__pyx_n_s_store_exception);
  Py_VISIT(traverse_module_state->__pyx_n_s_str1);
  Py_VISIT(traverse_module_state->__pyx_n_s_str2);
  Py_VISIT(traverse_module_state->__pyx_n_s_str3);
  Py_VISIT(traverse_module_state->__pyx_kp_u_string);
  Py_VISIT(traverse_module_state->__pyx_n_s_string_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_string___STRING__XSLT);
  Py_VISIT(traverse_module_state->__pyx_kp_u_string_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_strings);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip_attributes);
  Py_VISIT(traverse_module_state->__pyx_n_u_strip_attributes);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip_cdata);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip_elements);
  Py_VISIT(traverse_module_state->__pyx_n_u_strip_elements);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip_tags);
  Py_VISIT(traverse_module_state->__pyx_n_u_strip_tags);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip_text);
  Py_VISIT(traverse_module_state->__pyx_n_s_strparam);
  Py_VISIT(traverse_module_state->__pyx_n_s_strval);
  Py_VISIT(traverse_module_state->__pyx_n_b_style);
  Py_VISIT(traverse_module_state->__pyx_n_s_style);
  Py_VISIT(traverse_module_state->__pyx_n_s_sub);
  Py_VISIT(traverse_module_state->__pyx_n_s_super);
  Py_VISIT(traverse_module_state->__pyx_n_s_sys);
  Py_VISIT(traverse_module_state->__pyx_n_s_system_url);
  Py_VISIT(traverse_module_state->__pyx_n_s_tag);
  Py_VISIT(traverse_module_state->__pyx_n_s_tag_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_tag_names);
  Py_VISIT(traverse_module_state->__pyx_n_s_tags);
  Py_VISIT(traverse_module_state->__pyx_n_s_tail);
  Py_VISIT(traverse_module_state->__pyx_n_s_target);
  Py_VISIT(traverse_module_state->__pyx_n_s_tell);
  Py_VISIT(traverse_module_state->__pyx_n_u_tell);
  Py_VISIT(traverse_module_state->__pyx_n_b_test);
  Py_VISIT(traverse_module_state->__pyx_n_s_test);
  Py_VISIT(traverse_module_state->__pyx_n_s_test_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_text);
  Py_VISIT(traverse_module_state->__pyx_n_u_text);
  Py_VISIT(traverse_module_state->__pyx_n_s_text_or_uri_or_element);
  Py_VISIT(traverse_module_state->__pyx_kp_u_text_root);
  Py_VISIT(traverse_module_state->__pyx_kp_u_this_element_does_not_have_child);
  Py_VISIT(traverse_module_state->__pyx_n_s_throw);
  Py_VISIT(traverse_module_state->__pyx_kp_u_to_extended_slice_of_size);
  Py_VISIT(traverse_module_state->__pyx_n_s_top_nsmap);
  Py_VISIT(traverse_module_state->__pyx_n_s_tostring);
  Py_VISIT(traverse_module_state->__pyx_n_u_tostring);
  Py_VISIT(traverse_module_state->__pyx_n_s_tostringlist);
  Py_VISIT(traverse_module_state->__pyx_n_u_tostringlist);
  Py_VISIT(traverse_module_state->__pyx_n_s_tounicode);
  Py_VISIT(traverse_module_state->__pyx_n_u_tounicode);
  Py_VISIT(traverse_module_state->__pyx_n_s_translator);
  Py_VISIT(traverse_module_state->__pyx_n_s_tree);
  Py_VISIT(traverse_module_state->__pyx_n_s_tree_or_element);
  Py_VISIT(traverse_module_state->__pyx_n_s_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_type_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_type_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_type_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_types);
  Py_VISIT(traverse_module_state->__pyx_kp_u_undecodable_error_message);
  Py_VISIT(traverse_module_state->__pyx_n_u_undefined);
  Py_VISIT(traverse_module_state->__pyx_n_u_unicode);
  Py_VISIT(traverse_module_state->__pyx_n_u_unknown);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_encoding);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_error);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_error_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_output_method);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_XSLT_result_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_element_type_for_top);
  Py_VISIT(traverse_module_state->__pyx_n_s_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_upper);
  Py_VISIT(traverse_module_state->__pyx_n_s_uri);
  Py_VISIT(traverse_module_state->__pyx_n_s_uri_utf);
  Py_VISIT(traverse_module_state->__pyx_n_s_url);
  Py_VISIT(traverse_module_state->__pyx_n_s_use_global_python_log);
  Py_VISIT(traverse_module_state->__pyx_n_u_use_global_python_log);
  Py_VISIT(traverse_module_state->__pyx_n_u_utf8);
  Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8);
  Py_VISIT(traverse_module_state->__pyx_n_s_v);
  Py_VISIT(traverse_module_state->__pyx_n_s_validate);
  Py_VISIT(traverse_module_state->__pyx_n_s_value);
  Py_VISIT(traverse_module_state->__pyx_n_s_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_variables);
  Py_VISIT(traverse_module_state->__pyx_n_s_variables_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_version);
  Py_VISIT(traverse_module_state->__pyx_n_s_version_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_w);
  Py_VISIT(traverse_module_state->__pyx_kp_u_w_w);
  Py_VISIT(traverse_module_state->__pyx_n_s_warn);
  Py_VISIT(traverse_module_state->__pyx_n_s_warnings);
  Py_VISIT(traverse_module_state->__pyx_n_u_wb);
  Py_VISIT(traverse_module_state->__pyx_n_s_with_comments);
  Py_VISIT(traverse_module_state->__pyx_n_s_with_prefixes);
  Py_VISIT(traverse_module_state->__pyx_n_s_with_tail);
  Py_VISIT(traverse_module_state->__pyx_n_s_write);
  Py_VISIT(traverse_module_state->__pyx_n_u_write);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_c14n);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_declaration);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_doctype);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_file);
  Py_VISIT(traverse_module_state->__pyx_n_u_write_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_network);
  Py_VISIT(traverse_module_state->__pyx_n_u_write_network);
  Py_VISIT(traverse_module_state->__pyx_n_s_write_output);
  Py_VISIT(traverse_module_state->__pyx_n_s_writer);
  Py_VISIT(traverse_module_state->__pyx_n_b_wsdl);
  Py_VISIT(traverse_module_state->__pyx_n_u_x);
  Py_VISIT(traverse_module_state->__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9);
  Py_VISIT(traverse_module_state->__pyx_kp_u_x9);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xA);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xD);
  Py_VISIT(traverse_module_state->__pyx_n_s_xinclude);
  Py_VISIT(traverse_module_state->__pyx_n_b_xml);
  Py_VISIT(traverse_module_state->__pyx_n_s_xml);
  Py_VISIT(traverse_module_state->__pyx_n_u_xml);
  Py_VISIT(traverse_module_state->__pyx_n_s_xml_data);
  Py_VISIT(traverse_module_state->__pyx_n_s_xml_declaration);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xml_s_encoding_s_s_s);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xml_xml);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlfile);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlfile___aenter);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlfile___aexit);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlfile___enter);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlfile___exit);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xmlns);
  Py_VISIT(traverse_module_state->__pyx_n_b_xmlns_2);
  Py_VISIT(traverse_module_state->__pyx_n_u_xmlns_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_xmlschema);
  Py_VISIT(traverse_module_state->__pyx_n_s_xpath);
  Py_VISIT(traverse_module_state->__pyx_n_s_xpath_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_xrange);
  Py_VISIT(traverse_module_state->__pyx_n_b_xs);
  Py_VISIT(traverse_module_state->__pyx_n_u_xs);
  Py_VISIT(traverse_module_state->__pyx_n_b_xsi);
  Py_VISIT(traverse_module_state->__pyx_n_b_xsl);
  Py_VISIT(traverse_module_state->__pyx_n_u_xsl);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xsl_stylesheet_xml_id_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_xslt);
  Py_VISIT(traverse_module_state->__pyx_kp_u_xslt_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_xslt_3);
  Py_VISIT(traverse_module_state->__pyx_n_s_xslt_input);
  Py_VISIT(traverse_module_state->__pyx_n_s_zf);
  Py_VISIT(traverse_module_state->__pyx_int_0);
  Py_VISIT(traverse_module_state->__pyx_int_1);
  Py_VISIT(traverse_module_state->__pyx_int_2);
  Py_VISIT(traverse_module_state->__pyx_int_3);
  Py_VISIT(traverse_module_state->__pyx_int_4);
  Py_VISIT(traverse_module_state->__pyx_int_5);
  Py_VISIT(traverse_module_state->__pyx_int_100);
  Py_VISIT(traverse_module_state->__pyx_int_32768);
  Py_VISIT(traverse_module_state->__pyx_int_neg_1);
  Py_VISIT(traverse_module_state->__pyx_int_neg_4);
  Py_VISIT(traverse_module_state->__pyx_int_neg_100);
  Py_VISIT(traverse_module_state->__pyx_int_neg_200);
  Py_VISIT(traverse_module_state->__pyx_int_neg_300);
  Py_VISIT(traverse_module_state->__pyx_tuple_);
  Py_VISIT(traverse_module_state->__pyx_slice__6);
  Py_VISIT(traverse_module_state->__pyx_slice__7);
  Py_VISIT(traverse_module_state->__pyx_slice__8);
  Py_VISIT(traverse_module_state->__pyx_slice__9);
  Py_VISIT(traverse_module_state->__pyx_tuple__2);
  Py_VISIT(traverse_module_state->__pyx_tuple__5);
  Py_VISIT(traverse_module_state->__pyx_slice__44);
  Py_VISIT(traverse_module_state->__pyx_slice__55);
  Py_VISIT(traverse_module_state->__pyx_slice__69);
  Py_VISIT(traverse_module_state->__pyx_slice__80);
  Py_VISIT(traverse_module_state->__pyx_slice__81);
  Py_VISIT(traverse_module_state->__pyx_slice__93);
  Py_VISIT(traverse_module_state->__pyx_slice__94);
  Py_VISIT(traverse_module_state->__pyx_tuple__10);
  Py_VISIT(traverse_module_state->__pyx_tuple__13);
  Py_VISIT(traverse_module_state->__pyx_tuple__14);
  Py_VISIT(traverse_module_state->__pyx_tuple__15);
  Py_VISIT(traverse_module_state->__pyx_tuple__16);
  Py_VISIT(traverse_module_state->__pyx_tuple__23);
  Py_VISIT(traverse_module_state->__pyx_tuple__27);
  Py_VISIT(traverse_module_state->__pyx_tuple__31);
  Py_VISIT(traverse_module_state->__pyx_tuple__36);
  Py_VISIT(traverse_module_state->__pyx_tuple__37);
  Py_VISIT(traverse_module_state->__pyx_tuple__38);
  Py_VISIT(traverse_module_state->__pyx_tuple__39);
  Py_VISIT(traverse_module_state->__pyx_tuple__40);
  Py_VISIT(traverse_module_state->__pyx_tuple__46);
  Py_VISIT(traverse_module_state->__pyx_tuple__47);
  Py_VISIT(traverse_module_state->__pyx_tuple__49);
  Py_VISIT(traverse_module_state->__pyx_tuple__51);
  Py_VISIT(traverse_module_state->__pyx_tuple__53);
  Py_VISIT(traverse_module_state->__pyx_tuple__54);
  Py_VISIT(traverse_module_state->__pyx_tuple__58);
  Py_VISIT(traverse_module_state->__pyx_tuple__59);
  Py_VISIT(traverse_module_state->__pyx_tuple__60);
  Py_VISIT(traverse_module_state->__pyx_tuple__64);
  Py_VISIT(traverse_module_state->__pyx_tuple__65);
  Py_VISIT(traverse_module_state->__pyx_tuple__66);
  Py_VISIT(traverse_module_state->__pyx_tuple__68);
  Py_VISIT(traverse_module_state->__pyx_tuple__70);
  Py_VISIT(traverse_module_state->__pyx_tuple__77);
  Py_VISIT(traverse_module_state->__pyx_tuple__78);
  Py_VISIT(traverse_module_state->__pyx_tuple__91);
  Py_VISIT(traverse_module_state->__pyx_tuple__92);
  Py_VISIT(traverse_module_state->__pyx_tuple__97);
  Py_VISIT(traverse_module_state->__pyx_tuple__98);
  Py_VISIT(traverse_module_state->__pyx_slice__105);
  Py_VISIT(traverse_module_state->__pyx_tuple__103);
  Py_VISIT(traverse_module_state->__pyx_tuple__104);
  Py_VISIT(traverse_module_state->__pyx_tuple__107);
  Py_VISIT(traverse_module_state->__pyx_tuple__109);
  Py_VISIT(traverse_module_state->__pyx_tuple__113);
  Py_VISIT(traverse_module_state->__pyx_tuple__116);
  Py_VISIT(traverse_module_state->__pyx_tuple__117);
  Py_VISIT(traverse_module_state->__pyx_tuple__118);
  Py_VISIT(traverse_module_state->__pyx_tuple__120);
  Py_VISIT(traverse_module_state->__pyx_tuple__123);
  Py_VISIT(traverse_module_state->__pyx_tuple__126);
  Py_VISIT(traverse_module_state->__pyx_tuple__128);
  Py_VISIT(traverse_module_state->__pyx_tuple__130);
  Py_VISIT(traverse_module_state->__pyx_tuple__132);
  Py_VISIT(traverse_module_state->__pyx_tuple__137);
  Py_VISIT(traverse_module_state->__pyx_tuple__145);
  Py_VISIT(traverse_module_state->__pyx_tuple__147);
  Py_VISIT(traverse_module_state->__pyx_tuple__149);
  Py_VISIT(traverse_module_state->__pyx_tuple__151);
  Py_VISIT(traverse_module_state->__pyx_tuple__152);
  Py_VISIT(traverse_module_state->__pyx_tuple__153);
  Py_VISIT(traverse_module_state->__pyx_tuple__154);
  Py_VISIT(traverse_module_state->__pyx_tuple__155);
  Py_VISIT(traverse_module_state->__pyx_tuple__156);
  Py_VISIT(traverse_module_state->__pyx_tuple__157);
  Py_VISIT(traverse_module_state->__pyx_tuple__158);
  Py_VISIT(traverse_module_state->__pyx_tuple__159);
  Py_VISIT(traverse_module_state->__pyx_tuple__160);
  Py_VISIT(traverse_module_state->__pyx_tuple__163);
  Py_VISIT(traverse_module_state->__pyx_tuple__165);
  Py_VISIT(traverse_module_state->__pyx_tuple__168);
  Py_VISIT(traverse_module_state->__pyx_tuple__172);
  Py_VISIT(traverse_module_state->__pyx_tuple__174);
  Py_VISIT(traverse_module_state->__pyx_tuple__176);
  Py_VISIT(traverse_module_state->__pyx_tuple__177);
  Py_VISIT(traverse_module_state->__pyx_tuple__179);
  Py_VISIT(traverse_module_state->__pyx_tuple__181);
  Py_VISIT(traverse_module_state->__pyx_tuple__184);
  Py_VISIT(traverse_module_state->__pyx_tuple__186);
  Py_VISIT(traverse_module_state->__pyx_tuple__187);
  Py_VISIT(traverse_module_state->__pyx_tuple__189);
  Py_VISIT(traverse_module_state->__pyx_tuple__194);
  Py_VISIT(traverse_module_state->__pyx_tuple__198);
  Py_VISIT(traverse_module_state->__pyx_tuple__200);
  Py_VISIT(traverse_module_state->__pyx_tuple__203);
  Py_VISIT(traverse_module_state->__pyx_tuple__208);
  Py_VISIT(traverse_module_state->__pyx_tuple__210);
  Py_VISIT(traverse_module_state->__pyx_tuple__212);
  Py_VISIT(traverse_module_state->__pyx_tuple__214);
  Py_VISIT(traverse_module_state->__pyx_tuple__218);
  Py_VISIT(traverse_module_state->__pyx_tuple__220);
  Py_VISIT(traverse_module_state->__pyx_tuple__223);
  Py_VISIT(traverse_module_state->__pyx_tuple__225);
  Py_VISIT(traverse_module_state->__pyx_tuple__232);
  Py_VISIT(traverse_module_state->__pyx_tuple__234);
  Py_VISIT(traverse_module_state->__pyx_tuple__238);
  Py_VISIT(traverse_module_state->__pyx_tuple__240);
  Py_VISIT(traverse_module_state->__pyx_tuple__242);
  Py_VISIT(traverse_module_state->__pyx_tuple__244);
  Py_VISIT(traverse_module_state->__pyx_tuple__246);
  Py_VISIT(traverse_module_state->__pyx_tuple__249);
  Py_VISIT(traverse_module_state->__pyx_tuple__251);
  Py_VISIT(traverse_module_state->__pyx_tuple__256);
  Py_VISIT(traverse_module_state->__pyx_tuple__258);
  Py_VISIT(traverse_module_state->__pyx_tuple__260);
  Py_VISIT(traverse_module_state->__pyx_tuple__263);
  Py_VISIT(traverse_module_state->__pyx_tuple__265);
  Py_VISIT(traverse_module_state->__pyx_tuple__267);
  Py_VISIT(traverse_module_state->__pyx_tuple__269);
  Py_VISIT(traverse_module_state->__pyx_tuple__281);
  Py_VISIT(traverse_module_state->__pyx_tuple__283);
  Py_VISIT(traverse_module_state->__pyx_tuple__285);
  Py_VISIT(traverse_module_state->__pyx_tuple__287);
  Py_VISIT(traverse_module_state->__pyx_tuple__289);
  Py_VISIT(traverse_module_state->__pyx_tuple__291);
  Py_VISIT(traverse_module_state->__pyx_tuple__293);
  Py_VISIT(traverse_module_state->__pyx_tuple__297);
  Py_VISIT(traverse_module_state->__pyx_tuple__299);
  Py_VISIT(traverse_module_state->__pyx_tuple__301);
  Py_VISIT(traverse_module_state->__pyx_tuple__303);
  Py_VISIT(traverse_module_state->__pyx_tuple__304);
  Py_VISIT(traverse_module_state->__pyx_tuple__306);
  Py_VISIT(traverse_module_state->__pyx_tuple__308);
  Py_VISIT(traverse_module_state->__pyx_tuple__310);
  Py_VISIT(traverse_module_state->__pyx_tuple__312);
  Py_VISIT(traverse_module_state->__pyx_tuple__314);
  Py_VISIT(traverse_module_state->__pyx_tuple__318);
  Py_VISIT(traverse_module_state->__pyx_tuple__321);
  Py_VISIT(traverse_module_state->__pyx_tuple__329);
  Py_VISIT(traverse_module_state->__pyx_tuple__334);
  Py_VISIT(traverse_module_state->__pyx_tuple__336);
  Py_VISIT(traverse_module_state->__pyx_tuple__338);
  Py_VISIT(traverse_module_state->__pyx_tuple__340);
  Py_VISIT(traverse_module_state->__pyx_tuple__342);
  Py_VISIT(traverse_module_state->__pyx_tuple__347);
  Py_VISIT(traverse_module_state->__pyx_tuple__349);
  Py_VISIT(traverse_module_state->__pyx_tuple__351);
  Py_VISIT(traverse_module_state->__pyx_tuple__353);
  Py_VISIT(traverse_module_state->__pyx_tuple__355);
  Py_VISIT(traverse_module_state->__pyx_tuple__357);
  Py_VISIT(traverse_module_state->__pyx_tuple__359);
  Py_VISIT(traverse_module_state->__pyx_tuple__361);
  Py_VISIT(traverse_module_state->__pyx_tuple__363);
  Py_VISIT(traverse_module_state->__pyx_tuple__367);
  Py_VISIT(traverse_module_state->__pyx_tuple__369);
  Py_VISIT(traverse_module_state->__pyx_tuple__372);
  Py_VISIT(traverse_module_state->__pyx_tuple__377);
  Py_VISIT(traverse_module_state->__pyx_tuple__381);
  Py_VISIT(traverse_module_state->__pyx_tuple__385);
  Py_VISIT(traverse_module_state->__pyx_tuple__389);
  Py_VISIT(traverse_module_state->__pyx_tuple__391);
  Py_VISIT(traverse_module_state->__pyx_tuple__393);
  Py_VISIT(traverse_module_state->__pyx_tuple__395);
  Py_VISIT(traverse_module_state->__pyx_tuple__397);
  Py_VISIT(traverse_module_state->__pyx_tuple__399);
  Py_VISIT(traverse_module_state->__pyx_tuple__400);
  Py_VISIT(traverse_module_state->__pyx_tuple__401);
  Py_VISIT(traverse_module_state->__pyx_tuple__403);
  Py_VISIT(traverse_module_state->__pyx_tuple__405);
  Py_VISIT(traverse_module_state->__pyx_tuple__407);
  Py_VISIT(traverse_module_state->__pyx_tuple__409);
  Py_VISIT(traverse_module_state->__pyx_tuple__411);
  Py_VISIT(traverse_module_state->__pyx_tuple__416);
  Py_VISIT(traverse_module_state->__pyx_tuple__418);
  Py_VISIT(traverse_module_state->__pyx_tuple__420);
  Py_VISIT(traverse_module_state->__pyx_tuple__422);
  Py_VISIT(traverse_module_state->__pyx_tuple__424);
  Py_VISIT(traverse_module_state->__pyx_tuple__426);
  Py_VISIT(traverse_module_state->__pyx_tuple__431);
  Py_VISIT(traverse_module_state->__pyx_tuple__432);
  Py_VISIT(traverse_module_state->__pyx_tuple__433);
  Py_VISIT(traverse_module_state->__pyx_tuple__434);
  Py_VISIT(traverse_module_state->__pyx_tuple__436);
  Py_VISIT(traverse_module_state->__pyx_tuple__438);
  Py_VISIT(traverse_module_state->__pyx_tuple__439);
  Py_VISIT(traverse_module_state->__pyx_tuple__441);
  Py_VISIT(traverse_module_state->__pyx_tuple__448);
  Py_VISIT(traverse_module_state->__pyx_tuple__450);
  Py_VISIT(traverse_module_state->__pyx_tuple__452);
  Py_VISIT(traverse_module_state->__pyx_tuple__455);
  Py_VISIT(traverse_module_state->__pyx_tuple__462);
  Py_VISIT(traverse_module_state->__pyx_tuple__465);
  Py_VISIT(traverse_module_state->__pyx_tuple__467);
  Py_VISIT(traverse_module_state->__pyx_tuple__469);
  Py_VISIT(traverse_module_state->__pyx_tuple__471);
  Py_VISIT(traverse_module_state->__pyx_tuple__473);
  Py_VISIT(traverse_module_state->__pyx_tuple__474);
  Py_VISIT(traverse_module_state->__pyx_tuple__476);
  Py_VISIT(traverse_module_state->__pyx_tuple__478);
  Py_VISIT(traverse_module_state->__pyx_tuple__479);
  Py_VISIT(traverse_module_state->__pyx_tuple__481);
  Py_VISIT(traverse_module_state->__pyx_tuple__485);
  Py_VISIT(traverse_module_state->__pyx_tuple__487);
  Py_VISIT(traverse_module_state->__pyx_tuple__490);
  Py_VISIT(traverse_module_state->__pyx_tuple__492);
  Py_VISIT(traverse_module_state->__pyx_tuple__493);
  Py_VISIT(traverse_module_state->__pyx_tuple__495);
  Py_VISIT(traverse_module_state->__pyx_tuple__497);
  Py_VISIT(traverse_module_state->__pyx_tuple__501);
  Py_VISIT(traverse_module_state->__pyx_tuple__503);
  Py_VISIT(traverse_module_state->__pyx_tuple__504);
  Py_VISIT(traverse_module_state->__pyx_tuple__506);
  Py_VISIT(traverse_module_state->__pyx_tuple__508);
  Py_VISIT(traverse_module_state->__pyx_tuple__510);
  Py_VISIT(traverse_module_state->__pyx_tuple__512);
  Py_VISIT(traverse_module_state->__pyx_tuple__514);
  Py_VISIT(traverse_module_state->__pyx_tuple__518);
  Py_VISIT(traverse_module_state->__pyx_tuple__522);
  Py_VISIT(traverse_module_state->__pyx_tuple__526);
  Py_VISIT(traverse_module_state->__pyx_tuple__528);
  Py_VISIT(traverse_module_state->__pyx_tuple__531);
  Py_VISIT(traverse_module_state->__pyx_tuple__533);
  Py_VISIT(traverse_module_state->__pyx_tuple__535);
  Py_VISIT(traverse_module_state->__pyx_codeobj__62);
  Py_VISIT(traverse_module_state->__pyx_codeobj__67);
  Py_VISIT(traverse_module_state->__pyx_codeobj__76);
  Py_VISIT(traverse_module_state->__pyx_codeobj__79);
  Py_VISIT(traverse_module_state->__pyx_codeobj__82);
  Py_VISIT(traverse_module_state->__pyx_codeobj__83);
  Py_VISIT(traverse_module_state->__pyx_codeobj__84);
  Py_VISIT(traverse_module_state->__pyx_codeobj__85);
  Py_VISIT(traverse_module_state->__pyx_codeobj__86);
  Py_VISIT(traverse_module_state->__pyx_codeobj__87);
  Py_VISIT(traverse_module_state->__pyx_codeobj__88);
  Py_VISIT(traverse_module_state->__pyx_codeobj__89);
  Py_VISIT(traverse_module_state->__pyx_codeobj__90);
  Py_VISIT(traverse_module_state->__pyx_codeobj__99);
  Py_VISIT(traverse_module_state->__pyx_codeobj__100);
  Py_VISIT(traverse_module_state->__pyx_codeobj__101);
  Py_VISIT(traverse_module_state->__pyx_codeobj__102);
  Py_VISIT(traverse_module_state->__pyx_codeobj__108);
  Py_VISIT(traverse_module_state->__pyx_codeobj__110);
  Py_VISIT(traverse_module_state->__pyx_codeobj__111);
  Py_VISIT(traverse_module_state->__pyx_codeobj__112);
  Py_VISIT(traverse_module_state->__pyx_codeobj__114);
  Py_VISIT(traverse_module_state->__pyx_codeobj__115);
  Py_VISIT(traverse_module_state->__pyx_codeobj__119);
  Py_VISIT(traverse_module_state->__pyx_codeobj__121);
  Py_VISIT(traverse_module_state->__pyx_codeobj__122);
  Py_VISIT(traverse_module_state->__pyx_codeobj__124);
  Py_VISIT(traverse_module_state->__pyx_codeobj__125);
  Py_VISIT(traverse_module_state->__pyx_codeobj__127);
  Py_VISIT(traverse_module_state->__pyx_codeobj__129);
  Py_VISIT(traverse_module_state->__pyx_codeobj__131);
  Py_VISIT(traverse_module_state->__pyx_codeobj__133);
  Py_VISIT(traverse_module_state->__pyx_codeobj__134);
  Py_VISIT(traverse_module_state->__pyx_codeobj__135);
  Py_VISIT(traverse_module_state->__pyx_codeobj__136);
  Py_VISIT(traverse_module_state->__pyx_codeobj__138);
  Py_VISIT(traverse_module_state->__pyx_codeobj__139);
  Py_VISIT(traverse_module_state->__pyx_codeobj__140);
  Py_VISIT(traverse_module_state->__pyx_codeobj__141);
  Py_VISIT(traverse_module_state->__pyx_codeobj__142);
  Py_VISIT(traverse_module_state->__pyx_codeobj__143);
  Py_VISIT(traverse_module_state->__pyx_codeobj__144);
  Py_VISIT(traverse_module_state->__pyx_codeobj__146);
  Py_VISIT(traverse_module_state->__pyx_codeobj__148);
  Py_VISIT(traverse_module_state->__pyx_codeobj__150);
  Py_VISIT(traverse_module_state->__pyx_codeobj__161);
  Py_VISIT(traverse_module_state->__pyx_codeobj__162);
  Py_VISIT(traverse_module_state->__pyx_codeobj__164);
  Py_VISIT(traverse_module_state->__pyx_codeobj__166);
  Py_VISIT(traverse_module_state->__pyx_codeobj__167);
  Py_VISIT(traverse_module_state->__pyx_codeobj__169);
  Py_VISIT(traverse_module_state->__pyx_codeobj__170);
  Py_VISIT(traverse_module_state->__pyx_codeobj__171);
  Py_VISIT(traverse_module_state->__pyx_codeobj__173);
  Py_VISIT(traverse_module_state->__pyx_codeobj__175);
  Py_VISIT(traverse_module_state->__pyx_codeobj__178);
  Py_VISIT(traverse_module_state->__pyx_codeobj__180);
  Py_VISIT(traverse_module_state->__pyx_codeobj__182);
  Py_VISIT(traverse_module_state->__pyx_codeobj__183);
  Py_VISIT(traverse_module_state->__pyx_codeobj__185);
  Py_VISIT(traverse_module_state->__pyx_codeobj__188);
  Py_VISIT(traverse_module_state->__pyx_codeobj__190);
  Py_VISIT(traverse_module_state->__pyx_codeobj__191);
  Py_VISIT(traverse_module_state->__pyx_codeobj__192);
  Py_VISIT(traverse_module_state->__pyx_codeobj__193);
  Py_VISIT(traverse_module_state->__pyx_codeobj__195);
  Py_VISIT(traverse_module_state->__pyx_codeobj__196);
  Py_VISIT(traverse_module_state->__pyx_codeobj__197);
  Py_VISIT(traverse_module_state->__pyx_codeobj__199);
  Py_VISIT(traverse_module_state->__pyx_codeobj__201);
  Py_VISIT(traverse_module_state->__pyx_codeobj__202);
  Py_VISIT(traverse_module_state->__pyx_codeobj__204);
  Py_VISIT(traverse_module_state->__pyx_codeobj__205);
  Py_VISIT(traverse_module_state->__pyx_codeobj__206);
  Py_VISIT(traverse_module_state->__pyx_codeobj__207);
  Py_VISIT(traverse_module_state->__pyx_codeobj__209);
  Py_VISIT(traverse_module_state->__pyx_codeobj__211);
  Py_VISIT(traverse_module_state->__pyx_codeobj__213);
  Py_VISIT(traverse_module_state->__pyx_codeobj__215);
  Py_VISIT(traverse_module_state->__pyx_codeobj__216);
  Py_VISIT(traverse_module_state->__pyx_codeobj__217);
  Py_VISIT(traverse_module_state->__pyx_codeobj__219);
  Py_VISIT(traverse_module_state->__pyx_codeobj__221);
  Py_VISIT(traverse_module_state->__pyx_codeobj__222);
  Py_VISIT(traverse_module_state->__pyx_codeobj__224);
  Py_VISIT(traverse_module_state->__pyx_codeobj__226);
  Py_VISIT(traverse_module_state->__pyx_codeobj__227);
  Py_VISIT(traverse_module_state->__pyx_codeobj__228);
  Py_VISIT(traverse_module_state->__pyx_codeobj__229);
  Py_VISIT(traverse_module_state->__pyx_codeobj__230);
  Py_VISIT(traverse_module_state->__pyx_codeobj__231);
  Py_VISIT(traverse_module_state->__pyx_codeobj__233);
  Py_VISIT(traverse_module_state->__pyx_codeobj__235);
  Py_VISIT(traverse_module_state->__pyx_codeobj__236);
  Py_VISIT(traverse_module_state->__pyx_codeobj__237);
  Py_VISIT(traverse_module_state->__pyx_codeobj__239);
  Py_VISIT(traverse_module_state->__pyx_codeobj__241);
  Py_VISIT(traverse_module_state->__pyx_codeobj__243);
  Py_VISIT(traverse_module_state->__pyx_codeobj__245);
  Py_VISIT(traverse_module_state->__pyx_codeobj__247);
  Py_VISIT(traverse_module_state->__pyx_codeobj__248);
  Py_VISIT(traverse_module_state->__pyx_codeobj__250);
  Py_VISIT(traverse_module_state->__pyx_codeobj__252);
  Py_VISIT(traverse_module_state->__pyx_codeobj__253);
  Py_VISIT(traverse_module_state->__pyx_codeobj__254);
  Py_VISIT(traverse_module_state->__pyx_codeobj__255);
  Py_VISIT(traverse_module_state->__pyx_codeobj__257);
  Py_VISIT(traverse_module_state->__pyx_codeobj__259);
  Py_VISIT(traverse_module_state->__pyx_codeobj__261);
  Py_VISIT(traverse_module_state->__pyx_codeobj__262);
  Py_VISIT(traverse_module_state->__pyx_codeobj__264);
  Py_VISIT(traverse_module_state->__pyx_codeobj__266);
  Py_VISIT(traverse_module_state->__pyx_codeobj__268);
  Py_VISIT(traverse_module_state->__pyx_codeobj__270);
  Py_VISIT(traverse_module_state->__pyx_codeobj__271);
  Py_VISIT(traverse_module_state->__pyx_codeobj__272);
  Py_VISIT(traverse_module_state->__pyx_codeobj__273);
  Py_VISIT(traverse_module_state->__pyx_codeobj__274);
  Py_VISIT(traverse_module_state->__pyx_codeobj__275);
  Py_VISIT(traverse_module_state->__pyx_codeobj__276);
  Py_VISIT(traverse_module_state->__pyx_codeobj__277);
  Py_VISIT(traverse_module_state->__pyx_codeobj__278);
  Py_VISIT(traverse_module_state->__pyx_codeobj__279);
  Py_VISIT(traverse_module_state->__pyx_codeobj__280);
  Py_VISIT(traverse_module_state->__pyx_codeobj__282);
  Py_VISIT(traverse_module_state->__pyx_codeobj__284);
  Py_VISIT(traverse_module_state->__pyx_codeobj__286);
  Py_VISIT(traverse_module_state->__pyx_codeobj__288);
  Py_VISIT(traverse_module_state->__pyx_codeobj__290);
  Py_VISIT(traverse_module_state->__pyx_codeobj__292);
  Py_VISIT(traverse_module_state->__pyx_codeobj__294);
  Py_VISIT(traverse_module_state->__pyx_codeobj__295);
  Py_VISIT(traverse_module_state->__pyx_codeobj__296);
  Py_VISIT(traverse_module_state->__pyx_codeobj__298);
  Py_VISIT(traverse_module_state->__pyx_codeobj__300);
  Py_VISIT(traverse_module_state->__pyx_codeobj__302);
  Py_VISIT(traverse_module_state->__pyx_codeobj__305);
  Py_VISIT(traverse_module_state->__pyx_codeobj__307);
  Py_VISIT(traverse_module_state->__pyx_codeobj__309);
  Py_VISIT(traverse_module_state->__pyx_codeobj__311);
  Py_VISIT(traverse_module_state->__pyx_codeobj__313);
  Py_VISIT(traverse_module_state->__pyx_codeobj__315);
  Py_VISIT(traverse_module_state->__pyx_codeobj__316);
  Py_VISIT(traverse_module_state->__pyx_codeobj__317);
  Py_VISIT(traverse_module_state->__pyx_codeobj__319);
  Py_VISIT(traverse_module_state->__pyx_codeobj__320);
  Py_VISIT(traverse_module_state->__pyx_codeobj__322);
  Py_VISIT(traverse_module_state->__pyx_codeobj__323);
  Py_VISIT(traverse_module_state->__pyx_codeobj__324);
  Py_VISIT(traverse_module_state->__pyx_codeobj__325);
  Py_VISIT(traverse_module_state->__pyx_codeobj__326);
  Py_VISIT(traverse_module_state->__pyx_codeobj__327);
  Py_VISIT(traverse_module_state->__pyx_codeobj__328);
  Py_VISIT(traverse_module_state->__pyx_codeobj__330);
  Py_VISIT(traverse_module_state->__pyx_codeobj__331);
  Py_VISIT(traverse_module_state->__pyx_codeobj__332);
  Py_VISIT(traverse_module_state->__pyx_codeobj__333);
  Py_VISIT(traverse_module_state->__pyx_codeobj__335);
  Py_VISIT(traverse_module_state->__pyx_codeobj__337);
  Py_VISIT(traverse_module_state->__pyx_codeobj__339);
  Py_VISIT(traverse_module_state->__pyx_codeobj__341);
  Py_VISIT(traverse_module_state->__pyx_codeobj__343);
  Py_VISIT(traverse_module_state->__pyx_codeobj__344);
  Py_VISIT(traverse_module_state->__pyx_codeobj__345);
  Py_VISIT(traverse_module_state->__pyx_codeobj__346);
  Py_VISIT(traverse_module_state->__pyx_codeobj__348);
  Py_VISIT(traverse_module_state->__pyx_codeobj__350);
  Py_VISIT(traverse_module_state->__pyx_codeobj__352);
  Py_VISIT(traverse_module_state->__pyx_codeobj__354);
  Py_VISIT(traverse_module_state->__pyx_codeobj__356);
  Py_VISIT(traverse_module_state->__pyx_codeobj__358);
  Py_VISIT(traverse_module_state->__pyx_codeobj__360);
  Py_VISIT(traverse_module_state->__pyx_codeobj__362);
  Py_VISIT(traverse_module_state->__pyx_codeobj__364);
  Py_VISIT(traverse_module_state->__pyx_codeobj__365);
  Py_VISIT(traverse_module_state->__pyx_codeobj__366);
  Py_VISIT(traverse_module_state->__pyx_codeobj__368);
  Py_VISIT(traverse_module_state->__pyx_codeobj__370);
  Py_VISIT(traverse_module_state->__pyx_codeobj__371);
  Py_VISIT(traverse_module_state->__pyx_codeobj__373);
  Py_VISIT(traverse_module_state->__pyx_codeobj__374);
  Py_VISIT(traverse_module_state->__pyx_codeobj__375);
  Py_VISIT(traverse_module_state->__pyx_codeobj__376);
  Py_VISIT(traverse_module_state->__pyx_codeobj__378);
  Py_VISIT(traverse_module_state->__pyx_codeobj__379);
  Py_VISIT(traverse_module_state->__pyx_codeobj__380);
  Py_VISIT(traverse_module_state->__pyx_codeobj__382);
  Py_VISIT(traverse_module_state->__pyx_codeobj__383);
  Py_VISIT(traverse_module_state->__pyx_codeobj__384);
  Py_VISIT(traverse_module_state->__pyx_codeobj__386);
  Py_VISIT(traverse_module_state->__pyx_codeobj__387);
  Py_VISIT(traverse_module_state->__pyx_codeobj__388);
  Py_VISIT(traverse_module_state->__pyx_codeobj__390);
  Py_VISIT(traverse_module_state->__pyx_codeobj__392);
  Py_VISIT(traverse_module_state->__pyx_codeobj__394);
  Py_VISIT(traverse_module_state->__pyx_codeobj__396);
  Py_VISIT(traverse_module_state->__pyx_codeobj__398);
  Py_VISIT(traverse_module_state->__pyx_codeobj__402);
  Py_VISIT(traverse_module_state->__pyx_codeobj__404);
  Py_VISIT(traverse_module_state->__pyx_codeobj__406);
  Py_VISIT(traverse_module_state->__pyx_codeobj__408);
  Py_VISIT(traverse_module_state->__pyx_codeobj__410);
  Py_VISIT(traverse_module_state->__pyx_codeobj__412);
  Py_VISIT(traverse_module_state->__pyx_codeobj__413);
  Py_VISIT(traverse_module_state->__pyx_codeobj__414);
  Py_VISIT(traverse_module_state->__pyx_codeobj__415);
  Py_VISIT(traverse_module_state->__pyx_codeobj__417);
  Py_VISIT(traverse_module_state->__pyx_codeobj__419);
  Py_VISIT(traverse_module_state->__pyx_codeobj__421);
  Py_VISIT(traverse_module_state->__pyx_codeobj__423);
  Py_VISIT(traverse_module_state->__pyx_codeobj__425);
  Py_VISIT(traverse_module_state->__pyx_codeobj__427);
  Py_VISIT(traverse_module_state->__pyx_codeobj__428);
  Py_VISIT(traverse_module_state->__pyx_codeobj__429);
  Py_VISIT(traverse_module_state->__pyx_codeobj__430);
  Py_VISIT(traverse_module_state->__pyx_codeobj__435);
  Py_VISIT(traverse_module_state->__pyx_codeobj__437);
  Py_VISIT(traverse_module_state->__pyx_codeobj__440);
  Py_VISIT(traverse_module_state->__pyx_codeobj__442);
  Py_VISIT(traverse_module_state->__pyx_codeobj__443);
  Py_VISIT(traverse_module_state->__pyx_codeobj__444);
  Py_VISIT(traverse_module_state->__pyx_codeobj__445);
  Py_VISIT(traverse_module_state->__pyx_codeobj__446);
  Py_VISIT(traverse_module_state->__pyx_codeobj__447);
  Py_VISIT(traverse_module_state->__pyx_codeobj__449);
  Py_VISIT(traverse_module_state->__pyx_codeobj__451);
  Py_VISIT(traverse_module_state->__pyx_codeobj__453);
  Py_VISIT(traverse_module_state->__pyx_codeobj__454);
  Py_VISIT(traverse_module_state->__pyx_codeobj__456);
  Py_VISIT(traverse_module_state->__pyx_codeobj__457);
  Py_VISIT(traverse_module_state->__pyx_codeobj__458);
  Py_VISIT(traverse_module_state->__pyx_codeobj__459);
  Py_VISIT(traverse_module_state->__pyx_codeobj__460);
  Py_VISIT(traverse_module_state->__pyx_codeobj__461);
  Py_VISIT(traverse_module_state->__pyx_codeobj__463);
  Py_VISIT(traverse_module_state->__pyx_codeobj__464);
  Py_VISIT(traverse_module_state->__pyx_codeobj__466);
  Py_VISIT(traverse_module_state->__pyx_codeobj__468);
  Py_VISIT(traverse_module_state->__pyx_codeobj__470);
  Py_VISIT(traverse_module_state->__pyx_codeobj__472);
  Py_VISIT(traverse_module_state->__pyx_codeobj__475);
  Py_VISIT(traverse_module_state->__pyx_codeobj__477);
  Py_VISIT(traverse_module_state->__pyx_codeobj__480);
  Py_VISIT(traverse_module_state->__pyx_codeobj__482);
  Py_VISIT(traverse_module_state->__pyx_codeobj__483);
  Py_VISIT(traverse_module_state->__pyx_codeobj__484);
  Py_VISIT(traverse_module_state->__pyx_codeobj__486);
  Py_VISIT(traverse_module_state->__pyx_codeobj__488);
  Py_VISIT(traverse_module_state->__pyx_codeobj__494);
  Py_VISIT(traverse_module_state->__pyx_codeobj__496);
  Py_VISIT(traverse_module_state->__pyx_codeobj__498);
  Py_VISIT(traverse_module_state->__pyx_codeobj__499);
  Py_VISIT(traverse_module_state->__pyx_codeobj__500);
  Py_VISIT(traverse_module_state->__pyx_codeobj__502);
  Py_VISIT(traverse_module_state->__pyx_codeobj__505);
  Py_VISIT(traverse_module_state->__pyx_codeobj__507);
  Py_VISIT(traverse_module_state->__pyx_codeobj__509);
  Py_VISIT(traverse_module_state->__pyx_codeobj__511);
  Py_VISIT(traverse_module_state->__pyx_codeobj__513);
  Py_VISIT(traverse_module_state->__pyx_codeobj__515);
  Py_VISIT(traverse_module_state->__pyx_codeobj__516);
  Py_VISIT(traverse_module_state->__pyx_codeobj__517);
  Py_VISIT(traverse_module_state->__pyx_codeobj__519);
  Py_VISIT(traverse_module_state->__pyx_codeobj__520);
  Py_VISIT(traverse_module_state->__pyx_codeobj__521);
  Py_VISIT(traverse_module_state->__pyx_codeobj__523);
  Py_VISIT(traverse_module_state->__pyx_codeobj__524);
  Py_VISIT(traverse_module_state->__pyx_codeobj__525);
  Py_VISIT(traverse_module_state->__pyx_codeobj__527);
  Py_VISIT(traverse_module_state->__pyx_codeobj__529);
  Py_VISIT(traverse_module_state->__pyx_codeobj__530);
  Py_VISIT(traverse_module_state->__pyx_codeobj__532);
  Py_VISIT(traverse_module_state->__pyx_codeobj__534);
  Py_VISIT(traverse_module_state->__pyx_codeobj__536);
  return 0;
}
#endif
/* #### Code section: module_state_defines ### */
#define __pyx_d __pyx_mstate_global->__pyx_d
#define __pyx_b __pyx_mstate_global->__pyx_b
#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
#ifdef __Pyx_CyFunction_USED
#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
#endif
#ifdef __Pyx_FusedFunction_USED
#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
#endif
#ifdef __Pyx_Generator_USED
#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
#endif
#ifdef __Pyx_IterableCoroutine_USED
#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
#endif
#ifdef __Pyx_Coroutine_USED
#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
#endif
#ifdef __Pyx_Coroutine_USED
#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#define __pyx_type_4lxml_5etree_Error __pyx_mstate_global->__pyx_type_4lxml_5etree_Error
#define __pyx_type_4lxml_5etree_LxmlError __pyx_mstate_global->__pyx_type_4lxml_5etree_LxmlError
#define __pyx_type_4lxml_5etree_C14NError __pyx_mstate_global->__pyx_type_4lxml_5etree_C14NError
#define __pyx_type_4lxml_5etree__TempStore __pyx_mstate_global->__pyx_type_4lxml_5etree__TempStore
#define __pyx_type_4lxml_5etree__ExceptionContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ExceptionContext
#define __pyx_type_4lxml_5etree__LogEntry __pyx_mstate_global->__pyx_type_4lxml_5etree__LogEntry
#define __pyx_type_4lxml_5etree__BaseErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree__BaseErrorLog
#define __pyx_type_4lxml_5etree__ListErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree__ListErrorLog
#define __pyx_type_4lxml_5etree__ErrorLogContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ErrorLogContext
#define __pyx_type_4lxml_5etree__ErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree__ErrorLog
#define __pyx_type_4lxml_5etree__DomainErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree__DomainErrorLog
#define __pyx_type_4lxml_5etree__RotatingErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree__RotatingErrorLog
#define __pyx_type_4lxml_5etree_PyErrorLog __pyx_mstate_global->__pyx_type_4lxml_5etree_PyErrorLog
#define LxmlDocumentType __pyx_mstate_global->LxmlDocumentType
#define __pyx_type_4lxml_5etree_DocInfo __pyx_mstate_global->__pyx_type_4lxml_5etree_DocInfo
#define LxmlElementType __pyx_mstate_global->LxmlElementType
#define __pyx_type_4lxml_5etree___ContentOnlyElement __pyx_mstate_global->__pyx_type_4lxml_5etree___ContentOnlyElement
#define __pyx_type_4lxml_5etree__Comment __pyx_mstate_global->__pyx_type_4lxml_5etree__Comment
#define __pyx_type_4lxml_5etree__ProcessingInstruction __pyx_mstate_global->__pyx_type_4lxml_5etree__ProcessingInstruction
#define __pyx_type_4lxml_5etree__Entity __pyx_mstate_global->__pyx_type_4lxml_5etree__Entity
#define __pyx_type_4lxml_5etree_QName __pyx_mstate_global->__pyx_type_4lxml_5etree_QName
#define LxmlElementTreeType __pyx_mstate_global->LxmlElementTreeType
#define __pyx_type_4lxml_5etree__Attrib __pyx_mstate_global->__pyx_type_4lxml_5etree__Attrib
#define __pyx_type_4lxml_5etree__AttribIterator __pyx_mstate_global->__pyx_type_4lxml_5etree__AttribIterator
#define LxmlElementTagMatcherType __pyx_mstate_global->LxmlElementTagMatcherType
#define LxmlElementIteratorType __pyx_mstate_global->LxmlElementIteratorType
#define __pyx_type_4lxml_5etree__MultiTagMatcher __pyx_mstate_global->__pyx_type_4lxml_5etree__MultiTagMatcher
#define __pyx_type_4lxml_5etree__ElementMatchIterator __pyx_mstate_global->__pyx_type_4lxml_5etree__ElementMatchIterator
#define __pyx_type_4lxml_5etree_ElementChildIterator __pyx_mstate_global->__pyx_type_4lxml_5etree_ElementChildIterator
#define __pyx_type_4lxml_5etree_SiblingsIterator __pyx_mstate_global->__pyx_type_4lxml_5etree_SiblingsIterator
#define __pyx_type_4lxml_5etree_AncestorsIterator __pyx_mstate_global->__pyx_type_4lxml_5etree_AncestorsIterator
#define __pyx_type_4lxml_5etree_ElementDepthFirstIterator __pyx_mstate_global->__pyx_type_4lxml_5etree_ElementDepthFirstIterator
#define __pyx_type_4lxml_5etree_ElementTextIterator __pyx_mstate_global->__pyx_type_4lxml_5etree_ElementTextIterator
#define __pyx_type_4lxml_5etree_CDATA __pyx_mstate_global->__pyx_type_4lxml_5etree_CDATA
#define __pyx_type_4lxml_5etree__ReadOnlyProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ReadOnlyProxy
#define __pyx_type_4lxml_5etree__ReadOnlyPIProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ReadOnlyPIProxy
#define __pyx_type_4lxml_5etree__ReadOnlyEntityProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ReadOnlyEntityProxy
#define __pyx_type_4lxml_5etree__ReadOnlyElementProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ReadOnlyElementProxy
#define __pyx_type_4lxml_5etree__OpaqueNodeWrapper __pyx_mstate_global->__pyx_type_4lxml_5etree__OpaqueNodeWrapper
#define __pyx_type_4lxml_5etree__OpaqueDocumentWrapper __pyx_mstate_global->__pyx_type_4lxml_5etree__OpaqueDocumentWrapper
#define __pyx_type_4lxml_5etree__ModifyContentOnlyProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ModifyContentOnlyProxy
#define __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy
#define __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy
#define __pyx_type_4lxml_5etree__AppendOnlyElementProxy __pyx_mstate_global->__pyx_type_4lxml_5etree__AppendOnlyElementProxy
#define LxmlElementBaseType __pyx_mstate_global->LxmlElementBaseType
#define __pyx_type_4lxml_5etree_CommentBase __pyx_mstate_global->__pyx_type_4lxml_5etree_CommentBase
#define __pyx_type_4lxml_5etree_PIBase __pyx_mstate_global->__pyx_type_4lxml_5etree_PIBase
#define __pyx_type_4lxml_5etree_EntityBase __pyx_mstate_global->__pyx_type_4lxml_5etree_EntityBase
#define LxmlElementClassLookupType __pyx_mstate_global->LxmlElementClassLookupType
#define LxmlFallbackElementClassLookupType __pyx_mstate_global->LxmlFallbackElementClassLookupType
#define __pyx_type_4lxml_5etree_ElementDefaultClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_ElementDefaultClassLookup
#define __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup
#define __pyx_type_4lxml_5etree_ParserBasedElementClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_ParserBasedElementClassLookup
#define __pyx_type_4lxml_5etree_CustomElementClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_CustomElementClassLookup
#define __pyx_type_4lxml_5etree_PythonElementClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_PythonElementClassLookup
#define __pyx_type_4lxml_5etree_LxmlRegistryError __pyx_mstate_global->__pyx_type_4lxml_5etree_LxmlRegistryError
#define __pyx_type_4lxml_5etree_NamespaceRegistryError __pyx_mstate_global->__pyx_type_4lxml_5etree_NamespaceRegistryError
#define __pyx_type_4lxml_5etree__NamespaceRegistry __pyx_mstate_global->__pyx_type_4lxml_5etree__NamespaceRegistry
#define __pyx_type_4lxml_5etree__ClassNamespaceRegistry __pyx_mstate_global->__pyx_type_4lxml_5etree__ClassNamespaceRegistry
#define __pyx_type_4lxml_5etree_ElementNamespaceClassLookup __pyx_mstate_global->__pyx_type_4lxml_5etree_ElementNamespaceClassLookup
#define __pyx_type_4lxml_5etree__FunctionNamespaceRegistry __pyx_mstate_global->__pyx_type_4lxml_5etree__FunctionNamespaceRegistry
#define __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry __pyx_mstate_global->__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry
#define __pyx_type_4lxml_5etree__InputDocument __pyx_mstate_global->__pyx_type_4lxml_5etree__InputDocument
#define __pyx_type_4lxml_5etree_Resolver __pyx_mstate_global->__pyx_type_4lxml_5etree_Resolver
#define __pyx_type_4lxml_5etree__ResolverRegistry __pyx_mstate_global->__pyx_type_4lxml_5etree__ResolverRegistry
#define __pyx_type_4lxml_5etree__ResolverContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ResolverContext
#define __pyx_type_4lxml_5etree_ParserError __pyx_mstate_global->__pyx_type_4lxml_5etree_ParserError
#define __pyx_type_4lxml_5etree__ParserDictionaryContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ParserDictionaryContext
#define __pyx_type_4lxml_5etree__FileReaderContext __pyx_mstate_global->__pyx_type_4lxml_5etree__FileReaderContext
#define __pyx_type_4lxml_5etree__ParserContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ParserContext
#define __pyx_type_4lxml_5etree__BaseParser __pyx_mstate_global->__pyx_type_4lxml_5etree__BaseParser
#define __pyx_type_4lxml_5etree__FeedParser __pyx_mstate_global->__pyx_type_4lxml_5etree__FeedParser
#define __pyx_type_4lxml_5etree_XMLParser __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLParser
#define __pyx_type_4lxml_5etree_XMLPullParser __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLPullParser
#define __pyx_type_4lxml_5etree_ETCompatXMLParser __pyx_mstate_global->__pyx_type_4lxml_5etree_ETCompatXMLParser
#define __pyx_type_4lxml_5etree_HTMLParser __pyx_mstate_global->__pyx_type_4lxml_5etree_HTMLParser
#define __pyx_type_4lxml_5etree_HTMLPullParser __pyx_mstate_global->__pyx_type_4lxml_5etree_HTMLPullParser
#define __pyx_type_4lxml_5etree__SaxParserTarget __pyx_mstate_global->__pyx_type_4lxml_5etree__SaxParserTarget
#define __pyx_type_4lxml_5etree__SaxParserContext __pyx_mstate_global->__pyx_type_4lxml_5etree__SaxParserContext
#define __pyx_type_4lxml_5etree__ParseEventsIterator __pyx_mstate_global->__pyx_type_4lxml_5etree__ParseEventsIterator
#define __pyx_type_4lxml_5etree_TreeBuilder __pyx_mstate_global->__pyx_type_4lxml_5etree_TreeBuilder
#define __pyx_type_4lxml_5etree__PythonSaxParserTarget __pyx_mstate_global->__pyx_type_4lxml_5etree__PythonSaxParserTarget
#define __pyx_type_4lxml_5etree__TargetParserContext __pyx_mstate_global->__pyx_type_4lxml_5etree__TargetParserContext
#define __pyx_type_4lxml_5etree_SerialisationError __pyx_mstate_global->__pyx_type_4lxml_5etree_SerialisationError
#define __pyx_type_4lxml_5etree__FilelikeWriter __pyx_mstate_global->__pyx_type_4lxml_5etree__FilelikeWriter
#define __pyx_type_4lxml_5etree_C14NWriterTarget __pyx_mstate_global->__pyx_type_4lxml_5etree_C14NWriterTarget
#define __pyx_type_4lxml_5etree_xmlfile __pyx_mstate_global->__pyx_type_4lxml_5etree_xmlfile
#define __pyx_type_4lxml_5etree_htmlfile __pyx_mstate_global->__pyx_type_4lxml_5etree_htmlfile
#define __pyx_type_4lxml_5etree__IncrementalFileWriter __pyx_mstate_global->__pyx_type_4lxml_5etree__IncrementalFileWriter
#define __pyx_type_4lxml_5etree__AsyncDataWriter __pyx_mstate_global->__pyx_type_4lxml_5etree__AsyncDataWriter
#define __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter __pyx_mstate_global->__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter
#define __pyx_type_4lxml_5etree__AsyncFileWriterElement __pyx_mstate_global->__pyx_type_4lxml_5etree__AsyncFileWriterElement
#define __pyx_type_4lxml_5etree__FileWriterElement __pyx_mstate_global->__pyx_type_4lxml_5etree__FileWriterElement
#define __pyx_type_4lxml_5etree__MethodChanger __pyx_mstate_global->__pyx_type_4lxml_5etree__MethodChanger
#define __pyx_type_4lxml_5etree_iterparse __pyx_mstate_global->__pyx_type_4lxml_5etree_iterparse
#define __pyx_type_4lxml_5etree_iterwalk __pyx_mstate_global->__pyx_type_4lxml_5etree_iterwalk
#define __pyx_type_4lxml_5etree__IDDict __pyx_mstate_global->__pyx_type_4lxml_5etree__IDDict
#define __pyx_type_4lxml_5etree_XIncludeError __pyx_mstate_global->__pyx_type_4lxml_5etree_XIncludeError
#define __pyx_type_4lxml_5etree_XInclude __pyx_mstate_global->__pyx_type_4lxml_5etree_XInclude
#define __pyx_type_4lxml_5etree_XPathError __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathError
#define __pyx_type_4lxml_5etree_XPathEvalError __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathEvalError
#define __pyx_type_4lxml_5etree_XPathFunctionError __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathFunctionError
#define __pyx_type_4lxml_5etree_XPathResultError __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathResultError
#define __pyx_type_4lxml_5etree__ExsltRegExp __pyx_mstate_global->__pyx_type_4lxml_5etree__ExsltRegExp
#define __pyx_type_4lxml_5etree__BaseContext __pyx_mstate_global->__pyx_type_4lxml_5etree__BaseContext
#define __pyx_type_4lxml_5etree__ElementUnicodeResult __pyx_mstate_global->__pyx_type_4lxml_5etree__ElementUnicodeResult
#define __pyx_type_4lxml_5etree__XPathContext __pyx_mstate_global->__pyx_type_4lxml_5etree__XPathContext
#define __pyx_type_4lxml_5etree__XPathEvaluatorBase __pyx_mstate_global->__pyx_type_4lxml_5etree__XPathEvaluatorBase
#define __pyx_type_4lxml_5etree_XPathElementEvaluator __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathElementEvaluator
#define __pyx_type_4lxml_5etree_XPathDocumentEvaluator __pyx_mstate_global->__pyx_type_4lxml_5etree_XPathDocumentEvaluator
#define __pyx_type_4lxml_5etree_XPath __pyx_mstate_global->__pyx_type_4lxml_5etree_XPath
#define __pyx_type_4lxml_5etree_ETXPath __pyx_mstate_global->__pyx_type_4lxml_5etree_ETXPath
#define __pyx_type_4lxml_5etree_XSLTError __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTError
#define __pyx_type_4lxml_5etree_XSLTParseError __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTParseError
#define __pyx_type_4lxml_5etree_XSLTApplyError __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTApplyError
#define __pyx_type_4lxml_5etree_XSLTExtensionError __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTExtensionError
#define __pyx_type_4lxml_5etree__XSLTResolverContext __pyx_mstate_global->__pyx_type_4lxml_5etree__XSLTResolverContext
#define __pyx_type_4lxml_5etree_XSLTAccessControl __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTAccessControl
#define __pyx_type_4lxml_5etree__XSLTContext __pyx_mstate_global->__pyx_type_4lxml_5etree__XSLTContext
#define __pyx_type_4lxml_5etree__XSLTQuotedStringParam __pyx_mstate_global->__pyx_type_4lxml_5etree__XSLTQuotedStringParam
#define __pyx_type_4lxml_5etree_XSLT __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLT
#define __pyx_type_4lxml_5etree__XSLTResultTree __pyx_mstate_global->__pyx_type_4lxml_5etree__XSLTResultTree
#define __pyx_type_4lxml_5etree__XSLTProcessingInstruction __pyx_mstate_global->__pyx_type_4lxml_5etree__XSLTProcessingInstruction
#define __pyx_type_4lxml_5etree_XSLTExtension __pyx_mstate_global->__pyx_type_4lxml_5etree_XSLTExtension
#define __pyx_type_4lxml_5etree_DocumentInvalid __pyx_mstate_global->__pyx_type_4lxml_5etree_DocumentInvalid
#define __pyx_type_4lxml_5etree__Validator __pyx_mstate_global->__pyx_type_4lxml_5etree__Validator
#define __pyx_type_4lxml_5etree_DTDError __pyx_mstate_global->__pyx_type_4lxml_5etree_DTDError
#define __pyx_type_4lxml_5etree_DTDParseError __pyx_mstate_global->__pyx_type_4lxml_5etree_DTDParseError
#define __pyx_type_4lxml_5etree_DTDValidateError __pyx_mstate_global->__pyx_type_4lxml_5etree_DTDValidateError
#define __pyx_type_4lxml_5etree__DTDElementContentDecl __pyx_mstate_global->__pyx_type_4lxml_5etree__DTDElementContentDecl
#define __pyx_type_4lxml_5etree__DTDAttributeDecl __pyx_mstate_global->__pyx_type_4lxml_5etree__DTDAttributeDecl
#define __pyx_type_4lxml_5etree__DTDElementDecl __pyx_mstate_global->__pyx_type_4lxml_5etree__DTDElementDecl
#define __pyx_type_4lxml_5etree__DTDEntityDecl __pyx_mstate_global->__pyx_type_4lxml_5etree__DTDEntityDecl
#define __pyx_type_4lxml_5etree_DTD __pyx_mstate_global->__pyx_type_4lxml_5etree_DTD
#define __pyx_type_4lxml_5etree_RelaxNGError __pyx_mstate_global->__pyx_type_4lxml_5etree_RelaxNGError
#define __pyx_type_4lxml_5etree_RelaxNGParseError __pyx_mstate_global->__pyx_type_4lxml_5etree_RelaxNGParseError
#define __pyx_type_4lxml_5etree_RelaxNGValidateError __pyx_mstate_global->__pyx_type_4lxml_5etree_RelaxNGValidateError
#define __pyx_type_4lxml_5etree_RelaxNG __pyx_mstate_global->__pyx_type_4lxml_5etree_RelaxNG
#define __pyx_type_4lxml_5etree_XMLSchemaError __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLSchemaError
#define __pyx_type_4lxml_5etree_XMLSchemaParseError __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLSchemaParseError
#define __pyx_type_4lxml_5etree_XMLSchemaValidateError __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLSchemaValidateError
#define __pyx_type_4lxml_5etree_XMLSchema __pyx_mstate_global->__pyx_type_4lxml_5etree_XMLSchema
#define __pyx_type_4lxml_5etree__ParserSchemaValidationContext __pyx_mstate_global->__pyx_type_4lxml_5etree__ParserSchemaValidationContext
#define __pyx_type_4lxml_5etree_SchematronError __pyx_mstate_global->__pyx_type_4lxml_5etree_SchematronError
#define __pyx_type_4lxml_5etree_SchematronParseError __pyx_mstate_global->__pyx_type_4lxml_5etree_SchematronParseError
#define __pyx_type_4lxml_5etree_SchematronValidateError __pyx_mstate_global->__pyx_type_4lxml_5etree_SchematronValidateError
#define __pyx_type_4lxml_5etree_Schematron __pyx_mstate_global->__pyx_type_4lxml_5etree_Schematron
#define __pyx_type_4lxml_5etree__MemDebug __pyx_mstate_global->__pyx_type_4lxml_5etree__MemDebug
#define __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file
#define __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces
#define __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush
#define __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration
#define __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype
#define __pyx_type_4lxml_5etree___pyx_scope_struct_7_write __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_7_write
#define __pyx_type_4lxml_5etree___pyx_scope_struct_8__close __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_8__close
#define __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__ __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__
#define __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues
#define __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes
#define __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements
#define __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities __pyx_mstate_global->__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities
#endif
#define __pyx_ptype_4lxml_5etree_Error __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Error
#define __pyx_ptype_4lxml_5etree_LxmlError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlError
#define __pyx_ptype_4lxml_5etree_C14NError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NError
#define __pyx_ptype_4lxml_5etree__TempStore __pyx_mstate_global->__pyx_ptype_4lxml_5etree__TempStore
#define __pyx_ptype_4lxml_5etree__ExceptionContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExceptionContext
#define __pyx_ptype_4lxml_5etree__LogEntry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__LogEntry
#define __pyx_ptype_4lxml_5etree__BaseErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseErrorLog
#define __pyx_ptype_4lxml_5etree__ListErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ListErrorLog
#define __pyx_ptype_4lxml_5etree__ErrorLogContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLogContext
#define __pyx_ptype_4lxml_5etree__ErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ErrorLog
#define __pyx_ptype_4lxml_5etree__DomainErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DomainErrorLog
#define __pyx_ptype_4lxml_5etree__RotatingErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree__RotatingErrorLog
#define __pyx_ptype_4lxml_5etree_PyErrorLog __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PyErrorLog
#define __pyx_ptype_4lxml_5etree__Document __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Document
#define __pyx_ptype_4lxml_5etree_DocInfo __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocInfo
#define __pyx_ptype_4lxml_5etree__Element __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Element
#define __pyx_ptype_4lxml_5etree___ContentOnlyElement __pyx_mstate_global->__pyx_ptype_4lxml_5etree___ContentOnlyElement
#define __pyx_ptype_4lxml_5etree__Comment __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Comment
#define __pyx_ptype_4lxml_5etree__ProcessingInstruction __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ProcessingInstruction
#define __pyx_ptype_4lxml_5etree__Entity __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Entity
#define __pyx_ptype_4lxml_5etree_QName __pyx_mstate_global->__pyx_ptype_4lxml_5etree_QName
#define __pyx_ptype_4lxml_5etree__ElementTree __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTree
#define __pyx_ptype_4lxml_5etree__Attrib __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Attrib
#define __pyx_ptype_4lxml_5etree__AttribIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AttribIterator
#define __pyx_ptype_4lxml_5etree__ElementTagMatcher __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementTagMatcher
#define __pyx_ptype_4lxml_5etree__ElementIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementIterator
#define __pyx_ptype_4lxml_5etree__MultiTagMatcher __pyx_mstate_global->__pyx_ptype_4lxml_5etree__MultiTagMatcher
#define __pyx_ptype_4lxml_5etree__ElementMatchIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementMatchIterator
#define __pyx_ptype_4lxml_5etree_ElementChildIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementChildIterator
#define __pyx_ptype_4lxml_5etree_SiblingsIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SiblingsIterator
#define __pyx_ptype_4lxml_5etree_AncestorsIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_AncestorsIterator
#define __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator
#define __pyx_ptype_4lxml_5etree_ElementTextIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementTextIterator
#define __pyx_ptype_4lxml_5etree_CDATA __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CDATA
#define __pyx_ptype_4lxml_5etree__ReadOnlyProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyProxy
#define __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy
#define __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy
#define __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy
#define __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper
#define __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper __pyx_mstate_global->__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper
#define __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy
#define __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy
#define __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy
#define __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy
#define __pyx_ptype_4lxml_5etree_ElementBase __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementBase
#define __pyx_ptype_4lxml_5etree_CommentBase __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CommentBase
#define __pyx_ptype_4lxml_5etree_PIBase __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PIBase
#define __pyx_ptype_4lxml_5etree_EntityBase __pyx_mstate_global->__pyx_ptype_4lxml_5etree_EntityBase
#define __pyx_ptype_4lxml_5etree_ElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementClassLookup
#define __pyx_ptype_4lxml_5etree_FallbackElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_FallbackElementClassLookup
#define __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup
#define __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup
#define __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup
#define __pyx_ptype_4lxml_5etree_CustomElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_CustomElementClassLookup
#define __pyx_ptype_4lxml_5etree_PythonElementClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_PythonElementClassLookup
#define __pyx_ptype_4lxml_5etree_LxmlRegistryError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_LxmlRegistryError
#define __pyx_ptype_4lxml_5etree_NamespaceRegistryError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_NamespaceRegistryError
#define __pyx_ptype_4lxml_5etree__NamespaceRegistry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__NamespaceRegistry
#define __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry
#define __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup
#define __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry
#define __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry
#define __pyx_ptype_4lxml_5etree__InputDocument __pyx_mstate_global->__pyx_ptype_4lxml_5etree__InputDocument
#define __pyx_ptype_4lxml_5etree_Resolver __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Resolver
#define __pyx_ptype_4lxml_5etree__ResolverRegistry __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverRegistry
#define __pyx_ptype_4lxml_5etree__ResolverContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ResolverContext
#define __pyx_ptype_4lxml_5etree_ParserError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ParserError
#define __pyx_ptype_4lxml_5etree__ParserDictionaryContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserDictionaryContext
#define __pyx_ptype_4lxml_5etree__FileReaderContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileReaderContext
#define __pyx_ptype_4lxml_5etree__ParserContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserContext
#define __pyx_ptype_4lxml_5etree__BaseParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseParser
#define __pyx_ptype_4lxml_5etree__FeedParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FeedParser
#define __pyx_ptype_4lxml_5etree_XMLParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLParser
#define __pyx_ptype_4lxml_5etree_XMLPullParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLPullParser
#define __pyx_ptype_4lxml_5etree_ETCompatXMLParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ETCompatXMLParser
#define __pyx_ptype_4lxml_5etree_HTMLParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLParser
#define __pyx_ptype_4lxml_5etree_HTMLPullParser __pyx_mstate_global->__pyx_ptype_4lxml_5etree_HTMLPullParser
#define __pyx_ptype_4lxml_5etree__SaxParserTarget __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserTarget
#define __pyx_ptype_4lxml_5etree__SaxParserContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__SaxParserContext
#define __pyx_ptype_4lxml_5etree__ParseEventsIterator __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParseEventsIterator
#define __pyx_ptype_4lxml_5etree_TreeBuilder __pyx_mstate_global->__pyx_ptype_4lxml_5etree_TreeBuilder
#define __pyx_ptype_4lxml_5etree__PythonSaxParserTarget __pyx_mstate_global->__pyx_ptype_4lxml_5etree__PythonSaxParserTarget
#define __pyx_ptype_4lxml_5etree__TargetParserContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__TargetParserContext
#define __pyx_ptype_4lxml_5etree_SerialisationError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SerialisationError
#define __pyx_ptype_4lxml_5etree__FilelikeWriter __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FilelikeWriter
#define __pyx_ptype_4lxml_5etree_C14NWriterTarget __pyx_mstate_global->__pyx_ptype_4lxml_5etree_C14NWriterTarget
#define __pyx_ptype_4lxml_5etree_xmlfile __pyx_mstate_global->__pyx_ptype_4lxml_5etree_xmlfile
#define __pyx_ptype_4lxml_5etree_htmlfile __pyx_mstate_global->__pyx_ptype_4lxml_5etree_htmlfile
#define __pyx_ptype_4lxml_5etree__IncrementalFileWriter __pyx_mstate_global->__pyx_ptype_4lxml_5etree__IncrementalFileWriter
#define __pyx_ptype_4lxml_5etree__AsyncDataWriter __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncDataWriter
#define __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter
#define __pyx_ptype_4lxml_5etree__AsyncFileWriterElement __pyx_mstate_global->__pyx_ptype_4lxml_5etree__AsyncFileWriterElement
#define __pyx_ptype_4lxml_5etree__FileWriterElement __pyx_mstate_global->__pyx_ptype_4lxml_5etree__FileWriterElement
#define __pyx_ptype_4lxml_5etree__MethodChanger __pyx_mstate_global->__pyx_ptype_4lxml_5etree__MethodChanger
#define __pyx_ptype_4lxml_5etree_iterparse __pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterparse
#define __pyx_ptype_4lxml_5etree_iterwalk __pyx_mstate_global->__pyx_ptype_4lxml_5etree_iterwalk
#define __pyx_ptype_4lxml_5etree__IDDict __pyx_mstate_global->__pyx_ptype_4lxml_5etree__IDDict
#define __pyx_ptype_4lxml_5etree_XIncludeError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XIncludeError
#define __pyx_ptype_4lxml_5etree_XInclude __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XInclude
#define __pyx_ptype_4lxml_5etree_XPathError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathError
#define __pyx_ptype_4lxml_5etree_XPathEvalError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathEvalError
#define __pyx_ptype_4lxml_5etree_XPathFunctionError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathFunctionError
#define __pyx_ptype_4lxml_5etree_XPathResultError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathResultError
#define __pyx_ptype_4lxml_5etree__ExsltRegExp __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ExsltRegExp
#define __pyx_ptype_4lxml_5etree__BaseContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__BaseContext
#define __pyx_ptype_4lxml_5etree__ElementUnicodeResult __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ElementUnicodeResult
#define __pyx_ptype_4lxml_5etree__XPathContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathContext
#define __pyx_ptype_4lxml_5etree__XPathEvaluatorBase __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XPathEvaluatorBase
#define __pyx_ptype_4lxml_5etree_XPathElementEvaluator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathElementEvaluator
#define __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator
#define __pyx_ptype_4lxml_5etree_XPath __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XPath
#define __pyx_ptype_4lxml_5etree_ETXPath __pyx_mstate_global->__pyx_ptype_4lxml_5etree_ETXPath
#define __pyx_ptype_4lxml_5etree_XSLTError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTError
#define __pyx_ptype_4lxml_5etree_XSLTParseError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTParseError
#define __pyx_ptype_4lxml_5etree_XSLTApplyError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTApplyError
#define __pyx_ptype_4lxml_5etree_XSLTExtensionError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtensionError
#define __pyx_ptype_4lxml_5etree__XSLTResolverContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResolverContext
#define __pyx_ptype_4lxml_5etree_XSLTAccessControl __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTAccessControl
#define __pyx_ptype_4lxml_5etree__XSLTContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTContext
#define __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam
#define __pyx_ptype_4lxml_5etree_XSLT __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLT
#define __pyx_ptype_4lxml_5etree__XSLTResultTree __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTResultTree
#define __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction __pyx_mstate_global->__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction
#define __pyx_ptype_4lxml_5etree_XSLTExtension __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XSLTExtension
#define __pyx_ptype_4lxml_5etree_DocumentInvalid __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DocumentInvalid
#define __pyx_ptype_4lxml_5etree__Validator __pyx_mstate_global->__pyx_ptype_4lxml_5etree__Validator
#define __pyx_ptype_4lxml_5etree_DTDError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDError
#define __pyx_ptype_4lxml_5etree_DTDParseError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDParseError
#define __pyx_ptype_4lxml_5etree_DTDValidateError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTDValidateError
#define __pyx_ptype_4lxml_5etree__DTDElementContentDecl __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementContentDecl
#define __pyx_ptype_4lxml_5etree__DTDAttributeDecl __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDAttributeDecl
#define __pyx_ptype_4lxml_5etree__DTDElementDecl __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDElementDecl
#define __pyx_ptype_4lxml_5etree__DTDEntityDecl __pyx_mstate_global->__pyx_ptype_4lxml_5etree__DTDEntityDecl
#define __pyx_ptype_4lxml_5etree_DTD __pyx_mstate_global->__pyx_ptype_4lxml_5etree_DTD
#define __pyx_ptype_4lxml_5etree_RelaxNGError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGError
#define __pyx_ptype_4lxml_5etree_RelaxNGParseError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGParseError
#define __pyx_ptype_4lxml_5etree_RelaxNGValidateError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNGValidateError
#define __pyx_ptype_4lxml_5etree_RelaxNG __pyx_mstate_global->__pyx_ptype_4lxml_5etree_RelaxNG
#define __pyx_ptype_4lxml_5etree_XMLSchemaError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaError
#define __pyx_ptype_4lxml_5etree_XMLSchemaParseError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaParseError
#define __pyx_ptype_4lxml_5etree_XMLSchemaValidateError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchemaValidateError
#define __pyx_ptype_4lxml_5etree_XMLSchema __pyx_mstate_global->__pyx_ptype_4lxml_5etree_XMLSchema
#define __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext __pyx_mstate_global->__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext
#define __pyx_ptype_4lxml_5etree_SchematronError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronError
#define __pyx_ptype_4lxml_5etree_SchematronParseError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronParseError
#define __pyx_ptype_4lxml_5etree_SchematronValidateError __pyx_mstate_global->__pyx_ptype_4lxml_5etree_SchematronValidateError
#define __pyx_ptype_4lxml_5etree_Schematron __pyx_mstate_global->__pyx_ptype_4lxml_5etree_Schematron
#define __pyx_ptype_4lxml_5etree__MemDebug __pyx_mstate_global->__pyx_ptype_4lxml_5etree__MemDebug
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__ __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements
#define __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities __pyx_mstate_global->__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities
#define __pyx_kp_u_0_9 __pyx_mstate_global->__pyx_kp_u_0_9
#define __pyx_kp_u_1 __pyx_mstate_global->__pyx_kp_u_1
#define __pyx_kp_b_25 __pyx_mstate_global->__pyx_kp_b_25
#define __pyx_n_b_A __pyx_mstate_global->__pyx_n_b_A
#define __pyx_n_b_ASCII __pyx_mstate_global->__pyx_n_b_ASCII
#define __pyx_n_u_ASCII __pyx_mstate_global->__pyx_n_u_ASCII
#define __pyx_kp_u_All_strings_must_be_XML_compatib __pyx_mstate_global->__pyx_kp_u_All_strings_must_be_XML_compatib
#define __pyx_kp_s_An_XMLSyntaxError_that_addition __pyx_mstate_global->__pyx_kp_s_An_XMLSyntaxError_that_addition
#define __pyx_n_s_AncestorsIterator __pyx_mstate_global->__pyx_n_s_AncestorsIterator
#define __pyx_n_s_AppendOnlyElementProxy_append __pyx_mstate_global->__pyx_n_s_AppendOnlyElementProxy_append
#define __pyx_n_s_AppendOnlyElementProxy_extend __pyx_mstate_global->__pyx_n_s_AppendOnlyElementProxy_extend
#define __pyx_kp_u_Argument_is_not_a_file_like_obje __pyx_mstate_global->__pyx_kp_u_Argument_is_not_a_file_like_obje
#define __pyx_kp_u_Argument_must_be_bytes_or_unicod __pyx_mstate_global->__pyx_kp_u_Argument_must_be_bytes_or_unicod
#define __pyx_kp_u_Argument_must_be_string_or_unico __pyx_mstate_global->__pyx_kp_u_Argument_must_be_string_or_unico
#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError
#define __pyx_n_s_AsyncDataWriter_close __pyx_mstate_global->__pyx_n_s_AsyncDataWriter_close
#define __pyx_n_s_AsyncDataWriter_write __pyx_mstate_global->__pyx_n_s_AsyncDataWriter_write
#define __pyx_n_s_AsyncFileWriterElement___aenter __pyx_mstate_global->__pyx_n_s_AsyncFileWriterElement___aenter
#define __pyx_n_s_AsyncFileWriterElement___aexit __pyx_mstate_global->__pyx_n_s_AsyncFileWriterElement___aexit
#define __pyx_n_s_AsyncIncrementalFileWriter__clo __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter__clo
#define __pyx_n_s_AsyncIncrementalFileWriter_elem __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_elem
#define __pyx_n_s_AsyncIncrementalFileWriter_flus __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_flus
#define __pyx_n_s_AsyncIncrementalFileWriter_meth __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_meth
#define __pyx_n_s_AsyncIncrementalFileWriter_writ __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_writ
#define __pyx_n_s_AsyncIncrementalFileWriter_writ_2 __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_writ_2
#define __pyx_n_s_AsyncIncrementalFileWriter_writ_3 __pyx_mstate_global->__pyx_n_s_AsyncIncrementalFileWriter_writ_3
#define __pyx_n_s_Attrib __pyx_mstate_global->__pyx_n_s_Attrib
#define __pyx_n_s_Attrib___copy __pyx_mstate_global->__pyx_n_s_Attrib___copy
#define __pyx_n_s_Attrib___deepcopy __pyx_mstate_global->__pyx_n_s_Attrib___deepcopy
#define __pyx_n_s_Attrib_clear __pyx_mstate_global->__pyx_n_s_Attrib_clear
#define __pyx_n_s_Attrib_get __pyx_mstate_global->__pyx_n_s_Attrib_get
#define __pyx_n_s_Attrib_has_key __pyx_mstate_global->__pyx_n_s_Attrib_has_key
#define __pyx_n_s_Attrib_items __pyx_mstate_global->__pyx_n_s_Attrib_items
#define __pyx_n_s_Attrib_iteritems __pyx_mstate_global->__pyx_n_s_Attrib_iteritems
#define __pyx_n_s_Attrib_iterkeys __pyx_mstate_global->__pyx_n_s_Attrib_iterkeys
#define __pyx_n_s_Attrib_itervalues __pyx_mstate_global->__pyx_n_s_Attrib_itervalues
#define __pyx_n_s_Attrib_keys __pyx_mstate_global->__pyx_n_s_Attrib_keys
#define __pyx_n_s_Attrib_pop __pyx_mstate_global->__pyx_n_s_Attrib_pop
#define __pyx_n_s_Attrib_update __pyx_mstate_global->__pyx_n_s_Attrib_update
#define __pyx_n_s_Attrib_values __pyx_mstate_global->__pyx_n_s_Attrib_values
#define __pyx_n_s_AttributeBasedElementClassLookup __pyx_mstate_global->__pyx_n_s_AttributeBasedElementClassLookup
#define __pyx_n_u_AttributeBasedElementClassLookup __pyx_mstate_global->__pyx_n_u_AttributeBasedElementClassLookup
#define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError
#define __pyx_n_u_BE __pyx_mstate_global->__pyx_n_u_BE
#define __pyx_n_s_BaseErrorLog __pyx_mstate_global->__pyx_n_s_BaseErrorLog
#define __pyx_n_s_BaseErrorLog_copy __pyx_mstate_global->__pyx_n_s_BaseErrorLog_copy
#define __pyx_n_s_BaseErrorLog_receive __pyx_mstate_global->__pyx_n_s_BaseErrorLog_receive
#define __pyx_n_s_BaseException __pyx_mstate_global->__pyx_n_s_BaseException
#define __pyx_n_s_BaseParser_copy __pyx_mstate_global->__pyx_n_s_BaseParser_copy
#define __pyx_n_s_BaseParser_makeelement __pyx_mstate_global->__pyx_n_s_BaseParser_makeelement
#define __pyx_n_s_BaseParser_set_element_class_lo __pyx_mstate_global->__pyx_n_s_BaseParser_set_element_class_lo
#define __pyx_kp_s_Base_class_for_all_syntax_errors __pyx_mstate_global->__pyx_kp_s_Base_class_for_all_syntax_errors
#define __pyx_n_s_BytesIO __pyx_mstate_global->__pyx_n_s_BytesIO
#define __pyx_n_s_C14NError __pyx_mstate_global->__pyx_n_s_C14NError
#define __pyx_n_u_C14NError __pyx_mstate_global->__pyx_n_u_C14NError
#define __pyx_n_s_C14NWriterTarget __pyx_mstate_global->__pyx_n_s_C14NWriterTarget
#define __pyx_n_u_C14NWriterTarget __pyx_mstate_global->__pyx_n_u_C14NWriterTarget
#define __pyx_n_s_C14NWriterTarget__iter_namespace __pyx_mstate_global->__pyx_n_s_C14NWriterTarget__iter_namespace
#define __pyx_n_s_C14NWriterTarget__start_locals_l __pyx_mstate_global->__pyx_n_s_C14NWriterTarget__start_locals_l
#define __pyx_n_s_C14NWriterTarget_close __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_close
#define __pyx_n_s_C14NWriterTarget_comment __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_comment
#define __pyx_n_s_C14NWriterTarget_data __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_data
#define __pyx_n_s_C14NWriterTarget_end __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_end
#define __pyx_n_s_C14NWriterTarget_pi __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_pi
#define __pyx_n_s_C14NWriterTarget_start __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_start
#define __pyx_n_s_C14NWriterTarget_start_ns __pyx_mstate_global->__pyx_n_s_C14NWriterTarget_start_ns
#define __pyx_kp_u_C14N_failed __pyx_mstate_global->__pyx_kp_u_C14N_failed
#define __pyx_n_s_CDATA __pyx_mstate_global->__pyx_n_s_CDATA
#define __pyx_n_u_CDATA __pyx_mstate_global->__pyx_n_u_CDATA
#define __pyx_n_s_CRITICAL __pyx_mstate_global->__pyx_n_s_CRITICAL
#define __pyx_n_s_CSSSelector __pyx_mstate_global->__pyx_n_s_CSSSelector
#define __pyx_kp_u_Can_only_discard_comments_in_C14 __pyx_mstate_global->__pyx_kp_u_Can_only_discard_comments_in_C14
#define __pyx_kp_u_Can_only_strip_text_in_C14N_2_0 __pyx_mstate_global->__pyx_kp_u_Can_only_strip_text_in_C14N_2_0
#define __pyx_kp_u_Cannot_asynchronously_write_to_a __pyx_mstate_global->__pyx_kp_u_Cannot_asynchronously_write_to_a
#define __pyx_kp_u_Cannot_change_the_xml_prefix_of __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_xml_prefix_of
#define __pyx_kp_u_Cannot_enable_XML_declaration_in __pyx_mstate_global->__pyx_kp_u_Cannot_enable_XML_declaration_in
#define __pyx_kp_u_Cannot_parse_stylesheet __pyx_mstate_global->__pyx_kp_u_Cannot_parse_stylesheet
#define __pyx_kp_u_Cannot_resolve_URI __pyx_mstate_global->__pyx_kp_u_Cannot_resolve_URI
#define __pyx_kp_u_Cannot_specify_encoding_with_C14 __pyx_mstate_global->__pyx_kp_u_Cannot_specify_encoding_with_C14
#define __pyx_kp_b_Char_out_of_XML_range __pyx_mstate_global->__pyx_kp_b_Char_out_of_XML_range
#define __pyx_n_s_Comment __pyx_mstate_global->__pyx_n_s_Comment
#define __pyx_n_u_Comment __pyx_mstate_global->__pyx_n_u_Comment
#define __pyx_n_s_CommentBase __pyx_mstate_global->__pyx_n_s_CommentBase
#define __pyx_n_u_CommentBase __pyx_mstate_global->__pyx_n_u_CommentBase
#define __pyx_n_s_Comment_2 __pyx_mstate_global->__pyx_n_s_Comment_2
#define __pyx_kp_u_Comment_may_not_contain_or_end_w __pyx_mstate_global->__pyx_kp_u_Comment_may_not_contain_or_end_w
#define __pyx_n_s_ContentOnlyElement_append __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_append
#define __pyx_n_s_ContentOnlyElement_get __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_get
#define __pyx_n_s_ContentOnlyElement_insert __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_insert
#define __pyx_n_s_ContentOnlyElement_items __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_items
#define __pyx_n_s_ContentOnlyElement_keys __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_keys
#define __pyx_n_s_ContentOnlyElement_set __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_set
#define __pyx_n_s_ContentOnlyElement_values __pyx_mstate_global->__pyx_n_s_ContentOnlyElement_values
#define __pyx_kp_u_Could_not_create_I_O_writer_cont __pyx_mstate_global->__pyx_kp_u_Could_not_create_I_O_writer_cont
#define __pyx_kp_u_Could_not_find_root_node __pyx_mstate_global->__pyx_kp_u_Could_not_find_root_node
#define __pyx_n_s_CustomElementClassLookup __pyx_mstate_global->__pyx_n_s_CustomElementClassLookup
#define __pyx_n_u_CustomElementClassLookup __pyx_mstate_global->__pyx_n_u_CustomElementClassLookup
#define __pyx_n_s_CustomElementClassLookup_lookup __pyx_mstate_global->__pyx_n_s_CustomElementClassLookup_lookup
#define __pyx_n_s_DEBUG __pyx_mstate_global->__pyx_n_s_DEBUG
#define __pyx_n_u_DEBUG __pyx_mstate_global->__pyx_n_u_DEBUG
#define __pyx_n_s_DENY_ALL __pyx_mstate_global->__pyx_n_s_DENY_ALL
#define __pyx_n_s_DENY_WRITE __pyx_mstate_global->__pyx_n_s_DENY_WRITE
#define __pyx_kp_u_DOCTYPE __pyx_mstate_global->__pyx_kp_u_DOCTYPE
#define __pyx_kp_u_DOCTYPE_already_written_or_canno __pyx_mstate_global->__pyx_kp_u_DOCTYPE_already_written_or_canno
#define __pyx_n_s_DTD __pyx_mstate_global->__pyx_n_s_DTD
#define __pyx_n_u_DTD __pyx_mstate_global->__pyx_n_u_DTD
#define __pyx_n_s_DTDAttributeDecl_itervalues __pyx_mstate_global->__pyx_n_s_DTDAttributeDecl_itervalues
#define __pyx_n_s_DTDAttributeDecl_values __pyx_mstate_global->__pyx_n_s_DTDAttributeDecl_values
#define __pyx_n_s_DTDElementDecl_attributes __pyx_mstate_global->__pyx_n_s_DTDElementDecl_attributes
#define __pyx_n_s_DTDElementDecl_iterattributes __pyx_mstate_global->__pyx_n_s_DTDElementDecl_iterattributes
#define __pyx_n_s_DTDError __pyx_mstate_global->__pyx_n_s_DTDError
#define __pyx_n_u_DTDError __pyx_mstate_global->__pyx_n_u_DTDError
#define __pyx_n_s_DTDParseError __pyx_mstate_global->__pyx_n_s_DTDParseError
#define __pyx_n_u_DTDParseError __pyx_mstate_global->__pyx_n_u_DTDParseError
#define __pyx_n_s_DTDValidateError __pyx_mstate_global->__pyx_n_s_DTDValidateError
#define __pyx_n_u_DTDValidateError __pyx_mstate_global->__pyx_n_u_DTDValidateError
#define __pyx_n_s_DTD_elements __pyx_mstate_global->__pyx_n_s_DTD_elements
#define __pyx_n_s_DTD_entities __pyx_mstate_global->__pyx_n_s_DTD_entities
#define __pyx_n_s_DTD_iterelements __pyx_mstate_global->__pyx_n_s_DTD_iterelements
#define __pyx_n_s_DTD_iterentities __pyx_mstate_global->__pyx_n_s_DTD_iterentities
#define __pyx_kp_u_DTD_not_initialised __pyx_mstate_global->__pyx_kp_u_DTD_not_initialised
#define __pyx_n_s_DeprecationWarning __pyx_mstate_global->__pyx_n_s_DeprecationWarning
#define __pyx_n_s_DocInfo __pyx_mstate_global->__pyx_n_s_DocInfo
#define __pyx_n_s_DocInfo_clear __pyx_mstate_global->__pyx_n_s_DocInfo_clear
#define __pyx_n_s_Document __pyx_mstate_global->__pyx_n_s_Document
#define __pyx_n_s_DocumentInvalid __pyx_mstate_global->__pyx_n_s_DocumentInvalid
#define __pyx_n_u_DocumentInvalid __pyx_mstate_global->__pyx_n_u_DocumentInvalid
#define __pyx_kp_u_Document_does_not_comply_with_sc __pyx_mstate_global->__pyx_kp_u_Document_does_not_comply_with_sc
#define __pyx_kp_u_Document_is_not_a_valid_Schematr __pyx_mstate_global->__pyx_kp_u_Document_is_not_a_valid_Schematr
#define __pyx_kp_u_Document_is_not_parsable_as_Rela __pyx_mstate_global->__pyx_kp_u_Document_is_not_parsable_as_Rela
#define __pyx_kp_u_Document_is_not_valid_Relax_NG __pyx_mstate_global->__pyx_kp_u_Document_is_not_valid_Relax_NG
#define __pyx_kp_u_Document_is_not_valid_XML_Schema __pyx_mstate_global->__pyx_kp_u_Document_is_not_valid_XML_Schema
#define __pyx_kp_u_Document_is_not_well_formed __pyx_mstate_global->__pyx_kp_u_Document_is_not_well_formed
#define __pyx_n_s_DomainErrorLog __pyx_mstate_global->__pyx_n_s_DomainErrorLog
#define __pyx_n_s_DomainErrorLog_receive __pyx_mstate_global->__pyx_n_s_DomainErrorLog_receive
#define __pyx_n_s_ERROR __pyx_mstate_global->__pyx_n_s_ERROR
#define __pyx_n_s_ERR_INVALID_CHAR __pyx_mstate_global->__pyx_n_s_ERR_INVALID_CHAR
#define __pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER __pyx_mstate_global->__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER
#define __pyx_n_s_ERR_UNDECLARED_ENTITY __pyx_mstate_global->__pyx_n_s_ERR_UNDECLARED_ENTITY
#define __pyx_n_s_ETCompatXMLParser __pyx_mstate_global->__pyx_n_s_ETCompatXMLParser
#define __pyx_n_u_ETCompatXMLParser __pyx_mstate_global->__pyx_n_u_ETCompatXMLParser
#define __pyx_n_s_ETXPath __pyx_mstate_global->__pyx_n_s_ETXPath
#define __pyx_n_u_ETXPath __pyx_mstate_global->__pyx_n_u_ETXPath
#define __pyx_kp_u_Either_xml_data_or_from_file_mus __pyx_mstate_global->__pyx_kp_u_Either_xml_data_or_from_file_mus
#define __pyx_kp_u_Element __pyx_mstate_global->__pyx_kp_u_Element
#define __pyx_n_s_ElementBase __pyx_mstate_global->__pyx_n_s_ElementBase
#define __pyx_n_u_ElementBase __pyx_mstate_global->__pyx_n_u_ElementBase
#define __pyx_n_s_ElementChildIterator __pyx_mstate_global->__pyx_n_s_ElementChildIterator
#define __pyx_n_s_ElementClassLookup __pyx_mstate_global->__pyx_n_s_ElementClassLookup
#define __pyx_n_u_ElementClassLookup __pyx_mstate_global->__pyx_n_u_ElementClassLookup
#define __pyx_n_s_ElementDefaultClassLookup __pyx_mstate_global->__pyx_n_s_ElementDefaultClassLookup
#define __pyx_n_u_ElementDefaultClassLookup __pyx_mstate_global->__pyx_n_u_ElementDefaultClassLookup
#define __pyx_n_s_ElementDepthFirstIterator __pyx_mstate_global->__pyx_n_s_ElementDepthFirstIterator
#define __pyx_n_s_ElementIterator __pyx_mstate_global->__pyx_n_s_ElementIterator
#define __pyx_n_s_ElementMatchIterator __pyx_mstate_global->__pyx_n_s_ElementMatchIterator
#define __pyx_n_s_ElementNamespaceClassLookup __pyx_mstate_global->__pyx_n_s_ElementNamespaceClassLookup
#define __pyx_n_u_ElementNamespaceClassLookup __pyx_mstate_global->__pyx_n_u_ElementNamespaceClassLookup
#define __pyx_n_s_ElementNamespaceClassLookup_get __pyx_mstate_global->__pyx_n_s_ElementNamespaceClassLookup_get
#define __pyx_n_s_ElementTagMatcher __pyx_mstate_global->__pyx_n_s_ElementTagMatcher
#define __pyx_n_s_ElementTextIterator __pyx_mstate_global->__pyx_n_s_ElementTextIterator
#define __pyx_n_s_ElementTree __pyx_mstate_global->__pyx_n_s_ElementTree
#define __pyx_n_u_ElementTree __pyx_mstate_global->__pyx_n_u_ElementTree
#define __pyx_n_s_ElementTree_2 __pyx_mstate_global->__pyx_n_s_ElementTree_2
#define __pyx_n_s_ElementTree___copy __pyx_mstate_global->__pyx_n_s_ElementTree___copy
#define __pyx_n_s_ElementTree___deepcopy __pyx_mstate_global->__pyx_n_s_ElementTree___deepcopy
#define __pyx_n_s_ElementTree__setroot __pyx_mstate_global->__pyx_n_s_ElementTree__setroot
#define __pyx_n_s_ElementTree_find __pyx_mstate_global->__pyx_n_s_ElementTree_find
#define __pyx_n_s_ElementTree_findall __pyx_mstate_global->__pyx_n_s_ElementTree_findall
#define __pyx_n_s_ElementTree_findtext __pyx_mstate_global->__pyx_n_s_ElementTree_findtext
#define __pyx_n_s_ElementTree_getelementpath __pyx_mstate_global->__pyx_n_s_ElementTree_getelementpath
#define __pyx_n_s_ElementTree_getiterator __pyx_mstate_global->__pyx_n_s_ElementTree_getiterator
#define __pyx_n_s_ElementTree_getpath __pyx_mstate_global->__pyx_n_s_ElementTree_getpath
#define __pyx_n_s_ElementTree_getroot __pyx_mstate_global->__pyx_n_s_ElementTree_getroot
#define __pyx_n_s_ElementTree_iter __pyx_mstate_global->__pyx_n_s_ElementTree_iter
#define __pyx_n_s_ElementTree_iterfind __pyx_mstate_global->__pyx_n_s_ElementTree_iterfind
#define __pyx_kp_u_ElementTree_not_initialized_miss __pyx_mstate_global->__pyx_kp_u_ElementTree_not_initialized_miss
#define __pyx_n_s_ElementTree_parse __pyx_mstate_global->__pyx_n_s_ElementTree_parse
#define __pyx_n_s_ElementTree_relaxng __pyx_mstate_global->__pyx_n_s_ElementTree_relaxng
#define __pyx_n_s_ElementTree_write __pyx_mstate_global->__pyx_n_s_ElementTree_write
#define __pyx_n_s_ElementTree_write_c14n __pyx_mstate_global->__pyx_n_s_ElementTree_write_c14n
#define __pyx_n_s_ElementTree_xinclude __pyx_mstate_global->__pyx_n_s_ElementTree_xinclude
#define __pyx_n_s_ElementTree_xmlschema __pyx_mstate_global->__pyx_n_s_ElementTree_xmlschema
#define __pyx_n_s_ElementTree_xpath __pyx_mstate_global->__pyx_n_s_ElementTree_xpath
#define __pyx_n_s_ElementTree_xslt __pyx_mstate_global->__pyx_n_s_ElementTree_xslt
#define __pyx_n_s_ElementUnicodeResult __pyx_mstate_global->__pyx_n_s_ElementUnicodeResult
#define __pyx_n_s_ElementUnicodeResult_getparent __pyx_mstate_global->__pyx_n_s_ElementUnicodeResult_getparent
#define __pyx_n_s_Element_2 __pyx_mstate_global->__pyx_n_s_Element_2
#define __pyx_n_u_Element_2 __pyx_mstate_global->__pyx_n_u_Element_2
#define __pyx_n_s_Element_3 __pyx_mstate_global->__pyx_n_s_Element_3
#define __pyx_n_s_Element___copy __pyx_mstate_global->__pyx_n_s_Element___copy
#define __pyx_n_s_Element___deepcopy __pyx_mstate_global->__pyx_n_s_Element___deepcopy
#define __pyx_n_s_Element___reversed __pyx_mstate_global->__pyx_n_s_Element___reversed
#define __pyx_n_s_Element__init __pyx_mstate_global->__pyx_n_s_Element__init
#define __pyx_n_s_Element_addnext __pyx_mstate_global->__pyx_n_s_Element_addnext
#define __pyx_n_s_Element_addprevious __pyx_mstate_global->__pyx_n_s_Element_addprevious
#define __pyx_n_s_Element_append __pyx_mstate_global->__pyx_n_s_Element_append
#define __pyx_n_s_Element_clear __pyx_mstate_global->__pyx_n_s_Element_clear
#define __pyx_n_s_Element_cssselect __pyx_mstate_global->__pyx_n_s_Element_cssselect
#define __pyx_n_s_Element_extend __pyx_mstate_global->__pyx_n_s_Element_extend
#define __pyx_n_s_Element_find __pyx_mstate_global->__pyx_n_s_Element_find
#define __pyx_n_s_Element_findall __pyx_mstate_global->__pyx_n_s_Element_findall
#define __pyx_n_s_Element_findtext __pyx_mstate_global->__pyx_n_s_Element_findtext
#define __pyx_n_s_Element_get __pyx_mstate_global->__pyx_n_s_Element_get
#define __pyx_n_s_Element_getchildren __pyx_mstate_global->__pyx_n_s_Element_getchildren
#define __pyx_n_s_Element_getiterator __pyx_mstate_global->__pyx_n_s_Element_getiterator
#define __pyx_n_s_Element_getnext __pyx_mstate_global->__pyx_n_s_Element_getnext
#define __pyx_n_s_Element_getparent __pyx_mstate_global->__pyx_n_s_Element_getparent
#define __pyx_n_s_Element_getprevious __pyx_mstate_global->__pyx_n_s_Element_getprevious
#define __pyx_n_s_Element_getroottree __pyx_mstate_global->__pyx_n_s_Element_getroottree
#define __pyx_n_s_Element_index __pyx_mstate_global->__pyx_n_s_Element_index
#define __pyx_n_s_Element_insert __pyx_mstate_global->__pyx_n_s_Element_insert
#define __pyx_kp_u_Element_is_not_a_child_of_this_n __pyx_mstate_global->__pyx_kp_u_Element_is_not_a_child_of_this_n
#define __pyx_kp_u_Element_is_not_in_this_tree __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree
#define __pyx_kp_u_Element_is_not_in_this_tree_2 __pyx_mstate_global->__pyx_kp_u_Element_is_not_in_this_tree_2
#define __pyx_n_s_Element_items __pyx_mstate_global->__pyx_n_s_Element_items
#define __pyx_n_s_Element_iter __pyx_mstate_global->__pyx_n_s_Element_iter
#define __pyx_n_s_Element_iterancestors __pyx_mstate_global->__pyx_n_s_Element_iterancestors
#define __pyx_n_s_Element_iterchildren __pyx_mstate_global->__pyx_n_s_Element_iterchildren
#define __pyx_n_s_Element_iterdescendants __pyx_mstate_global->__pyx_n_s_Element_iterdescendants
#define __pyx_n_s_Element_iterfind __pyx_mstate_global->__pyx_n_s_Element_iterfind
#define __pyx_n_s_Element_itersiblings __pyx_mstate_global->__pyx_n_s_Element_itersiblings
#define __pyx_n_s_Element_itertext __pyx_mstate_global->__pyx_n_s_Element_itertext
#define __pyx_n_s_Element_keys __pyx_mstate_global->__pyx_n_s_Element_keys
#define __pyx_n_s_Element_makeelement __pyx_mstate_global->__pyx_n_s_Element_makeelement
#define __pyx_n_s_Element_remove __pyx_mstate_global->__pyx_n_s_Element_remove
#define __pyx_n_s_Element_replace __pyx_mstate_global->__pyx_n_s_Element_replace
#define __pyx_n_s_Element_set __pyx_mstate_global->__pyx_n_s_Element_set
#define __pyx_n_s_Element_values __pyx_mstate_global->__pyx_n_s_Element_values
#define __pyx_n_s_Element_xpath __pyx_mstate_global->__pyx_n_s_Element_xpath
#define __pyx_kp_u_Empty_tag_name __pyx_mstate_global->__pyx_kp_u_Empty_tag_name
#define __pyx_kp_b_Encoding_error __pyx_mstate_global->__pyx_kp_b_Encoding_error
#define __pyx_n_s_Entity __pyx_mstate_global->__pyx_n_s_Entity
#define __pyx_n_u_Entity __pyx_mstate_global->__pyx_n_u_Entity
#define __pyx_n_s_EntityBase __pyx_mstate_global->__pyx_n_s_EntityBase
#define __pyx_n_u_EntityBase __pyx_mstate_global->__pyx_n_u_EntityBase
#define __pyx_n_s_Entity_2 __pyx_mstate_global->__pyx_n_s_Entity_2
#define __pyx_kp_u_Entity_class_must_be_subclass_of __pyx_mstate_global->__pyx_kp_u_Entity_class_must_be_subclass_of
#define __pyx_n_s_Error __pyx_mstate_global->__pyx_n_s_Error
#define __pyx_n_u_Error __pyx_mstate_global->__pyx_n_u_Error
#define __pyx_n_s_ErrorDomains __pyx_mstate_global->__pyx_n_s_ErrorDomains
#define __pyx_n_u_ErrorDomains __pyx_mstate_global->__pyx_n_u_ErrorDomains
#define __pyx_n_s_ErrorLevels __pyx_mstate_global->__pyx_n_s_ErrorLevels
#define __pyx_n_u_ErrorLevels __pyx_mstate_global->__pyx_n_u_ErrorLevels
#define __pyx_n_s_ErrorLog __pyx_mstate_global->__pyx_n_s_ErrorLog
#define __pyx_n_s_ErrorLog___exit __pyx_mstate_global->__pyx_n_s_ErrorLog___exit
#define __pyx_n_s_ErrorLog_clear __pyx_mstate_global->__pyx_n_s_ErrorLog_clear
#define __pyx_n_s_ErrorLog_copy __pyx_mstate_global->__pyx_n_s_ErrorLog_copy
#define __pyx_n_s_ErrorLog_receive __pyx_mstate_global->__pyx_n_s_ErrorLog_receive
#define __pyx_n_s_ErrorTypes __pyx_mstate_global->__pyx_n_s_ErrorTypes
#define __pyx_n_u_ErrorTypes __pyx_mstate_global->__pyx_n_u_ErrorTypes
#define __pyx_kp_u_Error_applying_stylesheet __pyx_mstate_global->__pyx_kp_u_Error_applying_stylesheet
#define __pyx_kp_u_Error_applying_stylesheet_line __pyx_mstate_global->__pyx_kp_u_Error_applying_stylesheet_line
#define __pyx_kp_u_Error_during_serialisation_out_o __pyx_mstate_global->__pyx_kp_u_Error_during_serialisation_out_o
#define __pyx_kp_u_Error_in_xpath_expression __pyx_mstate_global->__pyx_kp_u_Error_in_xpath_expression
#define __pyx_kp_u_Error_reading __pyx_mstate_global->__pyx_kp_u_Error_reading
#define __pyx_kp_u_Error_reading_file __pyx_mstate_global->__pyx_kp_u_Error_reading_file
#define __pyx_kp_s_Error_serialising_an_XSLT_result __pyx_mstate_global->__pyx_kp_s_Error_serialising_an_XSLT_result
#define __pyx_kp_b_Expected_for_variable_reference __pyx_mstate_global->__pyx_kp_b_Expected_for_variable_reference
#define __pyx_n_s_ExsltRegExp_match __pyx_mstate_global->__pyx_n_s_ExsltRegExp_match
#define __pyx_n_s_ExsltRegExp_replace __pyx_mstate_global->__pyx_n_s_ExsltRegExp_replace
#define __pyx_n_s_ExsltRegExp_test __pyx_mstate_global->__pyx_n_s_ExsltRegExp_test
#define __pyx_n_s_Extension __pyx_mstate_global->__pyx_n_s_Extension
#define __pyx_n_u_Extension __pyx_mstate_global->__pyx_n_u_Extension
#define __pyx_n_s_FATAL __pyx_mstate_global->__pyx_n_s_FATAL
#define __pyx_kp_u_Failed_to_create_file __pyx_mstate_global->__pyx_kp_u_Failed_to_create_file
#define __pyx_kp_u_Failed_to_create_validation_cont __pyx_mstate_global->__pyx_kp_u_Failed_to_create_validation_cont
#define __pyx_n_s_FallbackElementClassLookup __pyx_mstate_global->__pyx_n_s_FallbackElementClassLookup
#define __pyx_n_u_FallbackElementClassLookup __pyx_mstate_global->__pyx_n_u_FallbackElementClassLookup
#define __pyx_n_s_FallbackElementClassLookup_set_f __pyx_mstate_global->__pyx_n_s_FallbackElementClassLookup_set_f
#define __pyx_n_s_FeedParser __pyx_mstate_global->__pyx_n_s_FeedParser
#define __pyx_n_s_FeedParser_close __pyx_mstate_global->__pyx_n_s_FeedParser_close
#define __pyx_n_s_FeedParser_feed __pyx_mstate_global->__pyx_n_s_FeedParser_feed
#define __pyx_n_s_FileWriterElement___enter __pyx_mstate_global->__pyx_n_s_FileWriterElement___enter
#define __pyx_n_s_FileWriterElement___exit __pyx_mstate_global->__pyx_n_s_FileWriterElement___exit
#define __pyx_kp_u_File_is_already_closed __pyx_mstate_global->__pyx_kp_u_File_is_already_closed
#define __pyx_kp_u_File_or_filename_expected_got __pyx_mstate_global->__pyx_kp_u_File_or_filename_expected_got
#define __pyx_kp_b_Forbidden_variable __pyx_mstate_global->__pyx_kp_b_Forbidden_variable
#define __pyx_n_s_FunctionNamespace __pyx_mstate_global->__pyx_n_s_FunctionNamespace
#define __pyx_n_u_FunctionNamespace __pyx_mstate_global->__pyx_n_u_FunctionNamespace
#define __pyx_kp_u_FunctionNamespace_line_207 __pyx_mstate_global->__pyx_kp_u_FunctionNamespace_line_207
#define __pyx_kp_u_FunctionNamespace_ns_uri_Retriev __pyx_mstate_global->__pyx_kp_u_FunctionNamespace_ns_uri_Retriev
#define __pyx_kp_u_FunctionNamespace_r __pyx_mstate_global->__pyx_kp_u_FunctionNamespace_r
#define __pyx_n_s_FutureWarning __pyx_mstate_global->__pyx_n_s_FutureWarning
#define __pyx_n_u_GlobalErrorLog __pyx_mstate_global->__pyx_n_u_GlobalErrorLog
#define __pyx_n_s_GzipFile __pyx_mstate_global->__pyx_n_s_GzipFile
#define __pyx_n_s_HTML __pyx_mstate_global->__pyx_n_s_HTML
#define __pyx_n_u_HTML __pyx_mstate_global->__pyx_n_u_HTML
#define __pyx_n_s_HTMLParser __pyx_mstate_global->__pyx_n_s_HTMLParser
#define __pyx_n_u_HTMLParser __pyx_mstate_global->__pyx_n_u_HTMLParser
#define __pyx_n_s_HTMLPullParser __pyx_mstate_global->__pyx_n_s_HTMLPullParser
#define __pyx_n_s_HTMLPullParser_read_events __pyx_mstate_global->__pyx_n_s_HTMLPullParser_read_events
#define __pyx_n_s_ICONV_COMPILED_VERSION __pyx_mstate_global->__pyx_n_s_ICONV_COMPILED_VERSION
#define __pyx_n_s_IDDict __pyx_mstate_global->__pyx_n_s_IDDict
#define __pyx_n_s_IDDict_copy __pyx_mstate_global->__pyx_n_s_IDDict_copy
#define __pyx_n_s_IDDict_get __pyx_mstate_global->__pyx_n_s_IDDict_get
#define __pyx_n_s_IDDict_has_key __pyx_mstate_global->__pyx_n_s_IDDict_has_key
#define __pyx_n_s_IDDict_items __pyx_mstate_global->__pyx_n_s_IDDict_items
#define __pyx_n_s_IDDict_iteritems __pyx_mstate_global->__pyx_n_s_IDDict_iteritems
#define __pyx_n_s_IDDict_iterkeys __pyx_mstate_global->__pyx_n_s_IDDict_iterkeys
#define __pyx_n_s_IDDict_itervalues __pyx_mstate_global->__pyx_n_s_IDDict_itervalues
#define __pyx_n_s_IDDict_keys __pyx_mstate_global->__pyx_n_s_IDDict_keys
#define __pyx_n_s_IDDict_values __pyx_mstate_global->__pyx_n_s_IDDict_values
#define __pyx_kp_u_ID_attribute_not_found __pyx_mstate_global->__pyx_kp_u_ID_attribute_not_found
#define __pyx_n_s_IGNORECASE __pyx_mstate_global->__pyx_n_s_IGNORECASE
#define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
#define __pyx_kp_u_Illegal_Unicode_kind __pyx_mstate_global->__pyx_kp_u_Illegal_Unicode_kind
#define __pyx_kp_u_Illegal_document_provided_NULL __pyx_mstate_global->__pyx_kp_u_Illegal_document_provided_NULL
#define __pyx_kp_u_Illegal_document_provided_expect __pyx_mstate_global->__pyx_kp_u_Illegal_document_provided_expect
#define __pyx_n_s_ImmutableMapping __pyx_mstate_global->__pyx_n_s_ImmutableMapping
#define __pyx_n_s_ImmutableMapping___contains __pyx_mstate_global->__pyx_n_s_ImmutableMapping___contains
#define __pyx_n_s_ImmutableMapping___delitem __pyx_mstate_global->__pyx_n_s_ImmutableMapping___delitem
#define __pyx_n_s_ImmutableMapping___getitem __pyx_mstate_global->__pyx_n_s_ImmutableMapping___getitem
#define __pyx_n_s_ImmutableMapping___iter __pyx_mstate_global->__pyx_n_s_ImmutableMapping___iter
#define __pyx_n_s_ImmutableMapping___len __pyx_mstate_global->__pyx_n_s_ImmutableMapping___len
#define __pyx_n_s_ImmutableMapping___setitem __pyx_mstate_global->__pyx_n_s_ImmutableMapping___setitem
#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
#define __pyx_kp_u_Inconsistent_enter_action_in_con __pyx_mstate_global->__pyx_kp_u_Inconsistent_enter_action_in_con
#define __pyx_kp_u_Inconsistent_exit_action_in_cont __pyx_mstate_global->__pyx_kp_u_Inconsistent_exit_action_in_cont
#define __pyx_n_s_IncrementalFileWriter_element __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_element
#define __pyx_n_s_IncrementalFileWriter_flush __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_flush
#define __pyx_n_s_IncrementalFileWriter_method __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_method
#define __pyx_n_s_IncrementalFileWriter_write __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_write
#define __pyx_n_s_IncrementalFileWriter_write_dec __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_write_dec
#define __pyx_n_s_IncrementalFileWriter_write_doc __pyx_mstate_global->__pyx_n_s_IncrementalFileWriter_write_doc
#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError
#define __pyx_kp_u_Initial_indentation_level_must_b __pyx_mstate_global->__pyx_kp_u_Initial_indentation_level_must_b
#define __pyx_kp_u_Input_object_has_no_document __pyx_mstate_global->__pyx_kp_u_Input_object_has_no_document
#define __pyx_kp_u_Input_object_is_not_an_XML_eleme __pyx_mstate_global->__pyx_kp_u_Input_object_is_not_an_XML_eleme
#define __pyx_kp_u_Internal_error_in_DTD_validation __pyx_mstate_global->__pyx_kp_u_Internal_error_in_DTD_validation
#define __pyx_kp_u_Internal_error_in_Relax_NG_valid __pyx_mstate_global->__pyx_kp_u_Internal_error_in_Relax_NG_valid
#define __pyx_kp_u_Internal_error_in_Schematron_val __pyx_mstate_global->__pyx_kp_u_Internal_error_in_Schematron_val
#define __pyx_kp_u_Internal_error_in_XML_Schema_val __pyx_mstate_global->__pyx_kp_u_Internal_error_in_XML_Schema_val
#define __pyx_kp_u_Invalid_HTML_tag_name __pyx_mstate_global->__pyx_kp_u_Invalid_HTML_tag_name
#define __pyx_kp_u_Invalid_PI_name __pyx_mstate_global->__pyx_kp_u_Invalid_PI_name
#define __pyx_kp_u_Invalid_URL_must_not_contain_or __pyx_mstate_global->__pyx_kp_u_Invalid_URL_must_not_contain_or
#define __pyx_kp_u_Invalid_attribute_dictionary __pyx_mstate_global->__pyx_kp_u_Invalid_attribute_dictionary
#define __pyx_kp_u_Invalid_attribute_name __pyx_mstate_global->__pyx_kp_u_Invalid_attribute_name
#define __pyx_kp_u_Invalid_character __pyx_mstate_global->__pyx_kp_u_Invalid_character
#define __pyx_kp_u_Invalid_character_reference __pyx_mstate_global->__pyx_kp_u_Invalid_character_reference
#define __pyx_kp_u_Invalid_character_s __pyx_mstate_global->__pyx_kp_u_Invalid_character_s
#define __pyx_kp_u_Invalid_child_type __pyx_mstate_global->__pyx_kp_u_Invalid_child_type
#define __pyx_kp_b_Invalid_context_position __pyx_mstate_global->__pyx_kp_b_Invalid_context_position
#define __pyx_kp_b_Invalid_context_size __pyx_mstate_global->__pyx_kp_b_Invalid_context_size
#define __pyx_kp_u_Invalid_entity_name __pyx_mstate_global->__pyx_kp_u_Invalid_entity_name
#define __pyx_kp_u_Invalid_entity_reference __pyx_mstate_global->__pyx_kp_u_Invalid_entity_reference
#define __pyx_kp_b_Invalid_expression __pyx_mstate_global->__pyx_kp_b_Invalid_expression
#define __pyx_kp_u_Invalid_input_object __pyx_mstate_global->__pyx_kp_u_Invalid_input_object
#define __pyx_kp_u_Invalid_input_tag_of_type __pyx_mstate_global->__pyx_kp_u_Invalid_input_tag_of_type
#define __pyx_kp_u_Invalid_namespace_URI __pyx_mstate_global->__pyx_kp_u_Invalid_namespace_URI
#define __pyx_kp_u_Invalid_namespace_prefix __pyx_mstate_global->__pyx_kp_u_Invalid_namespace_prefix
#define __pyx_kp_b_Invalid_number_of_arguments __pyx_mstate_global->__pyx_kp_b_Invalid_number_of_arguments
#define __pyx_kp_b_Invalid_operand __pyx_mstate_global->__pyx_kp_b_Invalid_operand
#define __pyx_kp_b_Invalid_or_incomplete_context __pyx_mstate_global->__pyx_kp_b_Invalid_or_incomplete_context
#define __pyx_kp_b_Invalid_predicate __pyx_mstate_global->__pyx_kp_b_Invalid_predicate
#define __pyx_kp_u_Invalid_tag_name __pyx_mstate_global->__pyx_kp_u_Invalid_tag_name
#define __pyx_kp_u_Invalid_tag_name_2 __pyx_mstate_global->__pyx_kp_u_Invalid_tag_name_2
#define __pyx_kp_b_Invalid_type __pyx_mstate_global->__pyx_kp_b_Invalid_type
#define __pyx_n_s_KeyError __pyx_mstate_global->__pyx_n_s_KeyError
#define __pyx_n_u_LE __pyx_mstate_global->__pyx_n_u_LE
#define __pyx_n_s_LIBXML_COMPILED_VERSION __pyx_mstate_global->__pyx_n_s_LIBXML_COMPILED_VERSION
#define __pyx_n_u_LIBXML_COMPILED_VERSION __pyx_mstate_global->__pyx_n_u_LIBXML_COMPILED_VERSION
#define __pyx_n_s_LIBXML_VERSION __pyx_mstate_global->__pyx_n_s_LIBXML_VERSION
#define __pyx_n_u_LIBXML_VERSION __pyx_mstate_global->__pyx_n_u_LIBXML_VERSION
#define __pyx_n_s_LIBXSLT_COMPILED_VERSION __pyx_mstate_global->__pyx_n_s_LIBXSLT_COMPILED_VERSION
#define __pyx_n_u_LIBXSLT_COMPILED_VERSION __pyx_mstate_global->__pyx_n_u_LIBXSLT_COMPILED_VERSION
#define __pyx_n_s_LIBXSLT_VERSION __pyx_mstate_global->__pyx_n_s_LIBXSLT_VERSION
#define __pyx_n_u_LIBXSLT_VERSION __pyx_mstate_global->__pyx_n_u_LIBXSLT_VERSION
#define __pyx_n_s_LXML_VERSION __pyx_mstate_global->__pyx_n_s_LXML_VERSION
#define __pyx_n_u_LXML_VERSION __pyx_mstate_global->__pyx_n_u_LXML_VERSION
#define __pyx_kp_s_Libxml2_RelaxNG_error_types __pyx_mstate_global->__pyx_kp_s_Libxml2_RelaxNG_error_types
#define __pyx_kp_s_Libxml2_error_domains __pyx_mstate_global->__pyx_kp_s_Libxml2_error_domains
#define __pyx_kp_s_Libxml2_error_levels __pyx_mstate_global->__pyx_kp_s_Libxml2_error_levels
#define __pyx_kp_s_Libxml2_error_types __pyx_mstate_global->__pyx_kp_s_Libxml2_error_types
#define __pyx_n_s_ListErrorLog __pyx_mstate_global->__pyx_n_s_ListErrorLog
#define __pyx_n_s_ListErrorLog_copy __pyx_mstate_global->__pyx_n_s_ListErrorLog_copy
#define __pyx_n_s_ListErrorLog_filter_domains __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_domains
#define __pyx_n_s_ListErrorLog_filter_from_errors __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_from_errors
#define __pyx_n_s_ListErrorLog_filter_from_fatals __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_from_fatals
#define __pyx_n_s_ListErrorLog_filter_from_level __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_from_level
#define __pyx_n_s_ListErrorLog_filter_from_warnin __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_from_warnin
#define __pyx_n_s_ListErrorLog_filter_levels __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_levels
#define __pyx_n_s_ListErrorLog_filter_types __pyx_mstate_global->__pyx_n_s_ListErrorLog_filter_types
#define __pyx_n_s_LogEntry __pyx_mstate_global->__pyx_n_s_LogEntry
#define __pyx_n_s_LookupError __pyx_mstate_global->__pyx_n_s_LookupError
#define __pyx_n_s_LxmlError __pyx_mstate_global->__pyx_n_s_LxmlError
#define __pyx_n_u_LxmlError __pyx_mstate_global->__pyx_n_u_LxmlError
#define __pyx_n_s_LxmlRegistryError __pyx_mstate_global->__pyx_n_s_LxmlRegistryError
#define __pyx_n_u_LxmlRegistryError __pyx_mstate_global->__pyx_n_u_LxmlRegistryError
#define __pyx_n_s_LxmlSyntaxError __pyx_mstate_global->__pyx_n_s_LxmlSyntaxError
#define __pyx_n_u_LxmlSyntaxError __pyx_mstate_global->__pyx_n_u_LxmlSyntaxError
#define __pyx_n_s_MemDebug_blocks_used __pyx_mstate_global->__pyx_n_s_MemDebug_blocks_used
#define __pyx_n_s_MemDebug_bytes_used __pyx_mstate_global->__pyx_n_s_MemDebug_bytes_used
#define __pyx_n_s_MemDebug_dict_size __pyx_mstate_global->__pyx_n_s_MemDebug_dict_size
#define __pyx_n_s_MemDebug_dump __pyx_mstate_global->__pyx_n_s_MemDebug_dump
#define __pyx_n_s_MemDebug_show __pyx_mstate_global->__pyx_n_s_MemDebug_show
#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
#define __pyx_kp_b_Memory_allocation_error __pyx_mstate_global->__pyx_kp_b_Memory_allocation_error
#define __pyx_n_s_MethodChanger___aenter __pyx_mstate_global->__pyx_n_s_MethodChanger___aenter
#define __pyx_n_s_MethodChanger___aexit __pyx_mstate_global->__pyx_n_s_MethodChanger___aexit
#define __pyx_n_s_MethodChanger___enter __pyx_mstate_global->__pyx_n_s_MethodChanger___enter
#define __pyx_n_s_MethodChanger___exit __pyx_mstate_global->__pyx_n_s_MethodChanger___exit
#define __pyx_kp_u_Method_changed_outside_of_contex __pyx_mstate_global->__pyx_kp_u_Method_changed_outside_of_contex
#define __pyx_kp_b_Missing_closing_curly_brace __pyx_mstate_global->__pyx_kp_b_Missing_closing_curly_brace
#define __pyx_n_s_MutableMapping __pyx_mstate_global->__pyx_n_s_MutableMapping
#define __pyx_n_u_NAMESPACE __pyx_mstate_global->__pyx_n_u_NAMESPACE
#define __pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE __pyx_mstate_global->__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE
#define __pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3 __pyx_mstate_global->__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3
#define __pyx_kp_u_Name_not_registered __pyx_mstate_global->__pyx_kp_u_Name_not_registered
#define __pyx_kp_u_Namespace __pyx_mstate_global->__pyx_kp_u_Namespace
#define __pyx_n_s_NamespaceRegistryError __pyx_mstate_global->__pyx_n_s_NamespaceRegistryError
#define __pyx_n_u_NamespaceRegistryError __pyx_mstate_global->__pyx_n_u_NamespaceRegistryError
#define __pyx_n_s_NamespaceRegistry___deco __pyx_mstate_global->__pyx_n_s_NamespaceRegistry___deco
#define __pyx_n_s_NamespaceRegistry__deco __pyx_mstate_global->__pyx_n_s_NamespaceRegistry__deco
#define __pyx_n_s_NamespaceRegistry_clear __pyx_mstate_global->__pyx_n_s_NamespaceRegistry_clear
#define __pyx_n_s_NamespaceRegistry_items __pyx_mstate_global->__pyx_n_s_NamespaceRegistry_items
#define __pyx_n_s_NamespaceRegistry_iteritems __pyx_mstate_global->__pyx_n_s_NamespaceRegistry_iteritems
#define __pyx_n_s_NamespaceRegistry_update __pyx_mstate_global->__pyx_n_s_NamespaceRegistry_update
#define __pyx_kp_u_Namespace_r __pyx_mstate_global->__pyx_kp_u_Namespace_r
#define __pyx_kp_u_No_ID_dictionary_available __pyx_mstate_global->__pyx_kp_u_No_ID_dictionary_available
#define __pyx_kp_u_No_document_to_serialise __pyx_mstate_global->__pyx_kp_u_No_document_to_serialise
#define __pyx_kp_u_No_tree_or_file_given __pyx_mstate_global->__pyx_kp_u_No_tree_or_file_given
#define __pyx_kp_u_Node_must_not_be_None __pyx_mstate_global->__pyx_kp_u_Node_must_not_be_None
#define __pyx_kp_u_Non_Element_values_not_supported __pyx_mstate_global->__pyx_kp_u_Non_Element_values_not_supported
#define __pyx_kp_u_None __pyx_mstate_global->__pyx_kp_u_None
#define __pyx_n_s_NotImplemented __pyx_mstate_global->__pyx_n_s_NotImplemented
#define __pyx_n_s_NotImplementedError __pyx_mstate_global->__pyx_n_s_NotImplementedError
#define __pyx_kp_u_Not_yet_implemented_result_node __pyx_mstate_global->__pyx_kp_u_Not_yet_implemented_result_node
#define __pyx_kp_b_Number_encoding __pyx_mstate_global->__pyx_kp_b_Number_encoding
#define __pyx_n_b_Ok __pyx_mstate_global->__pyx_n_b_Ok
#define __pyx_kp_u_Only_elements_can_be_the_root_of __pyx_mstate_global->__pyx_kp_u_Only_elements_can_be_the_root_of
#define __pyx_kp_u_Only_processing_instructions_and __pyx_mstate_global->__pyx_kp_u_Only_processing_instructions_and
#define __pyx_n_s_OpaqueDocumentWrapper_append __pyx_mstate_global->__pyx_n_s_OpaqueDocumentWrapper_append
#define __pyx_n_s_OpaqueDocumentWrapper_extend __pyx_mstate_global->__pyx_n_s_OpaqueDocumentWrapper_extend
#define __pyx_n_s_OrderedDict __pyx_mstate_global->__pyx_n_s_OrderedDict
#define __pyx_kp_u_Output_file_needs_an_async_write __pyx_mstate_global->__pyx_kp_u_Output_file_needs_an_async_write
#define __pyx_n_u_PARSER __pyx_mstate_global->__pyx_n_u_PARSER
#define __pyx_n_s_PI __pyx_mstate_global->__pyx_n_s_PI
#define __pyx_n_u_PI __pyx_mstate_global->__pyx_n_u_PI
#define __pyx_n_s_PIBase __pyx_mstate_global->__pyx_n_s_PIBase
#define __pyx_n_u_PIBase __pyx_mstate_global->__pyx_n_u_PIBase
#define __pyx_kp_u_PI_class_must_be_subclass_of_PIB __pyx_mstate_global->__pyx_kp_u_PI_class_must_be_subclass_of_PIB
#define __pyx_kp_u_PI_lacks_content __pyx_mstate_global->__pyx_kp_u_PI_lacks_content
#define __pyx_kp_u_PI_text_must_not_contain __pyx_mstate_global->__pyx_kp_u_PI_text_must_not_contain
#define __pyx_kp_u_PUBLIC __pyx_mstate_global->__pyx_kp_u_PUBLIC
#define __pyx_n_s_ParseError __pyx_mstate_global->__pyx_n_s_ParseError
#define __pyx_n_u_ParseError __pyx_mstate_global->__pyx_n_u_ParseError
#define __pyx_n_s_ParseError___init __pyx_mstate_global->__pyx_n_s_ParseError___init
#define __pyx_n_s_ParseError_position __pyx_mstate_global->__pyx_n_s_ParseError_position
#define __pyx_n_s_ParserBasedElementClassLookup __pyx_mstate_global->__pyx_n_s_ParserBasedElementClassLookup
#define __pyx_n_u_ParserBasedElementClassLookup __pyx_mstate_global->__pyx_n_u_ParserBasedElementClassLookup
#define __pyx_n_u_ParserDictionaryContext __pyx_mstate_global->__pyx_n_u_ParserDictionaryContext
#define __pyx_n_s_ParserError __pyx_mstate_global->__pyx_n_s_ParserError
#define __pyx_n_u_ParserError __pyx_mstate_global->__pyx_n_u_ParserError
#define __pyx_kp_u_ParserSchemaValidationContext_n __pyx_mstate_global->__pyx_kp_u_ParserSchemaValidationContext_n
#define __pyx_kp_u_Parsing_requires_string_data __pyx_mstate_global->__pyx_kp_u_Parsing_requires_string_data
#define __pyx_kp_u_Prefix __pyx_mstate_global->__pyx_kp_u_Prefix
#define __pyx_kp_u_Prefix_format_reserved_for_inter __pyx_mstate_global->__pyx_kp_u_Prefix_format_reserved_for_inter
#define __pyx_n_s_ProcessingInstruction __pyx_mstate_global->__pyx_n_s_ProcessingInstruction
#define __pyx_n_u_ProcessingInstruction __pyx_mstate_global->__pyx_n_u_ProcessingInstruction
#define __pyx_n_s_ProcessingInstruction_2 __pyx_mstate_global->__pyx_n_s_ProcessingInstruction_2
#define __pyx_n_s_ProcessingInstruction_get __pyx_mstate_global->__pyx_n_s_ProcessingInstruction_get
#define __pyx_kp_u_Proxy_invalidated __pyx_mstate_global->__pyx_kp_u_Proxy_invalidated
#define __pyx_n_s_PyErrorLog __pyx_mstate_global->__pyx_n_s_PyErrorLog
#define __pyx_n_u_PyErrorLog __pyx_mstate_global->__pyx_n_u_PyErrorLog
#define __pyx_n_s_PyErrorLog_copy __pyx_mstate_global->__pyx_n_s_PyErrorLog_copy
#define __pyx_n_s_PyErrorLog_log __pyx_mstate_global->__pyx_n_s_PyErrorLog_log
#define __pyx_n_s_PyErrorLog_receive __pyx_mstate_global->__pyx_n_s_PyErrorLog_receive
#define __pyx_n_s_PythonElementClassLookup __pyx_mstate_global->__pyx_n_s_PythonElementClassLookup
#define __pyx_n_u_PythonElementClassLookup __pyx_mstate_global->__pyx_n_u_PythonElementClassLookup
#define __pyx_n_s_PythonElementClassLookup_lookup __pyx_mstate_global->__pyx_n_s_PythonElementClassLookup_lookup
#define __pyx_n_s_QName __pyx_mstate_global->__pyx_n_s_QName
#define __pyx_n_u_QName __pyx_mstate_global->__pyx_n_u_QName
#define __pyx_n_s_RELAXNGV __pyx_mstate_global->__pyx_n_s_RELAXNGV
#define __pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY __pyx_mstate_global->__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY
#define __pyx_n_s_ReadOnlyElementProxy_get __pyx_mstate_global->__pyx_n_s_ReadOnlyElementProxy_get
#define __pyx_n_s_ReadOnlyElementProxy_items __pyx_mstate_global->__pyx_n_s_ReadOnlyElementProxy_items
#define __pyx_n_s_ReadOnlyElementProxy_keys __pyx_mstate_global->__pyx_n_s_ReadOnlyElementProxy_keys
#define __pyx_n_s_ReadOnlyElementProxy_values __pyx_mstate_global->__pyx_n_s_ReadOnlyElementProxy_values
#define __pyx_n_s_ReadOnlyProxy___copy __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy___copy
#define __pyx_n_s_ReadOnlyProxy___deepcopy __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy___deepcopy
#define __pyx_n_s_ReadOnlyProxy_getchildren __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy_getchildren
#define __pyx_n_s_ReadOnlyProxy_getnext __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy_getnext
#define __pyx_n_s_ReadOnlyProxy_getparent __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy_getparent
#define __pyx_n_s_ReadOnlyProxy_getprevious __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy_getprevious
#define __pyx_n_s_ReadOnlyProxy_iterchildren __pyx_mstate_global->__pyx_n_s_ReadOnlyProxy_iterchildren
#define __pyx_n_s_ReferenceError __pyx_mstate_global->__pyx_n_s_ReferenceError
#define __pyx_kp_u_Registered_element_classes_must __pyx_mstate_global->__pyx_kp_u_Registered_element_classes_must
#define __pyx_kp_u_Registered_functions_must_be_cal __pyx_mstate_global->__pyx_kp_u_Registered_functions_must_be_cal
#define __pyx_n_s_RelaxNG __pyx_mstate_global->__pyx_n_s_RelaxNG
#define __pyx_n_u_RelaxNG __pyx_mstate_global->__pyx_n_u_RelaxNG
#define __pyx_n_s_RelaxNGError __pyx_mstate_global->__pyx_n_s_RelaxNGError
#define __pyx_n_u_RelaxNGError __pyx_mstate_global->__pyx_n_u_RelaxNGError
#define __pyx_n_s_RelaxNGErrorTypes __pyx_mstate_global->__pyx_n_s_RelaxNGErrorTypes
#define __pyx_n_u_RelaxNGErrorTypes __pyx_mstate_global->__pyx_n_u_RelaxNGErrorTypes
#define __pyx_n_s_RelaxNGParseError __pyx_mstate_global->__pyx_n_s_RelaxNGParseError
#define __pyx_n_u_RelaxNGParseError __pyx_mstate_global->__pyx_n_u_RelaxNGParseError
#define __pyx_n_s_RelaxNGValidateError __pyx_mstate_global->__pyx_n_s_RelaxNGValidateError
#define __pyx_n_u_RelaxNGValidateError __pyx_mstate_global->__pyx_n_u_RelaxNGValidateError
#define __pyx_n_s_RelaxNG_from_rnc_string __pyx_mstate_global->__pyx_n_s_RelaxNG_from_rnc_string
#define __pyx_kp_u_RelaxNG_instance_not_initialised __pyx_mstate_global->__pyx_kp_u_RelaxNG_instance_not_initialised
#define __pyx_n_s_Resolver __pyx_mstate_global->__pyx_n_s_Resolver
#define __pyx_n_u_Resolver __pyx_mstate_global->__pyx_n_u_Resolver
#define __pyx_n_s_ResolverRegistry_add __pyx_mstate_global->__pyx_n_s_ResolverRegistry_add
#define __pyx_n_s_ResolverRegistry_copy __pyx_mstate_global->__pyx_n_s_ResolverRegistry_copy
#define __pyx_n_s_ResolverRegistry_remove __pyx_mstate_global->__pyx_n_s_ResolverRegistry_remove
#define __pyx_n_s_ResolverRegistry_resolve __pyx_mstate_global->__pyx_n_s_ResolverRegistry_resolve
#define __pyx_n_s_Resolver_resolve __pyx_mstate_global->__pyx_n_s_Resolver_resolve
#define __pyx_n_s_Resolver_resolve_empty __pyx_mstate_global->__pyx_n_s_Resolver_resolve_empty
#define __pyx_n_s_Resolver_resolve_file __pyx_mstate_global->__pyx_n_s_Resolver_resolve_file
#define __pyx_n_s_Resolver_resolve_filename __pyx_mstate_global->__pyx_n_s_Resolver_resolve_filename
#define __pyx_n_s_Resolver_resolve_string __pyx_mstate_global->__pyx_n_s_Resolver_resolve_string
#define __pyx_kp_b_Resource_error __pyx_mstate_global->__pyx_kp_b_Resource_error
#define __pyx_n_s_RotatingErrorLog __pyx_mstate_global->__pyx_n_s_RotatingErrorLog
#define __pyx_n_s_RotatingErrorLog_receive __pyx_mstate_global->__pyx_n_s_RotatingErrorLog_receive
#define __pyx_kp_u_SYSTEM __pyx_mstate_global->__pyx_kp_u_SYSTEM
#define __pyx_n_s_SaxParserTarget __pyx_mstate_global->__pyx_n_s_SaxParserTarget
#define __pyx_kp_u_Schema_instance_not_initialised __pyx_mstate_global->__pyx_kp_u_Schema_instance_not_initialised
#define __pyx_n_s_Schematron __pyx_mstate_global->__pyx_n_s_Schematron
#define __pyx_n_u_Schematron __pyx_mstate_global->__pyx_n_u_Schematron
#define __pyx_n_s_SchematronError __pyx_mstate_global->__pyx_n_s_SchematronError
#define __pyx_n_u_SchematronError __pyx_mstate_global->__pyx_n_u_SchematronError
#define __pyx_n_s_SchematronParseError __pyx_mstate_global->__pyx_n_s_SchematronParseError
#define __pyx_n_u_SchematronParseError __pyx_mstate_global->__pyx_n_u_SchematronParseError
#define __pyx_n_s_SchematronValidateError __pyx_mstate_global->__pyx_n_s_SchematronValidateError
#define __pyx_n_u_SchematronValidateError __pyx_mstate_global->__pyx_n_u_SchematronValidateError
#define __pyx_kp_u_Schematron_instance_not_initiali __pyx_mstate_global->__pyx_kp_u_Schematron_instance_not_initiali
#define __pyx_n_s_SerialisationError __pyx_mstate_global->__pyx_n_s_SerialisationError
#define __pyx_n_u_SerialisationError __pyx_mstate_global->__pyx_n_u_SerialisationError
#define __pyx_kp_u_Serialisation_to_unicode_must_no __pyx_mstate_global->__pyx_kp_u_Serialisation_to_unicode_must_no
#define __pyx_n_s_SiblingsIterator __pyx_mstate_global->__pyx_n_s_SiblingsIterator
#define __pyx_kp_b_Stack_usage_error __pyx_mstate_global->__pyx_kp_b_Stack_usage_error
#define __pyx_kp_b_Start_of_literal __pyx_mstate_global->__pyx_kp_b_Start_of_literal
#define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration
#define __pyx_n_s_StringIO __pyx_mstate_global->__pyx_n_s_StringIO
#define __pyx_n_s_SubElement __pyx_mstate_global->__pyx_n_s_SubElement
#define __pyx_n_u_SubElement __pyx_mstate_global->__pyx_n_u_SubElement
#define __pyx_kp_b_Sub_resource_error __pyx_mstate_global->__pyx_kp_b_Sub_resource_error
#define __pyx_n_s_SyntaxError __pyx_mstate_global->__pyx_n_s_SyntaxError
#define __pyx_kp_b_Syntax_error __pyx_mstate_global->__pyx_kp_b_Syntax_error
#define __pyx_kp_s_Syntax_error_while_parsing_an_XM __pyx_mstate_global->__pyx_kp_s_Syntax_error_while_parsing_an_XM
#define __pyx_kp_s_Syntax_error_while_parsing_an_XM_2 __pyx_mstate_global->__pyx_kp_s_Syntax_error_while_parsing_an_XM_2
#define __pyx_kp_u_System_URL_may_not_contain_both __pyx_mstate_global->__pyx_kp_u_System_URL_may_not_contain_both
#define __pyx_n_u_TAG __pyx_mstate_global->__pyx_n_u_TAG
#define __pyx_n_s_TargetParserResult __pyx_mstate_global->__pyx_n_s_TargetParserResult
#define __pyx_n_s_TargetParserResult___init __pyx_mstate_global->__pyx_n_s_TargetParserResult___init
#define __pyx_kp_u_The_behavior_of_this_method_will __pyx_mstate_global->__pyx_kp_u_The_behavior_of_this_method_will
#define __pyx_kp_u_The_docstring_option_is_deprecat __pyx_mstate_global->__pyx_kp_u_The_docstring_option_is_deprecat
#define __pyx_kp_u_This_class_cannot_be_instantiate __pyx_mstate_global->__pyx_kp_u_This_class_cannot_be_instantiate
#define __pyx_kp_u_This_is_not_a_supported_node_set __pyx_mstate_global->__pyx_kp_u_This_is_not_a_supported_node_set
#define __pyx_kp_u_This_search_incorrectly_ignores __pyx_mstate_global->__pyx_kp_u_This_search_incorrectly_ignores
#define __pyx_kp_u_This_type_cannot_be_instantiated __pyx_mstate_global->__pyx_kp_u_This_type_cannot_be_instantiated
#define __pyx_n_s_TreeBuilder __pyx_mstate_global->__pyx_n_s_TreeBuilder
#define __pyx_n_u_TreeBuilder __pyx_mstate_global->__pyx_n_u_TreeBuilder
#define __pyx_n_s_TreeBuilder_close __pyx_mstate_global->__pyx_n_s_TreeBuilder_close
#define __pyx_n_s_TreeBuilder_comment __pyx_mstate_global->__pyx_n_s_TreeBuilder_comment
#define __pyx_n_s_TreeBuilder_data __pyx_mstate_global->__pyx_n_s_TreeBuilder_data
#define __pyx_n_s_TreeBuilder_end __pyx_mstate_global->__pyx_n_s_TreeBuilder_end
#define __pyx_n_s_TreeBuilder_pi __pyx_mstate_global->__pyx_n_s_TreeBuilder_pi
#define __pyx_n_s_TreeBuilder_start __pyx_mstate_global->__pyx_n_s_TreeBuilder_start
#define __pyx_kp_u_Tried_to_unregister_unknown_prox __pyx_mstate_global->__pyx_kp_u_Tried_to_unregister_unknown_prox
#define __pyx_kp_u_Type __pyx_mstate_global->__pyx_kp_u_Type
#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
#define __pyx_n_s_U __pyx_mstate_global->__pyx_n_s_U
#define __pyx_n_s_UNICODE __pyx_mstate_global->__pyx_n_s_UNICODE
#define __pyx_kp_u_US_ASCII __pyx_mstate_global->__pyx_kp_u_US_ASCII
#define __pyx_n_u_UTF8 __pyx_mstate_global->__pyx_n_u_UTF8
#define __pyx_kp_u_UTF_8 __pyx_mstate_global->__pyx_kp_u_UTF_8
#define __pyx_kp_b_Undefined_namespace_prefix __pyx_mstate_global->__pyx_kp_b_Undefined_namespace_prefix
#define __pyx_kp_b_Undefined_variable __pyx_mstate_global->__pyx_kp_b_Undefined_variable
#define __pyx_kp_u_Undefined_xpath_result __pyx_mstate_global->__pyx_kp_u_Undefined_xpath_result
#define __pyx_kp_b_Unfinished_literal __pyx_mstate_global->__pyx_kp_b_Unfinished_literal
#define __pyx_n_s_UnicodeDecodeError __pyx_mstate_global->__pyx_n_s_UnicodeDecodeError
#define __pyx_n_s_UnicodeEncodeError __pyx_mstate_global->__pyx_n_s_UnicodeEncodeError
#define __pyx_kp_u_Unicode_strings_with_encoding_de __pyx_mstate_global->__pyx_kp_u_Unicode_strings_with_encoding_de
#define __pyx_kp_b_Unknown_error __pyx_mstate_global->__pyx_kp_b_Unknown_error
#define __pyx_kp_u_Unknown_libxml2_version __pyx_mstate_global->__pyx_kp_u_Unknown_libxml2_version
#define __pyx_kp_u_Unknown_node_type __pyx_mstate_global->__pyx_kp_u_Unknown_node_type
#define __pyx_kp_u_Unknown_return_type __pyx_mstate_global->__pyx_kp_u_Unknown_return_type
#define __pyx_kp_u_Unknown_xpath_result __pyx_mstate_global->__pyx_kp_u_Unknown_xpath_result
#define __pyx_kp_b_Unregistered_function __pyx_mstate_global->__pyx_kp_b_Unregistered_function
#define __pyx_kp_u_Unsupported_element_type __pyx_mstate_global->__pyx_kp_u_Unsupported_element_type
#define __pyx_kp_u_Unsupported_node_type __pyx_mstate_global->__pyx_kp_u_Unsupported_node_type
#define __pyx_n_s_Validator __pyx_mstate_global->__pyx_n_s_Validator
#define __pyx_n_s_Validator__append_log_message __pyx_mstate_global->__pyx_n_s_Validator__append_log_message
#define __pyx_n_s_Validator__clear_error_log __pyx_mstate_global->__pyx_n_s_Validator__clear_error_log
#define __pyx_n_s_Validator_assert __pyx_mstate_global->__pyx_n_s_Validator_assert
#define __pyx_n_s_Validator_assertValid __pyx_mstate_global->__pyx_n_s_Validator_assertValid
#define __pyx_n_s_Validator_validate __pyx_mstate_global->__pyx_n_s_Validator_validate
#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
#define __pyx_n_s_WARNING __pyx_mstate_global->__pyx_n_s_WARNING
#define __pyx_n_s_WAR_UNDECLARED_ENTITY __pyx_mstate_global->__pyx_n_s_WAR_UNDECLARED_ENTITY
#define __pyx_n_u_X __pyx_mstate_global->__pyx_n_u_X
#define __pyx_n_s_XInclude __pyx_mstate_global->__pyx_n_s_XInclude
#define __pyx_n_u_XInclude __pyx_mstate_global->__pyx_n_u_XInclude
#define __pyx_n_s_XIncludeError __pyx_mstate_global->__pyx_n_s_XIncludeError
#define __pyx_n_u_XIncludeError __pyx_mstate_global->__pyx_n_u_XIncludeError
#define __pyx_kp_u_XInclude_instance_not_initialise __pyx_mstate_global->__pyx_kp_u_XInclude_instance_not_initialise
#define __pyx_kp_u_XInclude_processing_failed __pyx_mstate_global->__pyx_kp_u_XInclude_processing_failed
#define __pyx_kp_u_XInclude_processor_not_initialis __pyx_mstate_global->__pyx_kp_u_XInclude_processor_not_initialis
#define __pyx_n_s_XML __pyx_mstate_global->__pyx_n_s_XML
#define __pyx_n_u_XML __pyx_mstate_global->__pyx_n_u_XML
#define __pyx_n_s_XMLDTDID __pyx_mstate_global->__pyx_n_s_XMLDTDID
#define __pyx_n_u_XMLDTDID __pyx_mstate_global->__pyx_n_u_XMLDTDID
#define __pyx_n_s_XMLID __pyx_mstate_global->__pyx_n_s_XMLID
#define __pyx_n_u_XMLID __pyx_mstate_global->__pyx_n_u_XMLID
#define __pyx_n_s_XMLParser __pyx_mstate_global->__pyx_n_s_XMLParser
#define __pyx_n_u_XMLParser __pyx_mstate_global->__pyx_n_u_XMLParser
#define __pyx_n_s_XMLPullParser __pyx_mstate_global->__pyx_n_s_XMLPullParser
#define __pyx_n_s_XMLPullParser_read_events __pyx_mstate_global->__pyx_n_s_XMLPullParser_read_events
#define __pyx_n_s_XMLSchema __pyx_mstate_global->__pyx_n_s_XMLSchema
#define __pyx_n_u_XMLSchema __pyx_mstate_global->__pyx_n_u_XMLSchema
#define __pyx_n_s_XMLSchemaError __pyx_mstate_global->__pyx_n_s_XMLSchemaError
#define __pyx_n_u_XMLSchemaError __pyx_mstate_global->__pyx_n_u_XMLSchemaError
#define __pyx_n_s_XMLSchemaParseError __pyx_mstate_global->__pyx_n_s_XMLSchemaParseError
#define __pyx_n_u_XMLSchemaParseError __pyx_mstate_global->__pyx_n_u_XMLSchemaParseError
#define __pyx_n_s_XMLSchemaValidateError __pyx_mstate_global->__pyx_n_s_XMLSchemaValidateError
#define __pyx_n_u_XMLSchemaValidateError __pyx_mstate_global->__pyx_n_u_XMLSchemaValidateError
#define __pyx_n_s_XMLSyntaxAssertionError __pyx_mstate_global->__pyx_n_s_XMLSyntaxAssertionError
#define __pyx_n_s_XMLSyntaxAssertionError___init __pyx_mstate_global->__pyx_n_s_XMLSyntaxAssertionError___init
#define __pyx_n_s_XMLSyntaxError __pyx_mstate_global->__pyx_n_s_XMLSyntaxError
#define __pyx_n_u_XMLSyntaxError __pyx_mstate_global->__pyx_n_u_XMLSyntaxError
#define __pyx_n_s_XMLTreeBuilder __pyx_mstate_global->__pyx_n_s_XMLTreeBuilder
#define __pyx_n_u_XMLTreeBuilder __pyx_mstate_global->__pyx_n_u_XMLTreeBuilder
#define __pyx_kp_u_XML_declaration_already_written __pyx_mstate_global->__pyx_kp_u_XML_declaration_already_written
#define __pyx_kp_u_XML_line_3261 __pyx_mstate_global->__pyx_kp_u_XML_line_3261
#define __pyx_kp_u_XML_text_parser_None_base_url_No __pyx_mstate_global->__pyx_kp_u_XML_text_parser_None_base_url_No
#define __pyx_n_u_XPATH_LOCATIONSET __pyx_mstate_global->__pyx_n_u_XPATH_LOCATIONSET
#define __pyx_n_u_XPATH_POINT __pyx_mstate_global->__pyx_n_u_XPATH_POINT
#define __pyx_n_u_XPATH_RANGE __pyx_mstate_global->__pyx_n_u_XPATH_RANGE
#define __pyx_n_u_XPATH_USERS __pyx_mstate_global->__pyx_n_u_XPATH_USERS
#define __pyx_n_s_XPath __pyx_mstate_global->__pyx_n_s_XPath
#define __pyx_n_u_XPath __pyx_mstate_global->__pyx_n_u_XPath
#define __pyx_n_s_XPathDocumentEvaluator __pyx_mstate_global->__pyx_n_s_XPathDocumentEvaluator
#define __pyx_n_u_XPathDocumentEvaluator __pyx_mstate_global->__pyx_n_u_XPathDocumentEvaluator
#define __pyx_n_s_XPathElementEvaluator __pyx_mstate_global->__pyx_n_s_XPathElementEvaluator
#define __pyx_n_s_XPathElementEvaluator_register_n __pyx_mstate_global->__pyx_n_s_XPathElementEvaluator_register_n
#define __pyx_n_s_XPathElementEvaluator_register_n_2 __pyx_mstate_global->__pyx_n_s_XPathElementEvaluator_register_n_2
#define __pyx_n_s_XPathError __pyx_mstate_global->__pyx_n_s_XPathError
#define __pyx_n_u_XPathError __pyx_mstate_global->__pyx_n_u_XPathError
#define __pyx_n_s_XPathEvalError __pyx_mstate_global->__pyx_n_s_XPathEvalError
#define __pyx_n_u_XPathEvalError __pyx_mstate_global->__pyx_n_u_XPathEvalError
#define __pyx_n_s_XPathEvaluator __pyx_mstate_global->__pyx_n_s_XPathEvaluator
#define __pyx_n_u_XPathEvaluator __pyx_mstate_global->__pyx_n_u_XPathEvaluator
#define __pyx_n_s_XPathEvaluatorBase __pyx_mstate_global->__pyx_n_s_XPathEvaluatorBase
#define __pyx_n_s_XPathFunctionError __pyx_mstate_global->__pyx_n_s_XPathFunctionError
#define __pyx_n_u_XPathFunctionError __pyx_mstate_global->__pyx_n_u_XPathFunctionError
#define __pyx_n_s_XPathResultError __pyx_mstate_global->__pyx_n_s_XPathResultError
#define __pyx_n_u_XPathResultError __pyx_mstate_global->__pyx_n_u_XPathResultError
#define __pyx_n_s_XPathSyntaxError __pyx_mstate_global->__pyx_n_s_XPathSyntaxError
#define __pyx_n_u_XPathSyntaxError __pyx_mstate_global->__pyx_n_u_XPathSyntaxError
#define __pyx_kp_u_XPath_context_is_only_usable_dur __pyx_mstate_global->__pyx_kp_u_XPath_context_is_only_usable_dur
#define __pyx_kp_u_XPath_context_not_initialised __pyx_mstate_global->__pyx_kp_u_XPath_context_not_initialised
#define __pyx_kp_u_XPath_evaluator_locking_failed __pyx_mstate_global->__pyx_kp_u_XPath_evaluator_locking_failed
#define __pyx_kp_u_XPath_evaluator_not_initialised __pyx_mstate_global->__pyx_kp_u_XPath_evaluator_not_initialised
#define __pyx_kp_u_XPath_function __pyx_mstate_global->__pyx_kp_u_XPath_function
#define __pyx_n_s_XSLT __pyx_mstate_global->__pyx_n_s_XSLT
#define __pyx_n_u_XSLT __pyx_mstate_global->__pyx_n_u_XSLT
#define __pyx_n_s_XSLTAccessControl __pyx_mstate_global->__pyx_n_s_XSLTAccessControl
#define __pyx_n_u_XSLTAccessControl __pyx_mstate_global->__pyx_n_u_XSLTAccessControl
#define __pyx_n_s_XSLTApplyError __pyx_mstate_global->__pyx_n_s_XSLTApplyError
#define __pyx_n_u_XSLTApplyError __pyx_mstate_global->__pyx_n_u_XSLTApplyError
#define __pyx_n_s_XSLTError __pyx_mstate_global->__pyx_n_s_XSLTError
#define __pyx_n_u_XSLTError __pyx_mstate_global->__pyx_n_u_XSLTError
#define __pyx_n_u_XSLTErrorLog __pyx_mstate_global->__pyx_n_u_XSLTErrorLog
#define __pyx_n_s_XSLTExtension __pyx_mstate_global->__pyx_n_s_XSLTExtension
#define __pyx_n_u_XSLTExtension __pyx_mstate_global->__pyx_n_u_XSLTExtension
#define __pyx_n_s_XSLTExtensionError __pyx_mstate_global->__pyx_n_s_XSLTExtensionError
#define __pyx_n_u_XSLTExtensionError __pyx_mstate_global->__pyx_n_u_XSLTExtensionError
#define __pyx_n_s_XSLTExtension_apply_templates __pyx_mstate_global->__pyx_n_s_XSLTExtension_apply_templates
#define __pyx_n_s_XSLTExtension_execute __pyx_mstate_global->__pyx_n_s_XSLTExtension_execute
#define __pyx_n_s_XSLTExtension_process_children __pyx_mstate_global->__pyx_n_s_XSLTExtension_process_children
#define __pyx_n_s_XSLTParseError __pyx_mstate_global->__pyx_n_s_XSLTParseError
#define __pyx_n_u_XSLTParseError __pyx_mstate_global->__pyx_n_u_XSLTParseError
#define __pyx_n_s_XSLTProcessingInstruction __pyx_mstate_global->__pyx_n_s_XSLTProcessingInstruction
#define __pyx_n_s_XSLTProcessingInstruction_parse __pyx_mstate_global->__pyx_n_s_XSLTProcessingInstruction_parse
#define __pyx_n_s_XSLTProcessingInstruction_set __pyx_mstate_global->__pyx_n_s_XSLTProcessingInstruction_set
#define __pyx_n_s_XSLTResultTree __pyx_mstate_global->__pyx_n_s_XSLTResultTree
#define __pyx_n_s_XSLTResultTree_write_output __pyx_mstate_global->__pyx_n_s_XSLTResultTree_write_output
#define __pyx_n_s_XSLTSaveError __pyx_mstate_global->__pyx_n_s_XSLTSaveError
#define __pyx_n_u_XSLTSaveError __pyx_mstate_global->__pyx_n_u_XSLTSaveError
#define __pyx_n_s_XSLT___copy __pyx_mstate_global->__pyx_n_s_XSLT___copy
#define __pyx_n_s_XSLT___deepcopy __pyx_mstate_global->__pyx_n_s_XSLT___deepcopy
#define __pyx_kp_u_XSLT_context_not_initialised __pyx_mstate_global->__pyx_kp_u_XSLT_context_not_initialised
#define __pyx_n_s_XSLT_set_global_max_depth __pyx_mstate_global->__pyx_n_s_XSLT_set_global_max_depth
#define __pyx_n_s_XSLT_strparam __pyx_mstate_global->__pyx_n_s_XSLT_strparam
#define __pyx_kp_u_XSLT_stylesheet_not_initialised __pyx_mstate_global->__pyx_kp_u_XSLT_stylesheet_not_initialised
#define __pyx_n_s_XSLT_tostring __pyx_mstate_global->__pyx_n_s_XSLT_tostring
#define __pyx_n_s__106 __pyx_mstate_global->__pyx_n_s__106
#define __pyx_kp_u__11 __pyx_mstate_global->__pyx_kp_u__11
#define __pyx_kp_b__12 __pyx_mstate_global->__pyx_kp_b__12
#define __pyx_kp_u__12 __pyx_mstate_global->__pyx_kp_u__12
#define __pyx_kp_b__17 __pyx_mstate_global->__pyx_kp_b__17
#define __pyx_kp_u__17 __pyx_mstate_global->__pyx_kp_u__17
#define __pyx_kp_u__18 __pyx_mstate_global->__pyx_kp_u__18
#define __pyx_kp_u__19 __pyx_mstate_global->__pyx_kp_u__19
#define __pyx_kp_u__20 __pyx_mstate_global->__pyx_kp_u__20
#define __pyx_kp_b__21 __pyx_mstate_global->__pyx_kp_b__21
#define __pyx_kp_u__21 __pyx_mstate_global->__pyx_kp_u__21
#define __pyx_n_s__22 __pyx_mstate_global->__pyx_n_s__22
#define __pyx_kp_b__22 __pyx_mstate_global->__pyx_kp_b__22
#define __pyx_kp_u__22 __pyx_mstate_global->__pyx_kp_u__22
#define __pyx_kp_u__24 __pyx_mstate_global->__pyx_kp_u__24
#define __pyx_kp_b__25 __pyx_mstate_global->__pyx_kp_b__25
#define __pyx_kp_u__25 __pyx_mstate_global->__pyx_kp_u__25
#define __pyx_kp_b__26 __pyx_mstate_global->__pyx_kp_b__26
#define __pyx_kp_u__26 __pyx_mstate_global->__pyx_kp_u__26
#define __pyx_kp_u__28 __pyx_mstate_global->__pyx_kp_u__28
#define __pyx_kp_u__29 __pyx_mstate_global->__pyx_kp_u__29
#define __pyx_kp_b__3 __pyx_mstate_global->__pyx_kp_b__3
#define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3
#define __pyx_kp_u__30 __pyx_mstate_global->__pyx_kp_u__30
#define __pyx_kp_u__32 __pyx_mstate_global->__pyx_kp_u__32
#define __pyx_kp_b__33 __pyx_mstate_global->__pyx_kp_b__33
#define __pyx_kp_u__33 __pyx_mstate_global->__pyx_kp_u__33
#define __pyx_kp_b__34 __pyx_mstate_global->__pyx_kp_b__34
#define __pyx_kp_u__34 __pyx_mstate_global->__pyx_kp_u__34
#define __pyx_kp_b__35 __pyx_mstate_global->__pyx_kp_b__35
#define __pyx_kp_u__35 __pyx_mstate_global->__pyx_kp_u__35
#define __pyx_kp_b__4 __pyx_mstate_global->__pyx_kp_b__4
#define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4
#define __pyx_kp_u__41 __pyx_mstate_global->__pyx_kp_u__41
#define __pyx_kp_u__42 __pyx_mstate_global->__pyx_kp_u__42
#define __pyx_kp_u__43 __pyx_mstate_global->__pyx_kp_u__43
#define __pyx_kp_u__45 __pyx_mstate_global->__pyx_kp_u__45
#define __pyx_kp_b__48 __pyx_mstate_global->__pyx_kp_b__48
#define __pyx_kp_b__489 __pyx_mstate_global->__pyx_kp_b__489
#define __pyx_kp_b__491 __pyx_mstate_global->__pyx_kp_b__491
#define __pyx_kp_b__50 __pyx_mstate_global->__pyx_kp_b__50
#define __pyx_kp_u__52 __pyx_mstate_global->__pyx_kp_u__52
#define __pyx_n_s__56 __pyx_mstate_global->__pyx_n_s__56
#define __pyx_n_u__56 __pyx_mstate_global->__pyx_n_u__56
#define __pyx_kp_u__57 __pyx_mstate_global->__pyx_kp_u__57
#define __pyx_kp_u__61 __pyx_mstate_global->__pyx_kp_u__61
#define __pyx_kp_b__63 __pyx_mstate_global->__pyx_kp_b__63
#define __pyx_kp_u__71 __pyx_mstate_global->__pyx_kp_u__71
#define __pyx_kp_u__72 __pyx_mstate_global->__pyx_kp_u__72
#define __pyx_kp_u__73 __pyx_mstate_global->__pyx_kp_u__73
#define __pyx_kp_u__74 __pyx_mstate_global->__pyx_kp_u__74
#define __pyx_kp_u__75 __pyx_mstate_global->__pyx_kp_u__75
#define __pyx_kp_u__95 __pyx_mstate_global->__pyx_kp_u__95
#define __pyx_kp_u__96 __pyx_mstate_global->__pyx_kp_u__96
#define __pyx_n_s_abspath __pyx_mstate_global->__pyx_n_s_abspath
#define __pyx_n_s_accepted_domains __pyx_mstate_global->__pyx_n_s_accepted_domains
#define __pyx_n_s_access_control __pyx_mstate_global->__pyx_n_s_access_control
#define __pyx_n_s_add __pyx_mstate_global->__pyx_n_s_add
#define __pyx_n_s_addnext __pyx_mstate_global->__pyx_n_s_addnext
#define __pyx_n_s_addprevious __pyx_mstate_global->__pyx_n_s_addprevious
#define __pyx_n_s_adopt_external_document __pyx_mstate_global->__pyx_n_s_adopt_external_document
#define __pyx_n_s_aenter __pyx_mstate_global->__pyx_n_s_aenter
#define __pyx_n_s_aexit __pyx_mstate_global->__pyx_n_s_aexit
#define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
#define __pyx_n_u_alpha __pyx_mstate_global->__pyx_n_u_alpha
#define __pyx_kp_u_ambiguous_reference_to_embedded __pyx_mstate_global->__pyx_kp_u_ambiguous_reference_to_embedded
#define __pyx_kp_u_amp __pyx_mstate_global->__pyx_kp_u_amp
#define __pyx_n_u_any __pyx_mstate_global->__pyx_n_u_any
#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append
#define __pyx_n_s_append_log_message __pyx_mstate_global->__pyx_n_s_append_log_message
#define __pyx_n_s_apply_templates __pyx_mstate_global->__pyx_n_s_apply_templates
#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
#define __pyx_kp_u_argument_must_be_a_byte_string_o __pyx_mstate_global->__pyx_kp_u_argument_must_be_a_byte_string_o
#define __pyx_n_u_ascii __pyx_mstate_global->__pyx_n_u_ascii
#define __pyx_n_s_assert __pyx_mstate_global->__pyx_n_s_assert
#define __pyx_n_s_assertValid __pyx_mstate_global->__pyx_n_s_assertValid
#define __pyx_n_s_async_outfile __pyx_mstate_global->__pyx_n_s_async_outfile
#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
#define __pyx_kp_u_at_0x __pyx_mstate_global->__pyx_kp_u_at_0x
#define __pyx_kp_u_attempt_to_assign_sequence_of_si __pyx_mstate_global->__pyx_kp_u_attempt_to_assign_sequence_of_si
#define __pyx_n_s_attrib __pyx_mstate_global->__pyx_n_s_attrib
#define __pyx_n_s_attribute_defaults __pyx_mstate_global->__pyx_n_s_attribute_defaults
#define __pyx_n_s_attribute_name __pyx_mstate_global->__pyx_n_s_attribute_name
#define __pyx_n_s_attribute_names __pyx_mstate_global->__pyx_n_s_attribute_names
#define __pyx_n_s_attributes __pyx_mstate_global->__pyx_n_s_attributes
#define __pyx_n_s_attrs __pyx_mstate_global->__pyx_n_s_attrs
#define __pyx_n_s_await __pyx_mstate_global->__pyx_n_s_await
#define __pyx_n_s_base_url __pyx_mstate_global->__pyx_n_s_base_url
#define __pyx_n_u_beta __pyx_mstate_global->__pyx_n_u_beta
#define __pyx_n_s_block_count __pyx_mstate_global->__pyx_n_s_block_count
#define __pyx_n_s_blocks_used __pyx_mstate_global->__pyx_n_s_blocks_used
#define __pyx_kp_u_boolean_xs_attribute_default_or __pyx_mstate_global->__pyx_kp_u_boolean_xs_attribute_default_or
#define __pyx_n_s_bstring __pyx_mstate_global->__pyx_n_s_bstring
#define __pyx_n_s_buffered __pyx_mstate_global->__pyx_n_s_buffered
#define __pyx_n_s_build_smart_strings __pyx_mstate_global->__pyx_n_s_build_smart_strings
#define __pyx_n_s_byte_count __pyx_mstate_global->__pyx_n_s_byte_count
#define __pyx_n_s_bytes_used __pyx_mstate_global->__pyx_n_s_bytes_used
#define __pyx_n_u_c14n __pyx_mstate_global->__pyx_n_u_c14n
#define __pyx_n_u_c14n2 __pyx_mstate_global->__pyx_n_u_c14n2
#define __pyx_n_s_c_attr __pyx_mstate_global->__pyx_n_s_c_attr
#define __pyx_n_s_c_attr_next __pyx_mstate_global->__pyx_n_s_c_attr_next
#define __pyx_n_s_c_attrs __pyx_mstate_global->__pyx_n_s_c_attrs
#define __pyx_n_s_c_buffer __pyx_mstate_global->__pyx_n_s_c_buffer
#define __pyx_n_s_c_child __pyx_mstate_global->__pyx_n_s_c_child
#define __pyx_n_s_c_compression __pyx_mstate_global->__pyx_n_s_c_compression
#define __pyx_n_s_c_context_node __pyx_mstate_global->__pyx_n_s_c_context_node
#define __pyx_n_s_c_count __pyx_mstate_global->__pyx_n_s_c_count
#define __pyx_n_s_c_ctxt __pyx_mstate_global->__pyx_n_s_c_ctxt
#define __pyx_n_s_c_dict __pyx_mstate_global->__pyx_n_s_c_dict
#define __pyx_n_s_c_doc __pyx_mstate_global->__pyx_n_s_c_doc
#define __pyx_n_s_c_dtd __pyx_mstate_global->__pyx_n_s_c_dtd
#define __pyx_n_s_c_element __pyx_mstate_global->__pyx_n_s_c_element
#define __pyx_n_s_c_encoding __pyx_mstate_global->__pyx_n_s_c_encoding
#define __pyx_n_s_c_href __pyx_mstate_global->__pyx_n_s_c_href
#define __pyx_n_s_c_method __pyx_mstate_global->__pyx_n_s_c_method
#define __pyx_n_s_c_name __pyx_mstate_global->__pyx_n_s_c_name
#define __pyx_n_s_c_new_next __pyx_mstate_global->__pyx_n_s_c_new_next
#define __pyx_n_s_c_new_node __pyx_mstate_global->__pyx_n_s_c_new_node
#define __pyx_n_s_c_next __pyx_mstate_global->__pyx_n_s_c_next
#define __pyx_n_s_c_node __pyx_mstate_global->__pyx_n_s_c_node
#define __pyx_n_s_c_node_copy __pyx_mstate_global->__pyx_n_s_c_node_copy
#define __pyx_n_s_c_node_next __pyx_mstate_global->__pyx_n_s_c_node_next
#define __pyx_n_s_c_old_next __pyx_mstate_global->__pyx_n_s_c_old_next
#define __pyx_n_s_c_old_node __pyx_mstate_global->__pyx_n_s_c_old_node
#define __pyx_n_s_c_old_output_parent __pyx_mstate_global->__pyx_n_s_c_old_output_parent
#define __pyx_n_s_c_parent __pyx_mstate_global->__pyx_n_s_c_parent
#define __pyx_n_s_c_path __pyx_mstate_global->__pyx_n_s_c_path
#define __pyx_n_s_c_source_doc __pyx_mstate_global->__pyx_n_s_c_source_doc
#define __pyx_n_s_c_standalone __pyx_mstate_global->__pyx_n_s_c_standalone
#define __pyx_n_s_c_start __pyx_mstate_global->__pyx_n_s_c_start
#define __pyx_n_s_c_start_node __pyx_mstate_global->__pyx_n_s_c_start_node
#define __pyx_n_s_c_stop __pyx_mstate_global->__pyx_n_s_c_stop
#define __pyx_n_s_c_version __pyx_mstate_global->__pyx_n_s_c_version
#define __pyx_kp_u_can_only_parse_strings __pyx_mstate_global->__pyx_kp_u_can_only_parse_strings
#define __pyx_kp_u_cannot_add_ancestor_as_sibling_p __pyx_mstate_global->__pyx_kp_u_cannot_add_ancestor_as_sibling_p
#define __pyx_kp_u_cannot_append_document_already_h __pyx_mstate_global->__pyx_kp_u_cannot_append_document_already_h
#define __pyx_kp_u_cannot_append_parent_to_itself __pyx_mstate_global->__pyx_kp_u_cannot_append_parent_to_itself
#define __pyx_kp_u_cannot_append_trailing_element_t __pyx_mstate_global->__pyx_kp_u_cannot_append_trailing_element_t
#define __pyx_kp_u_cannot_assign_None __pyx_mstate_global->__pyx_kp_u_cannot_assign_None
#define __pyx_kp_u_cannot_be_serialized __pyx_mstate_global->__pyx_kp_u_cannot_be_serialized
#define __pyx_kp_u_cannot_parse_from __pyx_mstate_global->__pyx_kp_u_cannot_parse_from
#define __pyx_kp_u_cannot_serialize __pyx_mstate_global->__pyx_kp_u_cannot_serialize
#define __pyx_kp_u_cannot_set_a_maximum_stylesheet __pyx_mstate_global->__pyx_kp_u_cannot_set_a_maximum_stylesheet
#define __pyx_n_s_canonicalize __pyx_mstate_global->__pyx_n_s_canonicalize
#define __pyx_n_u_canonicalize __pyx_mstate_global->__pyx_n_u_canonicalize
#define __pyx_n_s_capsule __pyx_mstate_global->__pyx_n_s_capsule
#define __pyx_n_u_cdata __pyx_mstate_global->__pyx_n_u_cdata
#define __pyx_n_s_child __pyx_mstate_global->__pyx_n_s_child
#define __pyx_n_s_children __pyx_mstate_global->__pyx_n_s_children
#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class
#define __pyx_n_u_class __pyx_mstate_global->__pyx_n_u_class
#define __pyx_n_s_class_dict_iterable __pyx_mstate_global->__pyx_n_s_class_dict_iterable
#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
#define __pyx_n_s_class_mapping __pyx_mstate_global->__pyx_n_s_class_mapping
#define __pyx_n_s_cleanup_namespaces __pyx_mstate_global->__pyx_n_s_cleanup_namespaces
#define __pyx_n_u_cleanup_namespaces __pyx_mstate_global->__pyx_n_u_cleanup_namespaces
#define __pyx_n_s_clear __pyx_mstate_global->__pyx_n_s_clear
#define __pyx_n_s_clear_error_log __pyx_mstate_global->__pyx_n_s_clear_error_log
#define __pyx_n_s_clear_error_log_2 __pyx_mstate_global->__pyx_n_s_clear_error_log_2
#define __pyx_n_u_clear_error_log_2 __pyx_mstate_global->__pyx_n_u_clear_error_log_2
#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
#define __pyx_n_s_close_2 __pyx_mstate_global->__pyx_n_s_close_2
#define __pyx_n_s_close_file __pyx_mstate_global->__pyx_n_s_close_file
#define __pyx_n_s_cls __pyx_mstate_global->__pyx_n_s_cls
#define __pyx_n_s_code __pyx_mstate_global->__pyx_n_s_code
#define __pyx_n_s_codecs __pyx_mstate_global->__pyx_n_s_codecs
#define __pyx_n_s_collect_ids __pyx_mstate_global->__pyx_n_s_collect_ids
#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections
#define __pyx_n_s_collections_abc __pyx_mstate_global->__pyx_n_s_collections_abc
#define __pyx_kp_u_column __pyx_mstate_global->__pyx_kp_u_column
#define __pyx_n_s_column_2 __pyx_mstate_global->__pyx_n_s_column_2
#define __pyx_n_s_comment __pyx_mstate_global->__pyx_n_s_comment
#define __pyx_n_u_comment __pyx_mstate_global->__pyx_n_u_comment
#define __pyx_kp_u_comment_class_must_be_subclass_o __pyx_mstate_global->__pyx_kp_u_comment_class_must_be_subclass_o
#define __pyx_n_s_comment_factory __pyx_mstate_global->__pyx_n_s_comment_factory
#define __pyx_n_s_compact __pyx_mstate_global->__pyx_n_s_compact
#define __pyx_kp_u_compact_syntax_not_supported_ple __pyx_mstate_global->__pyx_kp_u_compact_syntax_not_supported_ple
#define __pyx_n_s_compile __pyx_mstate_global->__pyx_n_s_compile
#define __pyx_n_s_compression __pyx_mstate_global->__pyx_n_s_compression
#define __pyx_n_s_compresslevel __pyx_mstate_global->__pyx_n_s_compresslevel
#define __pyx_n_s_contains __pyx_mstate_global->__pyx_n_s_contains
#define __pyx_n_s_content __pyx_mstate_global->__pyx_n_s_content
#define __pyx_n_s_context __pyx_mstate_global->__pyx_n_s_context
#define __pyx_n_s_contextlib __pyx_mstate_global->__pyx_n_s_contextlib
#define __pyx_n_s_contextmanager __pyx_mstate_global->__pyx_n_s_contextmanager
#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy
#define __pyx_n_s_copy_2 __pyx_mstate_global->__pyx_n_s_copy_2
#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count
#define __pyx_n_s_create_dir __pyx_mstate_global->__pyx_n_s_create_dir
#define __pyx_n_u_create_dir __pyx_mstate_global->__pyx_n_u_create_dir
#define __pyx_n_s_cssselect __pyx_mstate_global->__pyx_n_s_cssselect
#define __pyx_n_s_ctxt __pyx_mstate_global->__pyx_n_s_ctxt
#define __pyx_n_u_d __pyx_mstate_global->__pyx_n_u_d
#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data
#define __pyx_n_b_dc __pyx_mstate_global->__pyx_n_b_dc
#define __pyx_n_s_deco __pyx_mstate_global->__pyx_n_s_deco
#define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode
#define __pyx_n_s_deepcopy __pyx_mstate_global->__pyx_n_s_deepcopy
#define __pyx_n_s_default __pyx_mstate_global->__pyx_n_s_default
#define __pyx_kp_u_default_2 __pyx_mstate_global->__pyx_kp_u_default_2
#define __pyx_n_s_default_doctype __pyx_mstate_global->__pyx_n_s_default_doctype
#define __pyx_n_s_default_resolver __pyx_mstate_global->__pyx_n_s_default_resolver
#define __pyx_kp_u_default_value __pyx_mstate_global->__pyx_kp_u_default_value
#define __pyx_n_s_default_value_2 __pyx_mstate_global->__pyx_n_s_default_value_2
#define __pyx_n_s_delitem __pyx_mstate_global->__pyx_n_s_delitem
#define __pyx_n_u_dev __pyx_mstate_global->__pyx_n_u_dev
#define __pyx_n_s_dic __pyx_mstate_global->__pyx_n_s_dic
#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict
#define __pyx_n_u_dict __pyx_mstate_global->__pyx_n_u_dict
#define __pyx_n_s_dict_size __pyx_mstate_global->__pyx_n_s_dict_size
#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
#define __pyx_n_s_discard __pyx_mstate_global->__pyx_n_s_discard
#define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc
#define __pyx_n_s_doc_2 __pyx_mstate_global->__pyx_n_s_doc_2
#define __pyx_n_s_doc_3 __pyx_mstate_global->__pyx_n_s_doc_3
#define __pyx_n_s_doc_ref __pyx_mstate_global->__pyx_n_s_doc_ref
#define __pyx_n_s_docformat __pyx_mstate_global->__pyx_n_s_docformat
#define __pyx_n_s_docstring __pyx_mstate_global->__pyx_n_s_docstring
#define __pyx_n_s_doctype __pyx_mstate_global->__pyx_n_s_doctype
#define __pyx_kp_u_document_context_is_missing __pyx_mstate_global->__pyx_kp_u_document_context_is_missing
#define __pyx_kp_u_document_external_context_nodes __pyx_mstate_global->__pyx_kp_u_document_external_context_nodes
#define __pyx_n_s_domain __pyx_mstate_global->__pyx_n_s_domain
#define __pyx_n_s_domain_name __pyx_mstate_global->__pyx_n_s_domain_name
#define __pyx_n_s_domains __pyx_mstate_global->__pyx_n_s_domains
#define __pyx_kp_u_double_registering_proxy __pyx_mstate_global->__pyx_kp_u_double_registering_proxy
#define __pyx_n_s_dtd_validation __pyx_mstate_global->__pyx_n_s_dtd_validation
#define __pyx_n_s_dump __pyx_mstate_global->__pyx_n_s_dump
#define __pyx_n_u_dump __pyx_mstate_global->__pyx_n_u_dump
#define __pyx_n_s_dumps __pyx_mstate_global->__pyx_n_s_dumps
#define __pyx_kp_u_either_filename_or_external_ID_r __pyx_mstate_global->__pyx_kp_u_either_filename_or_external_ID_r
#define __pyx_n_s_el __pyx_mstate_global->__pyx_n_s_el
#define __pyx_n_s_elem __pyx_mstate_global->__pyx_n_s_elem
#define __pyx_n_s_element __pyx_mstate_global->__pyx_n_s_element
#define __pyx_n_u_element __pyx_mstate_global->__pyx_n_u_element
#define __pyx_kp_u_element_class_must_be_subclass_o __pyx_mstate_global->__pyx_kp_u_element_class_must_be_subclass_o
#define __pyx_n_s_element_config __pyx_mstate_global->__pyx_n_s_element_config
#define __pyx_n_s_element_factory __pyx_mstate_global->__pyx_n_s_element_factory
#define __pyx_n_s_element_or_tree __pyx_mstate_global->__pyx_n_s_element_or_tree
#define __pyx_n_s_element_writer __pyx_mstate_global->__pyx_n_s_element_writer
#define __pyx_n_s_elementpath __pyx_mstate_global->__pyx_n_s_elementpath
#define __pyx_n_s_elements __pyx_mstate_global->__pyx_n_s_elements
#define __pyx_n_s_elements_only __pyx_mstate_global->__pyx_n_s_elements_only
#define __pyx_kp_u_elemname __pyx_mstate_global->__pyx_kp_u_elemname
#define __pyx_n_s_elemname_2 __pyx_mstate_global->__pyx_n_s_elemname_2
#define __pyx_n_u_empty __pyx_mstate_global->__pyx_n_u_empty
#define __pyx_kp_u_empty_namespace_prefix_is_not_su __pyx_mstate_global->__pyx_kp_u_empty_namespace_prefix_is_not_su
#define __pyx_kp_u_empty_prefix_is_not_supported_in __pyx_mstate_global->__pyx_kp_u_empty_prefix_is_not_supported_in
#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
#define __pyx_n_s_enable_regexp __pyx_mstate_global->__pyx_n_s_enable_regexp
#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
#define __pyx_n_s_encoding __pyx_mstate_global->__pyx_n_s_encoding
#define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
#define __pyx_n_u_end __pyx_mstate_global->__pyx_n_u_end
#define __pyx_kp_u_end_ns __pyx_mstate_global->__pyx_kp_u_end_ns
#define __pyx_n_s_end_ns_2 __pyx_mstate_global->__pyx_n_s_end_ns_2
#define __pyx_kp_u_end_tag_mismatch_expected __pyx_mstate_global->__pyx_kp_u_end_tag_mismatch_expected
#define __pyx_n_s_endswith __pyx_mstate_global->__pyx_n_s_endswith
#define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter
#define __pyx_n_s_entities __pyx_mstate_global->__pyx_n_s_entities
#define __pyx_n_u_entities __pyx_mstate_global->__pyx_n_u_entities
#define __pyx_n_s_entity __pyx_mstate_global->__pyx_n_s_entity
#define __pyx_n_u_entity __pyx_mstate_global->__pyx_n_u_entity
#define __pyx_n_s_entries __pyx_mstate_global->__pyx_n_s_entries
#define __pyx_n_s_entry __pyx_mstate_global->__pyx_n_s_entry
#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate
#define __pyx_n_u_enumeration __pyx_mstate_global->__pyx_n_u_enumeration
#define __pyx_n_s_error_log __pyx_mstate_global->__pyx_n_s_error_log
#define __pyx_kp_u_error_parsing_DTD __pyx_mstate_global->__pyx_kp_u_error_parsing_DTD
#define __pyx_n_s_etree __pyx_mstate_global->__pyx_n_s_etree
#define __pyx_n_s_etree_or_element __pyx_mstate_global->__pyx_n_s_etree_or_element
#define __pyx_n_s_etree_or_element_2 __pyx_mstate_global->__pyx_n_s_etree_or_element_2
#define __pyx_n_s_evaluator __pyx_mstate_global->__pyx_n_s_evaluator
#define __pyx_n_s_events __pyx_mstate_global->__pyx_n_s_events
#define __pyx_n_s_exc_context __pyx_mstate_global->__pyx_n_s_exc_context
#define __pyx_n_s_exc_info __pyx_mstate_global->__pyx_n_s_exc_info
#define __pyx_n_s_exc_tb __pyx_mstate_global->__pyx_n_s_exc_tb
#define __pyx_n_s_exc_type __pyx_mstate_global->__pyx_n_s_exc_type
#define __pyx_n_s_exc_val __pyx_mstate_global->__pyx_n_s_exc_val
#define __pyx_n_s_exclude_attrs __pyx_mstate_global->__pyx_n_s_exclude_attrs
#define __pyx_n_s_exclude_tags __pyx_mstate_global->__pyx_n_s_exclude_tags
#define __pyx_n_s_exclusive __pyx_mstate_global->__pyx_n_s_exclusive
#define __pyx_n_s_execute __pyx_mstate_global->__pyx_n_s_execute
#define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit
#define __pyx_kp_u_expected __pyx_mstate_global->__pyx_kp_u_expected
#define __pyx_kp_u_expected_string_or_Element __pyx_mstate_global->__pyx_kp_u_expected_string_or_Element
#define __pyx_n_s_expr __pyx_mstate_global->__pyx_n_s_expr
#define __pyx_n_s_extend __pyx_mstate_global->__pyx_n_s_extend
#define __pyx_kp_u_extension_element __pyx_mstate_global->__pyx_kp_u_extension_element
#define __pyx_n_s_extensions __pyx_mstate_global->__pyx_n_s_extensions
#define __pyx_kp_u_extensions_must_have_non_empty_n __pyx_mstate_global->__pyx_kp_u_extensions_must_have_non_empty_n
#define __pyx_kp_u_extensions_must_not_have_empty_n __pyx_mstate_global->__pyx_kp_u_extensions_must_not_have_empty_n
#define __pyx_n_s_external_id __pyx_mstate_global->__pyx_n_s_external_id
#define __pyx_n_s_extra __pyx_mstate_global->__pyx_n_s_extra
#define __pyx_n_s_f __pyx_mstate_global->__pyx_n_s_f
#define __pyx_n_s_fallback __pyx_mstate_global->__pyx_n_s_fallback
#define __pyx_n_s_feed __pyx_mstate_global->__pyx_n_s_feed
#define __pyx_n_s_feed_error_log __pyx_mstate_global->__pyx_n_s_feed_error_log
#define __pyx_n_s_file __pyx_mstate_global->__pyx_n_s_file
#define __pyx_kp_b_file_2 __pyx_mstate_global->__pyx_kp_b_file_2
#define __pyx_kp_u_file_must_be_a_filename_file_lik __pyx_mstate_global->__pyx_kp_u_file_must_be_a_filename_file_lik
#define __pyx_n_s_filelike __pyx_mstate_global->__pyx_n_s_filelike
#define __pyx_n_s_filename __pyx_mstate_global->__pyx_n_s_filename
#define __pyx_n_s_fileobj __pyx_mstate_global->__pyx_n_s_fileobj
#define __pyx_n_s_filter_domains __pyx_mstate_global->__pyx_n_s_filter_domains
#define __pyx_n_s_filter_from_errors __pyx_mstate_global->__pyx_n_s_filter_from_errors
#define __pyx_n_s_filter_from_fatals __pyx_mstate_global->__pyx_n_s_filter_from_fatals
#define __pyx_n_s_filter_from_level __pyx_mstate_global->__pyx_n_s_filter_from_level
#define __pyx_n_s_filter_from_warnings __pyx_mstate_global->__pyx_n_s_filter_from_warnings
#define __pyx_n_s_filter_levels __pyx_mstate_global->__pyx_n_s_filter_levels
#define __pyx_n_s_filter_types __pyx_mstate_global->__pyx_n_s_filter_types
#define __pyx_n_s_filtered __pyx_mstate_global->__pyx_n_s_filtered
#define __pyx_n_s_find __pyx_mstate_global->__pyx_n_s_find
#define __pyx_n_s_findall __pyx_mstate_global->__pyx_n_s_findall
#define __pyx_n_s_findtext __pyx_mstate_global->__pyx_n_s_findtext
#define __pyx_n_s_first_error __pyx_mstate_global->__pyx_n_s_first_error
#define __pyx_n_u_fixed __pyx_mstate_global->__pyx_n_u_fixed
#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags
#define __pyx_n_s_flush __pyx_mstate_global->__pyx_n_s_flush
#define __pyx_n_s_for_html __pyx_mstate_global->__pyx_n_s_for_html
#define __pyx_n_s_from_file __pyx_mstate_global->__pyx_n_s_from_file
#define __pyx_n_s_from_rnc_string __pyx_mstate_global->__pyx_n_s_from_rnc_string
#define __pyx_n_s_fromstring __pyx_mstate_global->__pyx_n_s_fromstring
#define __pyx_n_u_fromstring __pyx_mstate_global->__pyx_n_u_fromstring
#define __pyx_n_s_fromstringlist __pyx_mstate_global->__pyx_n_s_fromstringlist
#define __pyx_n_u_fromstringlist __pyx_mstate_global->__pyx_n_u_fromstringlist
#define __pyx_n_s_function_mapping __pyx_mstate_global->__pyx_n_s_function_mapping
#define __pyx_n_s_function_name __pyx_mstate_global->__pyx_n_s_function_name
#define __pyx_n_s_functions __pyx_mstate_global->__pyx_n_s_functions
#define __pyx_n_s_functools __pyx_mstate_global->__pyx_n_s_functools
#define __pyx_n_u_g __pyx_mstate_global->__pyx_n_u_g
#define __pyx_kp_u_g_1_g_2 __pyx_mstate_global->__pyx_kp_u_g_1_g_2
#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get
#define __pyx_n_s_getLogger __pyx_mstate_global->__pyx_n_s_getLogger
#define __pyx_n_s_getName __pyx_mstate_global->__pyx_n_s_getName
#define __pyx_n_s_get_default_parser __pyx_mstate_global->__pyx_n_s_get_default_parser
#define __pyx_n_u_get_default_parser __pyx_mstate_global->__pyx_n_u_get_default_parser
#define __pyx_n_s_get_namespace __pyx_mstate_global->__pyx_n_s_get_namespace
#define __pyx_n_s_getargspec __pyx_mstate_global->__pyx_n_s_getargspec
#define __pyx_n_s_getattribute __pyx_mstate_global->__pyx_n_s_getattribute
#define __pyx_n_s_getchildren __pyx_mstate_global->__pyx_n_s_getchildren
#define __pyx_n_s_getdefaultencoding __pyx_mstate_global->__pyx_n_s_getdefaultencoding
#define __pyx_n_s_getelementpath __pyx_mstate_global->__pyx_n_s_getelementpath
#define __pyx_n_s_getfilesystemencoding __pyx_mstate_global->__pyx_n_s_getfilesystemencoding
#define __pyx_n_s_getfullargspec __pyx_mstate_global->__pyx_n_s_getfullargspec
#define __pyx_n_s_getitem __pyx_mstate_global->__pyx_n_s_getitem
#define __pyx_n_s_getiterator __pyx_mstate_global->__pyx_n_s_getiterator
#define __pyx_n_s_getnext __pyx_mstate_global->__pyx_n_s_getnext
#define __pyx_n_s_getparent __pyx_mstate_global->__pyx_n_s_getparent
#define __pyx_n_s_getpath __pyx_mstate_global->__pyx_n_s_getpath
#define __pyx_n_s_getprevious __pyx_mstate_global->__pyx_n_s_getprevious
#define __pyx_n_s_getroot __pyx_mstate_global->__pyx_n_s_getroot
#define __pyx_n_s_getroottree __pyx_mstate_global->__pyx_n_s_getroottree
#define __pyx_n_s_geturl __pyx_mstate_global->__pyx_n_s_geturl
#define __pyx_n_s_getvalue __pyx_mstate_global->__pyx_n_s_getvalue
#define __pyx_n_u_getvalue __pyx_mstate_global->__pyx_n_u_getvalue
#define __pyx_n_s_getwriter __pyx_mstate_global->__pyx_n_s_getwriter
#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got
#define __pyx_kp_u_got_invalid_input_value_of_type __pyx_mstate_global->__pyx_kp_u_got_invalid_input_value_of_type
#define __pyx_n_s_group __pyx_mstate_global->__pyx_n_s_group
#define __pyx_n_s_groups __pyx_mstate_global->__pyx_n_s_groups
#define __pyx_kp_u_gt __pyx_mstate_global->__pyx_kp_u_gt
#define __pyx_n_s_gzip __pyx_mstate_global->__pyx_n_s_gzip
#define __pyx_n_s_has_key __pyx_mstate_global->__pyx_n_s_has_key
#define __pyx_n_u_href __pyx_mstate_global->__pyx_n_u_href
#define __pyx_kp_u_href_2 __pyx_mstate_global->__pyx_kp_u_href_2
#define __pyx_n_s_href_utf __pyx_mstate_global->__pyx_n_s_href_utf
#define __pyx_n_s_hrefs __pyx_mstate_global->__pyx_n_s_hrefs
#define __pyx_n_b_html __pyx_mstate_global->__pyx_n_b_html
#define __pyx_n_s_html __pyx_mstate_global->__pyx_n_s_html
#define __pyx_n_u_html __pyx_mstate_global->__pyx_n_u_html
#define __pyx_n_s_htmlfile __pyx_mstate_global->__pyx_n_s_htmlfile
#define __pyx_kp_b_http_codespeak_net_lxml_objectif __pyx_mstate_global->__pyx_kp_b_http_codespeak_net_lxml_objectif
#define __pyx_kp_b_http_exslt_org_regular_expressio __pyx_mstate_global->__pyx_kp_b_http_exslt_org_regular_expressio
#define __pyx_kp_b_http_purl_org_dc_elements_1_1 __pyx_mstate_global->__pyx_kp_b_http_purl_org_dc_elements_1_1
#define __pyx_kp_b_http_schemas_xmlsoap_org_wsdl __pyx_mstate_global->__pyx_kp_b_http_schemas_xmlsoap_org_wsdl
#define __pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s
#define __pyx_kp_b_http_www_w3_org_1999_XSL_Transfo __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo
#define __pyx_kp_u_http_www_w3_org_1999_XSL_Transfo __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo
#define __pyx_kp_b_http_www_w3_org_1999_xhtml __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_1999_xhtml
#define __pyx_kp_b_http_www_w3_org_2001_XMLSchema __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_2001_XMLSchema
#define __pyx_kp_u_http_www_w3_org_2001_XMLSchema __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_2001_XMLSchema
#define __pyx_kp_b_http_www_w3_org_2001_XMLSchema_i __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i
#define __pyx_kp_u_http_www_w3_org_XML_1998_namesp __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_XML_1998_namesp
#define __pyx_kp_b_http_www_w3_org_XML_1998_namespa __pyx_mstate_global->__pyx_kp_b_http_www_w3_org_XML_1998_namespa
#define __pyx_kp_u_http_www_w3_org_XML_1998_namespa __pyx_mstate_global->__pyx_kp_u_http_www_w3_org_XML_1998_namespa
#define __pyx_n_s_huge_tree __pyx_mstate_global->__pyx_n_s_huge_tree
#define __pyx_n_u_i __pyx_mstate_global->__pyx_n_u_i
#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id
#define __pyx_n_u_id __pyx_mstate_global->__pyx_n_u_id
#define __pyx_n_s_id_name __pyx_mstate_global->__pyx_n_s_id_name
#define __pyx_n_u_idref __pyx_mstate_global->__pyx_n_u_idref
#define __pyx_n_u_idrefs __pyx_mstate_global->__pyx_n_u_idrefs
#define __pyx_n_u_implied __pyx_mstate_global->__pyx_n_u_implied
#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
#define __pyx_kp_u_in_public_id __pyx_mstate_global->__pyx_kp_u_in_public_id
#define __pyx_n_s_inclusive __pyx_mstate_global->__pyx_n_s_inclusive
#define __pyx_n_s_inclusive_ns_prefixes __pyx_mstate_global->__pyx_n_s_inclusive_ns_prefixes
#define __pyx_kp_u_inconsistent_exit_action_in_cont __pyx_mstate_global->__pyx_kp_u_inconsistent_exit_action_in_cont
#define __pyx_n_s_indent __pyx_mstate_global->__pyx_n_s_indent
#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index
#define __pyx_kp_u_index_out_of_range __pyx_mstate_global->__pyx_kp_u_index_out_of_range
#define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init
#define __pyx_n_s_init_2 __pyx_mstate_global->__pyx_n_s_init_2
#define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass
#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
#define __pyx_n_s_input __pyx_mstate_global->__pyx_n_s_input
#define __pyx_kp_u_input_is_not_an_Element __pyx_mstate_global->__pyx_kp_u_input_is_not_an_Element
#define __pyx_n_s_input_node __pyx_mstate_global->__pyx_n_s_input_node
#define __pyx_n_s_insert __pyx_mstate_global->__pyx_n_s_insert
#define __pyx_n_s_insert_comments __pyx_mstate_global->__pyx_n_s_insert_comments
#define __pyx_n_s_insert_pis __pyx_mstate_global->__pyx_n_s_insert_pis
#define __pyx_n_s_inspect __pyx_mstate_global->__pyx_n_s_inspect
#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int
#define __pyx_n_s_int1 __pyx_mstate_global->__pyx_n_s_int1
#define __pyx_n_s_int2 __pyx_mstate_global->__pyx_n_s_int2
#define __pyx_n_u_internal __pyx_mstate_global->__pyx_n_u_internal
#define __pyx_kp_u_internal_error_tail __pyx_mstate_global->__pyx_kp_u_internal_error_tail
#define __pyx_kp_u_internal_error_text __pyx_mstate_global->__pyx_kp_u_internal_error_text
#define __pyx_n_s_intersection __pyx_mstate_global->__pyx_n_s_intersection
#define __pyx_kp_u_invalid_DTD_proxy_at_s __pyx_mstate_global->__pyx_kp_u_invalid_DTD_proxy_at_s
#define __pyx_kp_u_invalid_Document_proxy_at_s __pyx_mstate_global->__pyx_kp_u_invalid_Document_proxy_at_s
#define __pyx_kp_u_invalid_Element_proxy_at_s __pyx_mstate_global->__pyx_kp_u_invalid_Element_proxy_at_s
#define __pyx_kp_u_invalid_argument_type __pyx_mstate_global->__pyx_kp_u_invalid_argument_type
#define __pyx_kp_u_invalid_element __pyx_mstate_global->__pyx_kp_u_invalid_element
#define __pyx_kp_u_invalid_event_name __pyx_mstate_global->__pyx_kp_u_invalid_event_name
#define __pyx_kp_u_invalid_node_type __pyx_mstate_global->__pyx_kp_u_invalid_node_type
#define __pyx_n_s_io __pyx_mstate_global->__pyx_n_s_io
#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
#define __pyx_kp_u_is_not_declared_in_scope __pyx_mstate_global->__pyx_kp_u_is_not_declared_in_scope
#define __pyx_n_s_is_owned __pyx_mstate_global->__pyx_n_s_is_owned
#define __pyx_n_s_is_standalone __pyx_mstate_global->__pyx_n_s_is_standalone
#define __pyx_n_s_iselement __pyx_mstate_global->__pyx_n_s_iselement
#define __pyx_n_u_iselement __pyx_mstate_global->__pyx_n_u_iselement
#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
#define __pyx_n_s_islice __pyx_mstate_global->__pyx_n_s_islice
#define __pyx_n_s_isspace __pyx_mstate_global->__pyx_n_s_isspace
#define __pyx_n_s_item __pyx_mstate_global->__pyx_n_s_item
#define __pyx_n_s_items __pyx_mstate_global->__pyx_n_s_items
#define __pyx_n_u_items __pyx_mstate_global->__pyx_n_u_items
#define __pyx_n_s_iter __pyx_mstate_global->__pyx_n_s_iter
#define __pyx_n_s_iter_2 __pyx_mstate_global->__pyx_n_s_iter_2
#define __pyx_n_s_iter_namespaces __pyx_mstate_global->__pyx_n_s_iter_namespaces
#define __pyx_n_s_iterancestors __pyx_mstate_global->__pyx_n_s_iterancestors
#define __pyx_n_s_iterattributes __pyx_mstate_global->__pyx_n_s_iterattributes
#define __pyx_n_s_iterchildren __pyx_mstate_global->__pyx_n_s_iterchildren
#define __pyx_n_s_iterdescendants __pyx_mstate_global->__pyx_n_s_iterdescendants
#define __pyx_n_s_iterelements __pyx_mstate_global->__pyx_n_s_iterelements
#define __pyx_n_s_iterentities __pyx_mstate_global->__pyx_n_s_iterentities
#define __pyx_n_s_iterfind __pyx_mstate_global->__pyx_n_s_iterfind
#define __pyx_n_s_iteritems __pyx_mstate_global->__pyx_n_s_iteritems
#define __pyx_n_s_iterkeys __pyx_mstate_global->__pyx_n_s_iterkeys
#define __pyx_n_s_iterparse __pyx_mstate_global->__pyx_n_s_iterparse
#define __pyx_n_u_iterparse __pyx_mstate_global->__pyx_n_u_iterparse
#define __pyx_n_s_iterparse_makeelement __pyx_mstate_global->__pyx_n_s_iterparse_makeelement
#define __pyx_n_s_iterparse_set_element_class_look __pyx_mstate_global->__pyx_n_s_iterparse_set_element_class_look
#define __pyx_n_s_itersiblings __pyx_mstate_global->__pyx_n_s_itersiblings
#define __pyx_n_s_itertext __pyx_mstate_global->__pyx_n_s_itertext
#define __pyx_n_s_itertools __pyx_mstate_global->__pyx_n_s_itertools
#define __pyx_n_s_itervalues __pyx_mstate_global->__pyx_n_s_itervalues
#define __pyx_n_s_iterwalk __pyx_mstate_global->__pyx_n_s_iterwalk
#define __pyx_n_u_iterwalk __pyx_mstate_global->__pyx_n_u_iterwalk
#define __pyx_n_s_iterwalk_skip_subtree __pyx_mstate_global->__pyx_n_s_iterwalk_skip_subtree
#define __pyx_n_s_join __pyx_mstate_global->__pyx_n_s_join
#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k
#define __pyx_n_s_keep_ns_prefixes __pyx_mstate_global->__pyx_n_s_keep_ns_prefixes
#define __pyx_n_s_keep_tail __pyx_mstate_global->__pyx_n_s_keep_tail
#define __pyx_n_s_key __pyx_mstate_global->__pyx_n_s_key
#define __pyx_kp_u_key_not_found __pyx_mstate_global->__pyx_kp_u_key_not_found
#define __pyx_n_s_keys __pyx_mstate_global->__pyx_n_s_keys
#define __pyx_n_s_kw __pyx_mstate_global->__pyx_n_s_kw
#define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs
#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l
#define __pyx_n_s_last_error __pyx_mstate_global->__pyx_n_s_last_error
#define __pyx_n_s_len __pyx_mstate_global->__pyx_n_s_len
#define __pyx_n_s_level __pyx_mstate_global->__pyx_n_s_level
#define __pyx_n_s_level_name __pyx_mstate_global->__pyx_n_s_level_name
#define __pyx_n_s_levels __pyx_mstate_global->__pyx_n_s_levels
#define __pyx_kp_u_libxml2_d_d_d __pyx_mstate_global->__pyx_kp_u_libxml2_d_d_d
#define __pyx_kp_u_line __pyx_mstate_global->__pyx_kp_u_line
#define __pyx_n_s_line_2 __pyx_mstate_global->__pyx_n_s_line_2
#define __pyx_kp_u_line_3 __pyx_mstate_global->__pyx_kp_u_line_3
#define __pyx_n_s_lineno __pyx_mstate_global->__pyx_n_s_lineno
#define __pyx_kp_u_list_index_out_of_range __pyx_mstate_global->__pyx_kp_u_list_index_out_of_range
#define __pyx_kp_u_list_index_x_x_not_in_list __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_list
#define __pyx_kp_u_list_index_x_x_not_in_slice __pyx_mstate_global->__pyx_kp_u_list_index_x_x_not_in_slice
#define __pyx_n_s_load __pyx_mstate_global->__pyx_n_s_load
#define __pyx_n_s_load_dtd __pyx_mstate_global->__pyx_n_s_load_dtd
#define __pyx_n_s_loads __pyx_mstate_global->__pyx_n_s_loads
#define __pyx_n_s_log __pyx_mstate_global->__pyx_n_s_log
#define __pyx_n_s_log_entry __pyx_mstate_global->__pyx_n_s_log_entry
#define __pyx_n_s_logger __pyx_mstate_global->__pyx_n_s_logger
#define __pyx_n_s_logger_name __pyx_mstate_global->__pyx_n_s_logger_name
#define __pyx_n_s_logging __pyx_mstate_global->__pyx_n_s_logging
#define __pyx_n_s_lookup __pyx_mstate_global->__pyx_n_s_lookup
#define __pyx_n_s_lower __pyx_mstate_global->__pyx_n_s_lower
#define __pyx_kp_u_lt __pyx_mstate_global->__pyx_kp_u_lt
#define __pyx_n_s_lxml __pyx_mstate_global->__pyx_n_s_lxml
#define __pyx_n_s_lxml_cssselect __pyx_mstate_global->__pyx_n_s_lxml_cssselect
#define __pyx_n_s_lxml_etree __pyx_mstate_global->__pyx_n_s_lxml_etree
#define __pyx_kp_u_lxml_etree_was_compiled_without __pyx_mstate_global->__pyx_kp_u_lxml_etree_was_compiled_without
#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
#define __pyx_n_s_makeelement __pyx_mstate_global->__pyx_n_s_makeelement
#define __pyx_kp_u_malformed_PI_attributes __pyx_mstate_global->__pyx_kp_u_malformed_PI_attributes
#define __pyx_n_b_match __pyx_mstate_global->__pyx_n_b_match
#define __pyx_n_s_match __pyx_mstate_global->__pyx_n_s_match
#define __pyx_n_u_match __pyx_mstate_global->__pyx_n_u_match
#define __pyx_n_s_matcher __pyx_mstate_global->__pyx_n_s_matcher
#define __pyx_n_u_matches __pyx_mstate_global->__pyx_n_u_matches
#define __pyx_n_s_max_depth __pyx_mstate_global->__pyx_n_s_max_depth
#define __pyx_n_s_max_len __pyx_mstate_global->__pyx_n_s_max_len
#define __pyx_n_s_memo __pyx_mstate_global->__pyx_n_s_memo
#define __pyx_n_s_memory_debugger __pyx_mstate_global->__pyx_n_s_memory_debugger
#define __pyx_kp_b_memorydump __pyx_mstate_global->__pyx_kp_b_memorydump
#define __pyx_kp_b_memorylist __pyx_mstate_global->__pyx_kp_b_memorylist
#define __pyx_n_s_message __pyx_mstate_global->__pyx_n_s_message
#define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass
#define __pyx_n_s_method __pyx_mstate_global->__pyx_n_s_method
#define __pyx_kp_u_missing_end_tags __pyx_mstate_global->__pyx_kp_u_missing_end_tags
#define __pyx_kp_u_missing_toplevel_element __pyx_mstate_global->__pyx_kp_u_missing_toplevel_element
#define __pyx_n_u_mixed __pyx_mstate_global->__pyx_n_u_mixed
#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
#define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module
#define __pyx_n_s_module_2 __pyx_mstate_global->__pyx_n_s_module_2
#define __pyx_n_s_mro_entries __pyx_mstate_global->__pyx_n_s_mro_entries
#define __pyx_n_u_mult __pyx_mstate_global->__pyx_n_u_mult
#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n
#define __pyx_n_u_n __pyx_mstate_global->__pyx_n_u_n
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
#define __pyx_n_u_name __pyx_mstate_global->__pyx_n_u_name
#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
#define __pyx_n_s_name_utf __pyx_mstate_global->__pyx_n_s_name_utf
#define __pyx_n_s_names __pyx_mstate_global->__pyx_n_s_names
#define __pyx_n_s_namespace __pyx_mstate_global->__pyx_n_s_namespace
#define __pyx_n_s_namespaces __pyx_mstate_global->__pyx_n_s_namespaces
#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new
#define __pyx_n_s_new_doc __pyx_mstate_global->__pyx_n_s_new_doc
#define __pyx_n_s_new_element __pyx_mstate_global->__pyx_n_s_new_element
#define __pyx_n_s_new_namespaces __pyx_mstate_global->__pyx_n_s_new_namespaces
#define __pyx_n_s_new_pos __pyx_mstate_global->__pyx_n_s_new_pos
#define __pyx_n_u_nmtoken __pyx_mstate_global->__pyx_n_u_nmtoken
#define __pyx_n_u_nmtokens __pyx_mstate_global->__pyx_n_u_nmtokens
#define __pyx_kp_u_no_content_written __pyx_mstate_global->__pyx_kp_u_no_content_written
#define __pyx_kp_u_no_context_node __pyx_mstate_global->__pyx_kp_u_no_context_node
#define __pyx_kp_u_no_element_found __pyx_mstate_global->__pyx_kp_u_no_element_found
#define __pyx_n_s_no_network __pyx_mstate_global->__pyx_n_s_no_network
#define __pyx_n_s_node __pyx_mstate_global->__pyx_n_s_node
#define __pyx_n_u_none __pyx_mstate_global->__pyx_n_u_none
#define __pyx_kp_u_not_allowed_inside_CDATA __pyx_mstate_global->__pyx_kp_u_not_allowed_inside_CDATA
#define __pyx_kp_u_not_found __pyx_mstate_global->__pyx_kp_u_not_found
#define __pyx_kp_u_not_found_2 __pyx_mstate_global->__pyx_kp_u_not_found_2
#define __pyx_kp_u_not_in_an_element __pyx_mstate_global->__pyx_kp_u_not_in_an_element
#define __pyx_n_u_notation __pyx_mstate_global->__pyx_n_u_notation
#define __pyx_n_s_ns __pyx_mstate_global->__pyx_n_s_ns
#define __pyx_n_s_ns_clean __pyx_mstate_global->__pyx_n_s_ns_clean
#define __pyx_kp_u_ns_d __pyx_mstate_global->__pyx_kp_u_ns_d
#define __pyx_kp_b_ns_d_2 __pyx_mstate_global->__pyx_kp_b_ns_d_2
#define __pyx_n_s_ns_stack __pyx_mstate_global->__pyx_n_s_ns_stack
#define __pyx_n_s_ns_uri __pyx_mstate_global->__pyx_n_s_ns_uri
#define __pyx_n_s_ns_utf __pyx_mstate_global->__pyx_n_s_ns_utf
#define __pyx_n_s_nsmap __pyx_mstate_global->__pyx_n_s_nsmap
#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj
#define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object
#define __pyx_kp_u_object_name __pyx_mstate_global->__pyx_kp_u_object_name
#define __pyx_kp_u_occur __pyx_mstate_global->__pyx_kp_u_occur
#define __pyx_n_s_occur_2 __pyx_mstate_global->__pyx_n_s_occur_2
#define __pyx_kp_u_of_QName __pyx_mstate_global->__pyx_kp_u_of_QName
#define __pyx_kp_u_of_name __pyx_mstate_global->__pyx_kp_u_of_name
#define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset
#define __pyx_n_s_old __pyx_mstate_global->__pyx_n_s_old
#define __pyx_n_s_old_element __pyx_mstate_global->__pyx_n_s_old_element
#define __pyx_n_s_old_writer __pyx_mstate_global->__pyx_n_s_old_writer
#define __pyx_n_u_once __pyx_mstate_global->__pyx_n_u_once
#define __pyx_kp_u_only_XML_documents_have_declarat __pyx_mstate_global->__pyx_kp_u_only_XML_documents_have_declarat
#define __pyx_kp_u_only_setting_the_href_attribute __pyx_mstate_global->__pyx_kp_u_only_setting_the_href_attribute
#define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open
#define __pyx_n_s_open_utf8_file __pyx_mstate_global->__pyx_n_s_open_utf8_file
#define __pyx_n_u_opt __pyx_mstate_global->__pyx_n_u_opt
#define __pyx_n_s_options __pyx_mstate_global->__pyx_n_s_options
#define __pyx_n_u_or __pyx_mstate_global->__pyx_n_u_or
#define __pyx_n_s_os_path __pyx_mstate_global->__pyx_n_s_os_path
#define __pyx_n_s_other_element __pyx_mstate_global->__pyx_n_s_other_element
#define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out
#define __pyx_n_s_outfile __pyx_mstate_global->__pyx_n_s_outfile
#define __pyx_n_s_output_file __pyx_mstate_global->__pyx_n_s_output_file
#define __pyx_n_s_output_parent __pyx_mstate_global->__pyx_n_s_output_parent
#define __pyx_n_s_parent __pyx_mstate_global->__pyx_n_s_parent
#define __pyx_n_s_parse __pyx_mstate_global->__pyx_n_s_parse
#define __pyx_n_u_parse __pyx_mstate_global->__pyx_n_u_parse
#define __pyx_n_s_parseXSL __pyx_mstate_global->__pyx_n_s_parseXSL
#define __pyx_n_s_parse_options __pyx_mstate_global->__pyx_n_s_parse_options
#define __pyx_n_s_parseid __pyx_mstate_global->__pyx_n_s_parseid
#define __pyx_n_u_parseid __pyx_mstate_global->__pyx_n_u_parseid
#define __pyx_n_s_parser __pyx_mstate_global->__pyx_n_s_parser
#define __pyx_kp_u_parser_locking_failed __pyx_mstate_global->__pyx_kp_u_parser_locking_failed
#define __pyx_n_s_partial __pyx_mstate_global->__pyx_n_s_partial
#define __pyx_kp_u_passing_a_single_string_into_fro __pyx_mstate_global->__pyx_kp_u_passing_a_single_string_into_fro
#define __pyx_n_s_path __pyx_mstate_global->__pyx_n_s_path
#define __pyx_n_s_path_2 __pyx_mstate_global->__pyx_n_s_path_2
#define __pyx_n_u_pcdata __pyx_mstate_global->__pyx_n_u_pcdata
#define __pyx_kp_u_pending_open_tags_on_close __pyx_mstate_global->__pyx_kp_u_pending_open_tags_on_close
#define __pyx_n_s_pi __pyx_mstate_global->__pyx_n_s_pi
#define __pyx_n_u_pi __pyx_mstate_global->__pyx_n_u_pi
#define __pyx_n_s_pi_factory __pyx_mstate_global->__pyx_n_s_pi_factory
#define __pyx_n_u_plus __pyx_mstate_global->__pyx_n_u_plus
#define __pyx_n_s_pop __pyx_mstate_global->__pyx_n_s_pop
#define __pyx_kp_u_pop_expected_at_most_2_arguments __pyx_mstate_global->__pyx_kp_u_pop_expected_at_most_2_arguments
#define __pyx_n_s_position __pyx_mstate_global->__pyx_n_s_position
#define __pyx_n_s_preceding __pyx_mstate_global->__pyx_n_s_preceding
#define __pyx_n_s_prefix __pyx_mstate_global->__pyx_n_s_prefix
#define __pyx_kp_u_prefix_2 __pyx_mstate_global->__pyx_kp_u_prefix_2
#define __pyx_n_s_prefix_utf __pyx_mstate_global->__pyx_n_s_prefix_utf
#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare
#define __pyx_n_u_preserve __pyx_mstate_global->__pyx_n_u_preserve
#define __pyx_n_s_pretty_print __pyx_mstate_global->__pyx_n_s_pretty_print
#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print
#define __pyx_n_s_process_children __pyx_mstate_global->__pyx_n_s_process_children
#define __pyx_n_s_profile_run __pyx_mstate_global->__pyx_n_s_profile_run
#define __pyx_n_s_property __pyx_mstate_global->__pyx_n_s_property
#define __pyx_n_s_public_id __pyx_mstate_global->__pyx_n_s_public_id
#define __pyx_n_b_py __pyx_mstate_global->__pyx_n_b_py
#define __pyx_n_s_pyucs4_encoding_name __pyx_mstate_global->__pyx_n_s_pyucs4_encoding_name
#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
#define __pyx_n_s_qname_aware_attrs __pyx_mstate_global->__pyx_n_s_qname_aware_attrs
#define __pyx_n_s_qname_aware_tags __pyx_mstate_global->__pyx_n_s_qname_aware_tags
#define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname
#define __pyx_kp_u_quot __pyx_mstate_global->__pyx_kp_u_quot
#define __pyx_n_s_r __pyx_mstate_global->__pyx_n_s_r
#define __pyx_n_s_raise_on_error __pyx_mstate_global->__pyx_n_s_raise_on_error
#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
#define __pyx_n_u_rb __pyx_mstate_global->__pyx_n_u_rb
#define __pyx_n_s_rclose __pyx_mstate_global->__pyx_n_s_rclose
#define __pyx_n_b_rdf __pyx_mstate_global->__pyx_n_b_rdf
#define __pyx_n_s_re __pyx_mstate_global->__pyx_n_s_re
#define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read
#define __pyx_n_u_read __pyx_mstate_global->__pyx_n_u_read
#define __pyx_n_s_read_events __pyx_mstate_global->__pyx_n_s_read_events
#define __pyx_n_s_read_file __pyx_mstate_global->__pyx_n_s_read_file
#define __pyx_n_u_read_file __pyx_mstate_global->__pyx_n_u_read_file
#define __pyx_n_s_read_network __pyx_mstate_global->__pyx_n_s_read_network
#define __pyx_n_u_read_network __pyx_mstate_global->__pyx_n_u_read_network
#define __pyx_kp_u_reading_file_objects_must_return __pyx_mstate_global->__pyx_kp_u_reading_file_objects_must_return
#define __pyx_kp_u_reading_from_file_like_objects_m __pyx_mstate_global->__pyx_kp_u_reading_from_file_like_objects_m
#define __pyx_n_s_receive __pyx_mstate_global->__pyx_n_s_receive
#define __pyx_n_s_recover __pyx_mstate_global->__pyx_n_s_recover
#define __pyx_kp_u_reference_to_non_existing_embedd __pyx_mstate_global->__pyx_kp_u_reference_to_non_existing_embedd
#define __pyx_n_s_regexp __pyx_mstate_global->__pyx_n_s_regexp
#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register
#define __pyx_n_s_register_namespace __pyx_mstate_global->__pyx_n_s_register_namespace
#define __pyx_n_u_register_namespace __pyx_mstate_global->__pyx_n_u_register_namespace
#define __pyx_n_s_register_namespaces __pyx_mstate_global->__pyx_n_s_register_namespaces
#define __pyx_n_s_registry __pyx_mstate_global->__pyx_n_s_registry
#define __pyx_n_s_relaxng __pyx_mstate_global->__pyx_n_s_relaxng
#define __pyx_n_s_remove __pyx_mstate_global->__pyx_n_s_remove
#define __pyx_n_s_remove_blank_text __pyx_mstate_global->__pyx_n_s_remove_blank_text
#define __pyx_n_s_remove_comments __pyx_mstate_global->__pyx_n_s_remove_comments
#define __pyx_n_s_remove_pis __pyx_mstate_global->__pyx_n_s_remove_pis
#define __pyx_n_b_replace __pyx_mstate_global->__pyx_n_b_replace
#define __pyx_n_s_replace __pyx_mstate_global->__pyx_n_s_replace
#define __pyx_n_s_replacement __pyx_mstate_global->__pyx_n_s_replacement
#define __pyx_n_u_required __pyx_mstate_global->__pyx_n_u_required
#define __pyx_n_s_resolve __pyx_mstate_global->__pyx_n_s_resolve
#define __pyx_n_s_resolve_empty __pyx_mstate_global->__pyx_n_s_resolve_empty
#define __pyx_n_s_resolve_entities __pyx_mstate_global->__pyx_n_s_resolve_entities
#define __pyx_n_s_resolve_external_entities __pyx_mstate_global->__pyx_n_s_resolve_external_entities
#define __pyx_n_s_resolve_file __pyx_mstate_global->__pyx_n_s_resolve_file
#define __pyx_n_s_resolve_filename __pyx_mstate_global->__pyx_n_s_resolve_filename
#define __pyx_n_s_resolve_string __pyx_mstate_global->__pyx_n_s_resolve_string
#define __pyx_n_s_resolver __pyx_mstate_global->__pyx_n_s_resolver
#define __pyx_n_s_resolvers __pyx_mstate_global->__pyx_n_s_resolvers
#define __pyx_kp_u_restructuredtext_en __pyx_mstate_global->__pyx_kp_u_restructuredtext_en
#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result
#define __pyx_n_s_result_container __pyx_mstate_global->__pyx_n_s_result_container
#define __pyx_n_s_result_doc __pyx_mstate_global->__pyx_n_s_result_doc
#define __pyx_n_s_result_list __pyx_mstate_global->__pyx_n_s_result_list
#define __pyx_n_s_result_node __pyx_mstate_global->__pyx_n_s_result_node
#define __pyx_kp_u_result_of_class_lookup_must_be_s __pyx_mstate_global->__pyx_kp_u_result_of_class_lookup_must_be_s
#define __pyx_n_s_result_tree __pyx_mstate_global->__pyx_n_s_result_tree
#define __pyx_n_s_results __pyx_mstate_global->__pyx_n_s_results
#define __pyx_n_s_reversed __pyx_mstate_global->__pyx_n_s_reversed
#define __pyx_n_s_reversed_2 __pyx_mstate_global->__pyx_n_s_reversed_2
#define __pyx_n_s_reversed_nsmap __pyx_mstate_global->__pyx_n_s_reversed_nsmap
#define __pyx_n_s_rewrite_prefixes __pyx_mstate_global->__pyx_n_s_rewrite_prefixes
#define __pyx_n_s_rexp __pyx_mstate_global->__pyx_n_s_rexp
#define __pyx_n_s_rexpc __pyx_mstate_global->__pyx_n_s_rexpc
#define __pyx_kp_u_rnc __pyx_mstate_global->__pyx_kp_u_rnc
#define __pyx_n_s_rnc2rng __pyx_mstate_global->__pyx_n_s_rnc2rng
#define __pyx_n_s_rng_str __pyx_mstate_global->__pyx_n_s_rng_str
#define __pyx_n_s_root __pyx_mstate_global->__pyx_n_s_root
#define __pyx_n_s_rsplit __pyx_mstate_global->__pyx_n_s_rsplit
#define __pyx_kp_u_s __pyx_mstate_global->__pyx_kp_u_s
#define __pyx_kp_u_s_2 __pyx_mstate_global->__pyx_kp_u_s_2
#define __pyx_kp_u_s_3 __pyx_mstate_global->__pyx_kp_u_s_3
#define __pyx_n_s_s_4 __pyx_mstate_global->__pyx_n_s_s_4
#define __pyx_kp_u_s_href_s_s __pyx_mstate_global->__pyx_kp_u_s_href_s_s
#define __pyx_n_s_s_match __pyx_mstate_global->__pyx_n_s_s_match
#define __pyx_kp_u_s_r __pyx_mstate_global->__pyx_kp_u_s_r
#define __pyx_kp_u_s_w_s_s __pyx_mstate_global->__pyx_kp_u_s_w_s_s
#define __pyx_n_s_schema __pyx_mstate_global->__pyx_n_s_schema
#define __pyx_n_b_script __pyx_mstate_global->__pyx_n_b_script
#define __pyx_n_s_search __pyx_mstate_global->__pyx_n_s_search
#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
#define __pyx_n_s_self_node __pyx_mstate_global->__pyx_n_s_self_node
#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send
#define __pyx_n_u_seq __pyx_mstate_global->__pyx_n_u_seq
#define __pyx_n_s_sequence_or_dict __pyx_mstate_global->__pyx_n_s_sequence_or_dict
#define __pyx_n_s_set __pyx_mstate_global->__pyx_n_s_set
#define __pyx_n_s_set_default_parser __pyx_mstate_global->__pyx_n_s_set_default_parser
#define __pyx_n_u_set_default_parser __pyx_mstate_global->__pyx_n_u_set_default_parser
#define __pyx_n_s_set_element_class_lookup __pyx_mstate_global->__pyx_n_s_set_element_class_lookup
#define __pyx_n_u_set_element_class_lookup __pyx_mstate_global->__pyx_n_u_set_element_class_lookup
#define __pyx_n_s_set_fallback __pyx_mstate_global->__pyx_n_s_set_fallback
#define __pyx_n_s_set_global_max_depth __pyx_mstate_global->__pyx_n_s_set_global_max_depth
#define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name
#define __pyx_n_s_setitem __pyx_mstate_global->__pyx_n_s_setitem
#define __pyx_n_s_setroot __pyx_mstate_global->__pyx_n_s_setroot
#define __pyx_n_s_setter __pyx_mstate_global->__pyx_n_s_setter
#define __pyx_kp_u_setting_default_namespace_is_not __pyx_mstate_global->__pyx_kp_u_setting_default_namespace_is_not
#define __pyx_n_s_show __pyx_mstate_global->__pyx_n_s_show
#define __pyx_n_s_sio __pyx_mstate_global->__pyx_n_s_sio
#define __pyx_n_s_skip_subtree __pyx_mstate_global->__pyx_n_s_skip_subtree
#define __pyx_n_s_smart_strings __pyx_mstate_global->__pyx_n_s_smart_strings
#define __pyx_n_s_sorted __pyx_mstate_global->__pyx_n_s_sorted
#define __pyx_n_s_source __pyx_mstate_global->__pyx_n_s_source
#define __pyx_n_s_space __pyx_mstate_global->__pyx_n_s_space
#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
#define __pyx_n_s_split __pyx_mstate_global->__pyx_n_s_split
#define __pyx_n_s_splitlines __pyx_mstate_global->__pyx_n_s_splitlines
#define __pyx_n_s_src __pyx_mstate_global->__pyx_n_s_src
#define __pyx_kp_s_src_lxml_classlookup_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_classlookup_pxi
#define __pyx_kp_s_src_lxml_cleanup_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_cleanup_pxi
#define __pyx_kp_s_src_lxml_debug_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_debug_pxi
#define __pyx_kp_s_src_lxml_docloader_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_docloader_pxi
#define __pyx_kp_s_src_lxml_dtd_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_dtd_pxi
#define __pyx_kp_s_src_lxml_etree_pyx __pyx_mstate_global->__pyx_kp_s_src_lxml_etree_pyx
#define __pyx_kp_s_src_lxml_extensions_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_extensions_pxi
#define __pyx_kp_s_src_lxml_iterparse_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_iterparse_pxi
#define __pyx_kp_s_src_lxml_nsclasses_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_nsclasses_pxi
#define __pyx_kp_s_src_lxml_parser_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_parser_pxi
#define __pyx_kp_s_src_lxml_parsertarget_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_parsertarget_pxi
#define __pyx_kp_s_src_lxml_readonlytree_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_readonlytree_pxi
#define __pyx_kp_s_src_lxml_relaxng_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_relaxng_pxi
#define __pyx_kp_s_src_lxml_saxparser_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_saxparser_pxi
#define __pyx_kp_s_src_lxml_serializer_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_serializer_pxi
#define __pyx_kp_s_src_lxml_xmlerror_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_xmlerror_pxi
#define __pyx_kp_s_src_lxml_xmlid_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_xmlid_pxi
#define __pyx_kp_s_src_lxml_xpath_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_xpath_pxi
#define __pyx_kp_s_src_lxml_xslt_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_xslt_pxi
#define __pyx_kp_s_src_lxml_xsltext_pxi __pyx_mstate_global->__pyx_kp_s_src_lxml_xsltext_pxi
#define __pyx_n_s_stacklevel __pyx_mstate_global->__pyx_n_s_stacklevel
#define __pyx_n_s_standalone __pyx_mstate_global->__pyx_n_s_standalone
#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
#define __pyx_n_u_start __pyx_mstate_global->__pyx_n_u_start
#define __pyx_kp_u_start_ns __pyx_mstate_global->__pyx_kp_u_start_ns
#define __pyx_n_s_start_ns_2 __pyx_mstate_global->__pyx_n_s_start_ns_2
#define __pyx_n_s_startswith __pyx_mstate_global->__pyx_n_s_startswith
#define __pyx_n_s_staticmethod __pyx_mstate_global->__pyx_n_s_staticmethod
#define __pyx_n_s_stdout __pyx_mstate_global->__pyx_n_s_stdout
#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
#define __pyx_n_s_store_exception __pyx_mstate_global->__pyx_n_s_store_exception
#define __pyx_n_s_str1 __pyx_mstate_global->__pyx_n_s_str1
#define __pyx_n_s_str2 __pyx_mstate_global->__pyx_n_s_str2
#define __pyx_n_s_str3 __pyx_mstate_global->__pyx_n_s_str3
#define __pyx_kp_u_string __pyx_mstate_global->__pyx_kp_u_string
#define __pyx_n_s_string_2 __pyx_mstate_global->__pyx_n_s_string_2
#define __pyx_kp_u_string___STRING__XSLT __pyx_mstate_global->__pyx_kp_u_string___STRING__XSLT
#define __pyx_kp_u_string_id __pyx_mstate_global->__pyx_kp_u_string_id
#define __pyx_n_s_strings __pyx_mstate_global->__pyx_n_s_strings
#define __pyx_n_s_strip __pyx_mstate_global->__pyx_n_s_strip
#define __pyx_n_s_strip_attributes __pyx_mstate_global->__pyx_n_s_strip_attributes
#define __pyx_n_u_strip_attributes __pyx_mstate_global->__pyx_n_u_strip_attributes
#define __pyx_n_s_strip_cdata __pyx_mstate_global->__pyx_n_s_strip_cdata
#define __pyx_n_s_strip_elements __pyx_mstate_global->__pyx_n_s_strip_elements
#define __pyx_n_u_strip_elements __pyx_mstate_global->__pyx_n_u_strip_elements
#define __pyx_n_s_strip_tags __pyx_mstate_global->__pyx_n_s_strip_tags
#define __pyx_n_u_strip_tags __pyx_mstate_global->__pyx_n_u_strip_tags
#define __pyx_n_s_strip_text __pyx_mstate_global->__pyx_n_s_strip_text
#define __pyx_n_s_strparam __pyx_mstate_global->__pyx_n_s_strparam
#define __pyx_n_s_strval __pyx_mstate_global->__pyx_n_s_strval
#define __pyx_n_b_style __pyx_mstate_global->__pyx_n_b_style
#define __pyx_n_s_style __pyx_mstate_global->__pyx_n_s_style
#define __pyx_n_s_sub __pyx_mstate_global->__pyx_n_s_sub
#define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super
#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys
#define __pyx_n_s_system_url __pyx_mstate_global->__pyx_n_s_system_url
#define __pyx_n_s_tag __pyx_mstate_global->__pyx_n_s_tag
#define __pyx_n_s_tag_2 __pyx_mstate_global->__pyx_n_s_tag_2
#define __pyx_n_s_tag_names __pyx_mstate_global->__pyx_n_s_tag_names
#define __pyx_n_s_tags __pyx_mstate_global->__pyx_n_s_tags
#define __pyx_n_s_tail __pyx_mstate_global->__pyx_n_s_tail
#define __pyx_n_s_target __pyx_mstate_global->__pyx_n_s_target
#define __pyx_n_s_tell __pyx_mstate_global->__pyx_n_s_tell
#define __pyx_n_u_tell __pyx_mstate_global->__pyx_n_u_tell
#define __pyx_n_b_test __pyx_mstate_global->__pyx_n_b_test
#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
#define __pyx_n_s_test_2 __pyx_mstate_global->__pyx_n_s_test_2
#define __pyx_n_s_text __pyx_mstate_global->__pyx_n_s_text
#define __pyx_n_u_text __pyx_mstate_global->__pyx_n_u_text
#define __pyx_n_s_text_or_uri_or_element __pyx_mstate_global->__pyx_n_s_text_or_uri_or_element
#define __pyx_kp_u_text_root __pyx_mstate_global->__pyx_kp_u_text_root
#define __pyx_kp_u_this_element_does_not_have_child __pyx_mstate_global->__pyx_kp_u_this_element_does_not_have_child
#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw
#define __pyx_kp_u_to_extended_slice_of_size __pyx_mstate_global->__pyx_kp_u_to_extended_slice_of_size
#define __pyx_n_s_top_nsmap __pyx_mstate_global->__pyx_n_s_top_nsmap
#define __pyx_n_s_tostring __pyx_mstate_global->__pyx_n_s_tostring
#define __pyx_n_u_tostring __pyx_mstate_global->__pyx_n_u_tostring
#define __pyx_n_s_tostringlist __pyx_mstate_global->__pyx_n_s_tostringlist
#define __pyx_n_u_tostringlist __pyx_mstate_global->__pyx_n_u_tostringlist
#define __pyx_n_s_tounicode __pyx_mstate_global->__pyx_n_s_tounicode
#define __pyx_n_u_tounicode __pyx_mstate_global->__pyx_n_u_tounicode
#define __pyx_n_s_translator __pyx_mstate_global->__pyx_n_s_translator
#define __pyx_n_s_tree __pyx_mstate_global->__pyx_n_s_tree
#define __pyx_n_s_tree_or_element __pyx_mstate_global->__pyx_n_s_tree_or_element
#define __pyx_n_s_type __pyx_mstate_global->__pyx_n_s_type
#define __pyx_kp_u_type_2 __pyx_mstate_global->__pyx_kp_u_type_2
#define __pyx_kp_u_type_3 __pyx_mstate_global->__pyx_kp_u_type_3
#define __pyx_n_s_type_name __pyx_mstate_global->__pyx_n_s_type_name
#define __pyx_n_s_types __pyx_mstate_global->__pyx_n_s_types
#define __pyx_kp_u_undecodable_error_message __pyx_mstate_global->__pyx_kp_u_undecodable_error_message
#define __pyx_n_u_undefined __pyx_mstate_global->__pyx_n_u_undefined
#define __pyx_n_u_unicode __pyx_mstate_global->__pyx_n_u_unicode
#define __pyx_n_u_unknown __pyx_mstate_global->__pyx_n_u_unknown
#define __pyx_kp_u_unknown_encoding __pyx_mstate_global->__pyx_kp_u_unknown_encoding
#define __pyx_kp_u_unknown_error __pyx_mstate_global->__pyx_kp_u_unknown_error
#define __pyx_kp_u_unknown_error_2 __pyx_mstate_global->__pyx_kp_u_unknown_error_2
#define __pyx_kp_u_unknown_output_method __pyx_mstate_global->__pyx_kp_u_unknown_output_method
#define __pyx_kp_u_unsupported_XSLT_result_type __pyx_mstate_global->__pyx_kp_u_unsupported_XSLT_result_type
#define __pyx_kp_u_unsupported_element_type_for_top __pyx_mstate_global->__pyx_kp_u_unsupported_element_type_for_top
#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update
#define __pyx_n_s_upper __pyx_mstate_global->__pyx_n_s_upper
#define __pyx_n_s_uri __pyx_mstate_global->__pyx_n_s_uri
#define __pyx_n_s_uri_utf __pyx_mstate_global->__pyx_n_s_uri_utf
#define __pyx_n_s_url __pyx_mstate_global->__pyx_n_s_url
#define __pyx_n_s_use_global_python_log __pyx_mstate_global->__pyx_n_s_use_global_python_log
#define __pyx_n_u_use_global_python_log __pyx_mstate_global->__pyx_n_u_use_global_python_log
#define __pyx_n_u_utf8 __pyx_mstate_global->__pyx_n_u_utf8
#define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8
#define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v
#define __pyx_n_s_validate __pyx_mstate_global->__pyx_n_s_validate
#define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value
#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values
#define __pyx_n_s_variables __pyx_mstate_global->__pyx_n_s_variables
#define __pyx_n_s_variables_2 __pyx_mstate_global->__pyx_n_s_variables_2
#define __pyx_n_s_version __pyx_mstate_global->__pyx_n_s_version
#define __pyx_n_s_version_2 __pyx_mstate_global->__pyx_n_s_version_2
#define __pyx_n_u_w __pyx_mstate_global->__pyx_n_u_w
#define __pyx_kp_u_w_w __pyx_mstate_global->__pyx_kp_u_w_w
#define __pyx_n_s_warn __pyx_mstate_global->__pyx_n_s_warn
#define __pyx_n_s_warnings __pyx_mstate_global->__pyx_n_s_warnings
#define __pyx_n_u_wb __pyx_mstate_global->__pyx_n_u_wb
#define __pyx_n_s_with_comments __pyx_mstate_global->__pyx_n_s_with_comments
#define __pyx_n_s_with_prefixes __pyx_mstate_global->__pyx_n_s_with_prefixes
#define __pyx_n_s_with_tail __pyx_mstate_global->__pyx_n_s_with_tail
#define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write
#define __pyx_n_u_write __pyx_mstate_global->__pyx_n_u_write
#define __pyx_n_s_write_c14n __pyx_mstate_global->__pyx_n_s_write_c14n
#define __pyx_n_s_write_declaration __pyx_mstate_global->__pyx_n_s_write_declaration
#define __pyx_n_s_write_doctype __pyx_mstate_global->__pyx_n_s_write_doctype
#define __pyx_n_s_write_file __pyx_mstate_global->__pyx_n_s_write_file
#define __pyx_n_u_write_file __pyx_mstate_global->__pyx_n_u_write_file
#define __pyx_n_s_write_network __pyx_mstate_global->__pyx_n_s_write_network
#define __pyx_n_u_write_network __pyx_mstate_global->__pyx_n_u_write_network
#define __pyx_n_s_write_output __pyx_mstate_global->__pyx_n_s_write_output
#define __pyx_n_s_writer __pyx_mstate_global->__pyx_n_s_writer
#define __pyx_n_b_wsdl __pyx_mstate_global->__pyx_n_b_wsdl
#define __pyx_n_u_x __pyx_mstate_global->__pyx_n_u_x
#define __pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9 __pyx_mstate_global->__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9
#define __pyx_kp_u_x9 __pyx_mstate_global->__pyx_kp_u_x9
#define __pyx_kp_u_xA __pyx_mstate_global->__pyx_kp_u_xA
#define __pyx_kp_u_xD __pyx_mstate_global->__pyx_kp_u_xD
#define __pyx_n_s_xinclude __pyx_mstate_global->__pyx_n_s_xinclude
#define __pyx_n_b_xml __pyx_mstate_global->__pyx_n_b_xml
#define __pyx_n_s_xml __pyx_mstate_global->__pyx_n_s_xml
#define __pyx_n_u_xml __pyx_mstate_global->__pyx_n_u_xml
#define __pyx_n_s_xml_data __pyx_mstate_global->__pyx_n_s_xml_data
#define __pyx_n_s_xml_declaration __pyx_mstate_global->__pyx_n_s_xml_declaration
#define __pyx_kp_u_xml_s_encoding_s_s_s __pyx_mstate_global->__pyx_kp_u_xml_s_encoding_s_s_s
#define __pyx_kp_u_xml_xml __pyx_mstate_global->__pyx_kp_u_xml_xml
#define __pyx_n_s_xmlfile __pyx_mstate_global->__pyx_n_s_xmlfile
#define __pyx_n_s_xmlfile___aenter __pyx_mstate_global->__pyx_n_s_xmlfile___aenter
#define __pyx_n_s_xmlfile___aexit __pyx_mstate_global->__pyx_n_s_xmlfile___aexit
#define __pyx_n_s_xmlfile___enter __pyx_mstate_global->__pyx_n_s_xmlfile___enter
#define __pyx_n_s_xmlfile___exit __pyx_mstate_global->__pyx_n_s_xmlfile___exit
#define __pyx_kp_u_xmlns __pyx_mstate_global->__pyx_kp_u_xmlns
#define __pyx_n_b_xmlns_2 __pyx_mstate_global->__pyx_n_b_xmlns_2
#define __pyx_n_u_xmlns_2 __pyx_mstate_global->__pyx_n_u_xmlns_2
#define __pyx_n_s_xmlschema __pyx_mstate_global->__pyx_n_s_xmlschema
#define __pyx_n_s_xpath __pyx_mstate_global->__pyx_n_s_xpath
#define __pyx_n_s_xpath_name __pyx_mstate_global->__pyx_n_s_xpath_name
#define __pyx_n_s_xrange __pyx_mstate_global->__pyx_n_s_xrange
#define __pyx_n_b_xs __pyx_mstate_global->__pyx_n_b_xs
#define __pyx_n_u_xs __pyx_mstate_global->__pyx_n_u_xs
#define __pyx_n_b_xsi __pyx_mstate_global->__pyx_n_b_xsi
#define __pyx_n_b_xsl __pyx_mstate_global->__pyx_n_b_xsl
#define __pyx_n_u_xsl __pyx_mstate_global->__pyx_n_u_xsl
#define __pyx_kp_u_xsl_stylesheet_xml_id_id __pyx_mstate_global->__pyx_kp_u_xsl_stylesheet_xml_id_id
#define __pyx_n_s_xslt __pyx_mstate_global->__pyx_n_s_xslt
#define __pyx_kp_u_xslt_2 __pyx_mstate_global->__pyx_kp_u_xslt_2
#define __pyx_n_s_xslt_3 __pyx_mstate_global->__pyx_n_s_xslt_3
#define __pyx_n_s_xslt_input __pyx_mstate_global->__pyx_n_s_xslt_input
#define __pyx_n_s_zf __pyx_mstate_global->__pyx_n_s_zf
#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2
#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3
#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4
#define __pyx_int_5 __pyx_mstate_global->__pyx_int_5
#define __pyx_int_100 __pyx_mstate_global->__pyx_int_100
#define __pyx_int_32768 __pyx_mstate_global->__pyx_int_32768
#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
#define __pyx_int_neg_4 __pyx_mstate_global->__pyx_int_neg_4
#define __pyx_int_neg_100 __pyx_mstate_global->__pyx_int_neg_100
#define __pyx_int_neg_200 __pyx_mstate_global->__pyx_int_neg_200
#define __pyx_int_neg_300 __pyx_mstate_global->__pyx_int_neg_300
#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
#define __pyx_slice__6 __pyx_mstate_global->__pyx_slice__6
#define __pyx_slice__7 __pyx_mstate_global->__pyx_slice__7
#define __pyx_slice__8 __pyx_mstate_global->__pyx_slice__8
#define __pyx_slice__9 __pyx_mstate_global->__pyx_slice__9
#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
#define __pyx_slice__44 __pyx_mstate_global->__pyx_slice__44
#define __pyx_slice__55 __pyx_mstate_global->__pyx_slice__55
#define __pyx_slice__69 __pyx_mstate_global->__pyx_slice__69
#define __pyx_slice__80 __pyx_mstate_global->__pyx_slice__80
#define __pyx_slice__81 __pyx_mstate_global->__pyx_slice__81
#define __pyx_slice__93 __pyx_mstate_global->__pyx_slice__93
#define __pyx_slice__94 __pyx_mstate_global->__pyx_slice__94
#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10
#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14
#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23
#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31
#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36
#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37
#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38
#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39
#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40
#define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46
#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47
#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49
#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51
#define __pyx_tuple__53 __pyx_mstate_global->__pyx_tuple__53
#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54
#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58
#define __pyx_tuple__59 __pyx_mstate_global->__pyx_tuple__59
#define __pyx_tuple__60 __pyx_mstate_global->__pyx_tuple__60
#define __pyx_tuple__64 __pyx_mstate_global->__pyx_tuple__64
#define __pyx_tuple__65 __pyx_mstate_global->__pyx_tuple__65
#define __pyx_tuple__66 __pyx_mstate_global->__pyx_tuple__66
#define __pyx_tuple__68 __pyx_mstate_global->__pyx_tuple__68
#define __pyx_tuple__70 __pyx_mstate_global->__pyx_tuple__70
#define __pyx_tuple__77 __pyx_mstate_global->__pyx_tuple__77
#define __pyx_tuple__78 __pyx_mstate_global->__pyx_tuple__78
#define __pyx_tuple__91 __pyx_mstate_global->__pyx_tuple__91
#define __pyx_tuple__92 __pyx_mstate_global->__pyx_tuple__92
#define __pyx_tuple__97 __pyx_mstate_global->__pyx_tuple__97
#define __pyx_tuple__98 __pyx_mstate_global->__pyx_tuple__98
#define __pyx_slice__105 __pyx_mstate_global->__pyx_slice__105
#define __pyx_tuple__103 __pyx_mstate_global->__pyx_tuple__103
#define __pyx_tuple__104 __pyx_mstate_global->__pyx_tuple__104
#define __pyx_tuple__107 __pyx_mstate_global->__pyx_tuple__107
#define __pyx_tuple__109 __pyx_mstate_global->__pyx_tuple__109
#define __pyx_tuple__113 __pyx_mstate_global->__pyx_tuple__113
#define __pyx_tuple__116 __pyx_mstate_global->__pyx_tuple__116
#define __pyx_tuple__117 __pyx_mstate_global->__pyx_tuple__117
#define __pyx_tuple__118 __pyx_mstate_global->__pyx_tuple__118
#define __pyx_tuple__120 __pyx_mstate_global->__pyx_tuple__120
#define __pyx_tuple__123 __pyx_mstate_global->__pyx_tuple__123
#define __pyx_tuple__126 __pyx_mstate_global->__pyx_tuple__126
#define __pyx_tuple__128 __pyx_mstate_global->__pyx_tuple__128
#define __pyx_tuple__130 __pyx_mstate_global->__pyx_tuple__130
#define __pyx_tuple__132 __pyx_mstate_global->__pyx_tuple__132
#define __pyx_tuple__137 __pyx_mstate_global->__pyx_tuple__137
#define __pyx_tuple__145 __pyx_mstate_global->__pyx_tuple__145
#define __pyx_tuple__147 __pyx_mstate_global->__pyx_tuple__147
#define __pyx_tuple__149 __pyx_mstate_global->__pyx_tuple__149
#define __pyx_tuple__151 __pyx_mstate_global->__pyx_tuple__151
#define __pyx_tuple__152 __pyx_mstate_global->__pyx_tuple__152
#define __pyx_tuple__153 __pyx_mstate_global->__pyx_tuple__153
#define __pyx_tuple__154 __pyx_mstate_global->__pyx_tuple__154
#define __pyx_tuple__155 __pyx_mstate_global->__pyx_tuple__155
#define __pyx_tuple__156 __pyx_mstate_global->__pyx_tuple__156
#define __pyx_tuple__157 __pyx_mstate_global->__pyx_tuple__157
#define __pyx_tuple__158 __pyx_mstate_global->__pyx_tuple__158
#define __pyx_tuple__159 __pyx_mstate_global->__pyx_tuple__159
#define __pyx_tuple__160 __pyx_mstate_global->__pyx_tuple__160
#define __pyx_tuple__163 __pyx_mstate_global->__pyx_tuple__163
#define __pyx_tuple__165 __pyx_mstate_global->__pyx_tuple__165
#define __pyx_tuple__168 __pyx_mstate_global->__pyx_tuple__168
#define __pyx_tuple__172 __pyx_mstate_global->__pyx_tuple__172
#define __pyx_tuple__174 __pyx_mstate_global->__pyx_tuple__174
#define __pyx_tuple__176 __pyx_mstate_global->__pyx_tuple__176
#define __pyx_tuple__177 __pyx_mstate_global->__pyx_tuple__177
#define __pyx_tuple__179 __pyx_mstate_global->__pyx_tuple__179
#define __pyx_tuple__181 __pyx_mstate_global->__pyx_tuple__181
#define __pyx_tuple__184 __pyx_mstate_global->__pyx_tuple__184
#define __pyx_tuple__186 __pyx_mstate_global->__pyx_tuple__186
#define __pyx_tuple__187 __pyx_mstate_global->__pyx_tuple__187
#define __pyx_tuple__189 __pyx_mstate_global->__pyx_tuple__189
#define __pyx_tuple__194 __pyx_mstate_global->__pyx_tuple__194
#define __pyx_tuple__198 __pyx_mstate_global->__pyx_tuple__198
#define __pyx_tuple__200 __pyx_mstate_global->__pyx_tuple__200
#define __pyx_tuple__203 __pyx_mstate_global->__pyx_tuple__203
#define __pyx_tuple__208 __pyx_mstate_global->__pyx_tuple__208
#define __pyx_tuple__210 __pyx_mstate_global->__pyx_tuple__210
#define __pyx_tuple__212 __pyx_mstate_global->__pyx_tuple__212
#define __pyx_tuple__214 __pyx_mstate_global->__pyx_tuple__214
#define __pyx_tuple__218 __pyx_mstate_global->__pyx_tuple__218
#define __pyx_tuple__220 __pyx_mstate_global->__pyx_tuple__220
#define __pyx_tuple__223 __pyx_mstate_global->__pyx_tuple__223
#define __pyx_tuple__225 __pyx_mstate_global->__pyx_tuple__225
#define __pyx_tuple__232 __pyx_mstate_global->__pyx_tuple__232
#define __pyx_tuple__234 __pyx_mstate_global->__pyx_tuple__234
#define __pyx_tuple__238 __pyx_mstate_global->__pyx_tuple__238
#define __pyx_tuple__240 __pyx_mstate_global->__pyx_tuple__240
#define __pyx_tuple__242 __pyx_mstate_global->__pyx_tuple__242
#define __pyx_tuple__244 __pyx_mstate_global->__pyx_tuple__244
#define __pyx_tuple__246 __pyx_mstate_global->__pyx_tuple__246
#define __pyx_tuple__249 __pyx_mstate_global->__pyx_tuple__249
#define __pyx_tuple__251 __pyx_mstate_global->__pyx_tuple__251
#define __pyx_tuple__256 __pyx_mstate_global->__pyx_tuple__256
#define __pyx_tuple__258 __pyx_mstate_global->__pyx_tuple__258
#define __pyx_tuple__260 __pyx_mstate_global->__pyx_tuple__260
#define __pyx_tuple__263 __pyx_mstate_global->__pyx_tuple__263
#define __pyx_tuple__265 __pyx_mstate_global->__pyx_tuple__265
#define __pyx_tuple__267 __pyx_mstate_global->__pyx_tuple__267
#define __pyx_tuple__269 __pyx_mstate_global->__pyx_tuple__269
#define __pyx_tuple__281 __pyx_mstate_global->__pyx_tuple__281
#define __pyx_tuple__283 __pyx_mstate_global->__pyx_tuple__283
#define __pyx_tuple__285 __pyx_mstate_global->__pyx_tuple__285
#define __pyx_tuple__287 __pyx_mstate_global->__pyx_tuple__287
#define __pyx_tuple__289 __pyx_mstate_global->__pyx_tuple__289
#define __pyx_tuple__291 __pyx_mstate_global->__pyx_tuple__291
#define __pyx_tuple__293 __pyx_mstate_global->__pyx_tuple__293
#define __pyx_tuple__297 __pyx_mstate_global->__pyx_tuple__297
#define __pyx_tuple__299 __pyx_mstate_global->__pyx_tuple__299
#define __pyx_tuple__301 __pyx_mstate_global->__pyx_tuple__301
#define __pyx_tuple__303 __pyx_mstate_global->__pyx_tuple__303
#define __pyx_tuple__304 __pyx_mstate_global->__pyx_tuple__304
#define __pyx_tuple__306 __pyx_mstate_global->__pyx_tuple__306
#define __pyx_tuple__308 __pyx_mstate_global->__pyx_tuple__308
#define __pyx_tuple__310 __pyx_mstate_global->__pyx_tuple__310
#define __pyx_tuple__312 __pyx_mstate_global->__pyx_tuple__312
#define __pyx_tuple__314 __pyx_mstate_global->__pyx_tuple__314
#define __pyx_tuple__318 __pyx_mstate_global->__pyx_tuple__318
#define __pyx_tuple__321 __pyx_mstate_global->__pyx_tuple__321
#define __pyx_tuple__329 __pyx_mstate_global->__pyx_tuple__329
#define __pyx_tuple__334 __pyx_mstate_global->__pyx_tuple__334
#define __pyx_tuple__336 __pyx_mstate_global->__pyx_tuple__336
#define __pyx_tuple__338 __pyx_mstate_global->__pyx_tuple__338
#define __pyx_tuple__340 __pyx_mstate_global->__pyx_tuple__340
#define __pyx_tuple__342 __pyx_mstate_global->__pyx_tuple__342
#define __pyx_tuple__347 __pyx_mstate_global->__pyx_tuple__347
#define __pyx_tuple__349 __pyx_mstate_global->__pyx_tuple__349
#define __pyx_tuple__351 __pyx_mstate_global->__pyx_tuple__351
#define __pyx_tuple__353 __pyx_mstate_global->__pyx_tuple__353
#define __pyx_tuple__355 __pyx_mstate_global->__pyx_tuple__355
#define __pyx_tuple__357 __pyx_mstate_global->__pyx_tuple__357
#define __pyx_tuple__359 __pyx_mstate_global->__pyx_tuple__359
#define __pyx_tuple__361 __pyx_mstate_global->__pyx_tuple__361
#define __pyx_tuple__363 __pyx_mstate_global->__pyx_tuple__363
#define __pyx_tuple__367 __pyx_mstate_global->__pyx_tuple__367
#define __pyx_tuple__369 __pyx_mstate_global->__pyx_tuple__369
#define __pyx_tuple__372 __pyx_mstate_global->__pyx_tuple__372
#define __pyx_tuple__377 __pyx_mstate_global->__pyx_tuple__377
#define __pyx_tuple__381 __pyx_mstate_global->__pyx_tuple__381
#define __pyx_tuple__385 __pyx_mstate_global->__pyx_tuple__385
#define __pyx_tuple__389 __pyx_mstate_global->__pyx_tuple__389
#define __pyx_tuple__391 __pyx_mstate_global->__pyx_tuple__391
#define __pyx_tuple__393 __pyx_mstate_global->__pyx_tuple__393
#define __pyx_tuple__395 __pyx_mstate_global->__pyx_tuple__395
#define __pyx_tuple__397 __pyx_mstate_global->__pyx_tuple__397
#define __pyx_tuple__399 __pyx_mstate_global->__pyx_tuple__399
#define __pyx_tuple__400 __pyx_mstate_global->__pyx_tuple__400
#define __pyx_tuple__401 __pyx_mstate_global->__pyx_tuple__401
#define __pyx_tuple__403 __pyx_mstate_global->__pyx_tuple__403
#define __pyx_tuple__405 __pyx_mstate_global->__pyx_tuple__405
#define __pyx_tuple__407 __pyx_mstate_global->__pyx_tuple__407
#define __pyx_tuple__409 __pyx_mstate_global->__pyx_tuple__409
#define __pyx_tuple__411 __pyx_mstate_global->__pyx_tuple__411
#define __pyx_tuple__416 __pyx_mstate_global->__pyx_tuple__416
#define __pyx_tuple__418 __pyx_mstate_global->__pyx_tuple__418
#define __pyx_tuple__420 __pyx_mstate_global->__pyx_tuple__420
#define __pyx_tuple__422 __pyx_mstate_global->__pyx_tuple__422
#define __pyx_tuple__424 __pyx_mstate_global->__pyx_tuple__424
#define __pyx_tuple__426 __pyx_mstate_global->__pyx_tuple__426
#define __pyx_tuple__431 __pyx_mstate_global->__pyx_tuple__431
#define __pyx_tuple__432 __pyx_mstate_global->__pyx_tuple__432
#define __pyx_tuple__433 __pyx_mstate_global->__pyx_tuple__433
#define __pyx_tuple__434 __pyx_mstate_global->__pyx_tuple__434
#define __pyx_tuple__436 __pyx_mstate_global->__pyx_tuple__436
#define __pyx_tuple__438 __pyx_mstate_global->__pyx_tuple__438
#define __pyx_tuple__439 __pyx_mstate_global->__pyx_tuple__439
#define __pyx_tuple__441 __pyx_mstate_global->__pyx_tuple__441
#define __pyx_tuple__448 __pyx_mstate_global->__pyx_tuple__448
#define __pyx_tuple__450 __pyx_mstate_global->__pyx_tuple__450
#define __pyx_tuple__452 __pyx_mstate_global->__pyx_tuple__452
#define __pyx_tuple__455 __pyx_mstate_global->__pyx_tuple__455
#define __pyx_tuple__462 __pyx_mstate_global->__pyx_tuple__462
#define __pyx_tuple__465 __pyx_mstate_global->__pyx_tuple__465
#define __pyx_tuple__467 __pyx_mstate_global->__pyx_tuple__467
#define __pyx_tuple__469 __pyx_mstate_global->__pyx_tuple__469
#define __pyx_tuple__471 __pyx_mstate_global->__pyx_tuple__471
#define __pyx_tuple__473 __pyx_mstate_global->__pyx_tuple__473
#define __pyx_tuple__474 __pyx_mstate_global->__pyx_tuple__474
#define __pyx_tuple__476 __pyx_mstate_global->__pyx_tuple__476
#define __pyx_tuple__478 __pyx_mstate_global->__pyx_tuple__478
#define __pyx_tuple__479 __pyx_mstate_global->__pyx_tuple__479
#define __pyx_tuple__481 __pyx_mstate_global->__pyx_tuple__481
#define __pyx_tuple__485 __pyx_mstate_global->__pyx_tuple__485
#define __pyx_tuple__487 __pyx_mstate_global->__pyx_tuple__487
#define __pyx_tuple__490 __pyx_mstate_global->__pyx_tuple__490
#define __pyx_tuple__492 __pyx_mstate_global->__pyx_tuple__492
#define __pyx_tuple__493 __pyx_mstate_global->__pyx_tuple__493
#define __pyx_tuple__495 __pyx_mstate_global->__pyx_tuple__495
#define __pyx_tuple__497 __pyx_mstate_global->__pyx_tuple__497
#define __pyx_tuple__501 __pyx_mstate_global->__pyx_tuple__501
#define __pyx_tuple__503 __pyx_mstate_global->__pyx_tuple__503
#define __pyx_tuple__504 __pyx_mstate_global->__pyx_tuple__504
#define __pyx_tuple__506 __pyx_mstate_global->__pyx_tuple__506
#define __pyx_tuple__508 __pyx_mstate_global->__pyx_tuple__508
#define __pyx_tuple__510 __pyx_mstate_global->__pyx_tuple__510
#define __pyx_tuple__512 __pyx_mstate_global->__pyx_tuple__512
#define __pyx_tuple__514 __pyx_mstate_global->__pyx_tuple__514
#define __pyx_tuple__518 __pyx_mstate_global->__pyx_tuple__518
#define __pyx_tuple__522 __pyx_mstate_global->__pyx_tuple__522
#define __pyx_tuple__526 __pyx_mstate_global->__pyx_tuple__526
#define __pyx_tuple__528 __pyx_mstate_global->__pyx_tuple__528
#define __pyx_tuple__531 __pyx_mstate_global->__pyx_tuple__531
#define __pyx_tuple__533 __pyx_mstate_global->__pyx_tuple__533
#define __pyx_tuple__535 __pyx_mstate_global->__pyx_tuple__535
#define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62
#define __pyx_codeobj__67 __pyx_mstate_global->__pyx_codeobj__67
#define __pyx_codeobj__76 __pyx_mstate_global->__pyx_codeobj__76
#define __pyx_codeobj__79 __pyx_mstate_global->__pyx_codeobj__79
#define __pyx_codeobj__82 __pyx_mstate_global->__pyx_codeobj__82
#define __pyx_codeobj__83 __pyx_mstate_global->__pyx_codeobj__83
#define __pyx_codeobj__84 __pyx_mstate_global->__pyx_codeobj__84
#define __pyx_codeobj__85 __pyx_mstate_global->__pyx_codeobj__85
#define __pyx_codeobj__86 __pyx_mstate_global->__pyx_codeobj__86
#define __pyx_codeobj__87 __pyx_mstate_global->__pyx_codeobj__87
#define __pyx_codeobj__88 __pyx_mstate_global->__pyx_codeobj__88
#define __pyx_codeobj__89 __pyx_mstate_global->__pyx_codeobj__89
#define __pyx_codeobj__90 __pyx_mstate_global->__pyx_codeobj__90
#define __pyx_codeobj__99 __pyx_mstate_global->__pyx_codeobj__99
#define __pyx_codeobj__100 __pyx_mstate_global->__pyx_codeobj__100
#define __pyx_codeobj__101 __pyx_mstate_global->__pyx_codeobj__101
#define __pyx_codeobj__102 __pyx_mstate_global->__pyx_codeobj__102
#define __pyx_codeobj__108 __pyx_mstate_global->__pyx_codeobj__108
#define __pyx_codeobj__110 __pyx_mstate_global->__pyx_codeobj__110
#define __pyx_codeobj__111 __pyx_mstate_global->__pyx_codeobj__111
#define __pyx_codeobj__112 __pyx_mstate_global->__pyx_codeobj__112
#define __pyx_codeobj__114 __pyx_mstate_global->__pyx_codeobj__114
#define __pyx_codeobj__115 __pyx_mstate_global->__pyx_codeobj__115
#define __pyx_codeobj__119 __pyx_mstate_global->__pyx_codeobj__119
#define __pyx_codeobj__121 __pyx_mstate_global->__pyx_codeobj__121
#define __pyx_codeobj__122 __pyx_mstate_global->__pyx_codeobj__122
#define __pyx_codeobj__124 __pyx_mstate_global->__pyx_codeobj__124
#define __pyx_codeobj__125 __pyx_mstate_global->__pyx_codeobj__125
#define __pyx_codeobj__127 __pyx_mstate_global->__pyx_codeobj__127
#define __pyx_codeobj__129 __pyx_mstate_global->__pyx_codeobj__129
#define __pyx_codeobj__131 __pyx_mstate_global->__pyx_codeobj__131
#define __pyx_codeobj__133 __pyx_mstate_global->__pyx_codeobj__133
#define __pyx_codeobj__134 __pyx_mstate_global->__pyx_codeobj__134
#define __pyx_codeobj__135 __pyx_mstate_global->__pyx_codeobj__135
#define __pyx_codeobj__136 __pyx_mstate_global->__pyx_codeobj__136
#define __pyx_codeobj__138 __pyx_mstate_global->__pyx_codeobj__138
#define __pyx_codeobj__139 __pyx_mstate_global->__pyx_codeobj__139
#define __pyx_codeobj__140 __pyx_mstate_global->__pyx_codeobj__140
#define __pyx_codeobj__141 __pyx_mstate_global->__pyx_codeobj__141
#define __pyx_codeobj__142 __pyx_mstate_global->__pyx_codeobj__142
#define __pyx_codeobj__143 __pyx_mstate_global->__pyx_codeobj__143
#define __pyx_codeobj__144 __pyx_mstate_global->__pyx_codeobj__144
#define __pyx_codeobj__146 __pyx_mstate_global->__pyx_codeobj__146
#define __pyx_codeobj__148 __pyx_mstate_global->__pyx_codeobj__148
#define __pyx_codeobj__150 __pyx_mstate_global->__pyx_codeobj__150
#define __pyx_codeobj__161 __pyx_mstate_global->__pyx_codeobj__161
#define __pyx_codeobj__162 __pyx_mstate_global->__pyx_codeobj__162
#define __pyx_codeobj__164 __pyx_mstate_global->__pyx_codeobj__164
#define __pyx_codeobj__166 __pyx_mstate_global->__pyx_codeobj__166
#define __pyx_codeobj__167 __pyx_mstate_global->__pyx_codeobj__167
#define __pyx_codeobj__169 __pyx_mstate_global->__pyx_codeobj__169
#define __pyx_codeobj__170 __pyx_mstate_global->__pyx_codeobj__170
#define __pyx_codeobj__171 __pyx_mstate_global->__pyx_codeobj__171
#define __pyx_codeobj__173 __pyx_mstate_global->__pyx_codeobj__173
#define __pyx_codeobj__175 __pyx_mstate_global->__pyx_codeobj__175
#define __pyx_codeobj__178 __pyx_mstate_global->__pyx_codeobj__178
#define __pyx_codeobj__180 __pyx_mstate_global->__pyx_codeobj__180
#define __pyx_codeobj__182 __pyx_mstate_global->__pyx_codeobj__182
#define __pyx_codeobj__183 __pyx_mstate_global->__pyx_codeobj__183
#define __pyx_codeobj__185 __pyx_mstate_global->__pyx_codeobj__185
#define __pyx_codeobj__188 __pyx_mstate_global->__pyx_codeobj__188
#define __pyx_codeobj__190 __pyx_mstate_global->__pyx_codeobj__190
#define __pyx_codeobj__191 __pyx_mstate_global->__pyx_codeobj__191
#define __pyx_codeobj__192 __pyx_mstate_global->__pyx_codeobj__192
#define __pyx_codeobj__193 __pyx_mstate_global->__pyx_codeobj__193
#define __pyx_codeobj__195 __pyx_mstate_global->__pyx_codeobj__195
#define __pyx_codeobj__196 __pyx_mstate_global->__pyx_codeobj__196
#define __pyx_codeobj__197 __pyx_mstate_global->__pyx_codeobj__197
#define __pyx_codeobj__199 __pyx_mstate_global->__pyx_codeobj__199
#define __pyx_codeobj__201 __pyx_mstate_global->__pyx_codeobj__201
#define __pyx_codeobj__202 __pyx_mstate_global->__pyx_codeobj__202
#define __pyx_codeobj__204 __pyx_mstate_global->__pyx_codeobj__204
#define __pyx_codeobj__205 __pyx_mstate_global->__pyx_codeobj__205
#define __pyx_codeobj__206 __pyx_mstate_global->__pyx_codeobj__206
#define __pyx_codeobj__207 __pyx_mstate_global->__pyx_codeobj__207
#define __pyx_codeobj__209 __pyx_mstate_global->__pyx_codeobj__209
#define __pyx_codeobj__211 __pyx_mstate_global->__pyx_codeobj__211
#define __pyx_codeobj__213 __pyx_mstate_global->__pyx_codeobj__213
#define __pyx_codeobj__215 __pyx_mstate_global->__pyx_codeobj__215
#define __pyx_codeobj__216 __pyx_mstate_global->__pyx_codeobj__216
#define __pyx_codeobj__217 __pyx_mstate_global->__pyx_codeobj__217
#define __pyx_codeobj__219 __pyx_mstate_global->__pyx_codeobj__219
#define __pyx_codeobj__221 __pyx_mstate_global->__pyx_codeobj__221
#define __pyx_codeobj__222 __pyx_mstate_global->__pyx_codeobj__222
#define __pyx_codeobj__224 __pyx_mstate_global->__pyx_codeobj__224
#define __pyx_codeobj__226 __pyx_mstate_global->__pyx_codeobj__226
#define __pyx_codeobj__227 __pyx_mstate_global->__pyx_codeobj__227
#define __pyx_codeobj__228 __pyx_mstate_global->__pyx_codeobj__228
#define __pyx_codeobj__229 __pyx_mstate_global->__pyx_codeobj__229
#define __pyx_codeobj__230 __pyx_mstate_global->__pyx_codeobj__230
#define __pyx_codeobj__231 __pyx_mstate_global->__pyx_codeobj__231
#define __pyx_codeobj__233 __pyx_mstate_global->__pyx_codeobj__233
#define __pyx_codeobj__235 __pyx_mstate_global->__pyx_codeobj__235
#define __pyx_codeobj__236 __pyx_mstate_global->__pyx_codeobj__236
#define __pyx_codeobj__237 __pyx_mstate_global->__pyx_codeobj__237
#define __pyx_codeobj__239 __pyx_mstate_global->__pyx_codeobj__239
#define __pyx_codeobj__241 __pyx_mstate_global->__pyx_codeobj__241
#define __pyx_codeobj__243 __pyx_mstate_global->__pyx_codeobj__243
#define __pyx_codeobj__245 __pyx_mstate_global->__pyx_codeobj__245
#define __pyx_codeobj__247 __pyx_mstate_global->__pyx_codeobj__247
#define __pyx_codeobj__248 __pyx_mstate_global->__pyx_codeobj__248
#define __pyx_codeobj__250 __pyx_mstate_global->__pyx_codeobj__250
#define __pyx_codeobj__252 __pyx_mstate_global->__pyx_codeobj__252
#define __pyx_codeobj__253 __pyx_mstate_global->__pyx_codeobj__253
#define __pyx_codeobj__254 __pyx_mstate_global->__pyx_codeobj__254
#define __pyx_codeobj__255 __pyx_mstate_global->__pyx_codeobj__255
#define __pyx_codeobj__257 __pyx_mstate_global->__pyx_codeobj__257
#define __pyx_codeobj__259 __pyx_mstate_global->__pyx_codeobj__259
#define __pyx_codeobj__261 __pyx_mstate_global->__pyx_codeobj__261
#define __pyx_codeobj__262 __pyx_mstate_global->__pyx_codeobj__262
#define __pyx_codeobj__264 __pyx_mstate_global->__pyx_codeobj__264
#define __pyx_codeobj__266 __pyx_mstate_global->__pyx_codeobj__266
#define __pyx_codeobj__268 __pyx_mstate_global->__pyx_codeobj__268
#define __pyx_codeobj__270 __pyx_mstate_global->__pyx_codeobj__270
#define __pyx_codeobj__271 __pyx_mstate_global->__pyx_codeobj__271
#define __pyx_codeobj__272 __pyx_mstate_global->__pyx_codeobj__272
#define __pyx_codeobj__273 __pyx_mstate_global->__pyx_codeobj__273
#define __pyx_codeobj__274 __pyx_mstate_global->__pyx_codeobj__274
#define __pyx_codeobj__275 __pyx_mstate_global->__pyx_codeobj__275
#define __pyx_codeobj__276 __pyx_mstate_global->__pyx_codeobj__276
#define __pyx_codeobj__277 __pyx_mstate_global->__pyx_codeobj__277
#define __pyx_codeobj__278 __pyx_mstate_global->__pyx_codeobj__278
#define __pyx_codeobj__279 __pyx_mstate_global->__pyx_codeobj__279
#define __pyx_codeobj__280 __pyx_mstate_global->__pyx_codeobj__280
#define __pyx_codeobj__282 __pyx_mstate_global->__pyx_codeobj__282
#define __pyx_codeobj__284 __pyx_mstate_global->__pyx_codeobj__284
#define __pyx_codeobj__286 __pyx_mstate_global->__pyx_codeobj__286
#define __pyx_codeobj__288 __pyx_mstate_global->__pyx_codeobj__288
#define __pyx_codeobj__290 __pyx_mstate_global->__pyx_codeobj__290
#define __pyx_codeobj__292 __pyx_mstate_global->__pyx_codeobj__292
#define __pyx_codeobj__294 __pyx_mstate_global->__pyx_codeobj__294
#define __pyx_codeobj__295 __pyx_mstate_global->__pyx_codeobj__295
#define __pyx_codeobj__296 __pyx_mstate_global->__pyx_codeobj__296
#define __pyx_codeobj__298 __pyx_mstate_global->__pyx_codeobj__298
#define __pyx_codeobj__300 __pyx_mstate_global->__pyx_codeobj__300
#define __pyx_codeobj__302 __pyx_mstate_global->__pyx_codeobj__302
#define __pyx_codeobj__305 __pyx_mstate_global->__pyx_codeobj__305
#define __pyx_codeobj__307 __pyx_mstate_global->__pyx_codeobj__307
#define __pyx_codeobj__309 __pyx_mstate_global->__pyx_codeobj__309
#define __pyx_codeobj__311 __pyx_mstate_global->__pyx_codeobj__311
#define __pyx_codeobj__313 __pyx_mstate_global->__pyx_codeobj__313
#define __pyx_codeobj__315 __pyx_mstate_global->__pyx_codeobj__315
#define __pyx_codeobj__316 __pyx_mstate_global->__pyx_codeobj__316
#define __pyx_codeobj__317 __pyx_mstate_global->__pyx_codeobj__317
#define __pyx_codeobj__319 __pyx_mstate_global->__pyx_codeobj__319
#define __pyx_codeobj__320 __pyx_mstate_global->__pyx_codeobj__320
#define __pyx_codeobj__322 __pyx_mstate_global->__pyx_codeobj__322
#define __pyx_codeobj__323 __pyx_mstate_global->__pyx_codeobj__323
#define __pyx_codeobj__324 __pyx_mstate_global->__pyx_codeobj__324
#define __pyx_codeobj__325 __pyx_mstate_global->__pyx_codeobj__325
#define __pyx_codeobj__326 __pyx_mstate_global->__pyx_codeobj__326
#define __pyx_codeobj__327 __pyx_mstate_global->__pyx_codeobj__327
#define __pyx_codeobj__328 __pyx_mstate_global->__pyx_codeobj__328
#define __pyx_codeobj__330 __pyx_mstate_global->__pyx_codeobj__330
#define __pyx_codeobj__331 __pyx_mstate_global->__pyx_codeobj__331
#define __pyx_codeobj__332 __pyx_mstate_global->__pyx_codeobj__332
#define __pyx_codeobj__333 __pyx_mstate_global->__pyx_codeobj__333
#define __pyx_codeobj__335 __pyx_mstate_global->__pyx_codeobj__335
#define __pyx_codeobj__337 __pyx_mstate_global->__pyx_codeobj__337
#define __pyx_codeobj__339 __pyx_mstate_global->__pyx_codeobj__339
#define __pyx_codeobj__341 __pyx_mstate_global->__pyx_codeobj__341
#define __pyx_codeobj__343 __pyx_mstate_global->__pyx_codeobj__343
#define __pyx_codeobj__344 __pyx_mstate_global->__pyx_codeobj__344
#define __pyx_codeobj__345 __pyx_mstate_global->__pyx_codeobj__345
#define __pyx_codeobj__346 __pyx_mstate_global->__pyx_codeobj__346
#define __pyx_codeobj__348 __pyx_mstate_global->__pyx_codeobj__348
#define __pyx_codeobj__350 __pyx_mstate_global->__pyx_codeobj__350
#define __pyx_codeobj__352 __pyx_mstate_global->__pyx_codeobj__352
#define __pyx_codeobj__354 __pyx_mstate_global->__pyx_codeobj__354
#define __pyx_codeobj__356 __pyx_mstate_global->__pyx_codeobj__356
#define __pyx_codeobj__358 __pyx_mstate_global->__pyx_codeobj__358
#define __pyx_codeobj__360 __pyx_mstate_global->__pyx_codeobj__360
#define __pyx_codeobj__362 __pyx_mstate_global->__pyx_codeobj__362
#define __pyx_codeobj__364 __pyx_mstate_global->__pyx_codeobj__364
#define __pyx_codeobj__365 __pyx_mstate_global->__pyx_codeobj__365
#define __pyx_codeobj__366 __pyx_mstate_global->__pyx_codeobj__366
#define __pyx_codeobj__368 __pyx_mstate_global->__pyx_codeobj__368
#define __pyx_codeobj__370 __pyx_mstate_global->__pyx_codeobj__370
#define __pyx_codeobj__371 __pyx_mstate_global->__pyx_codeobj__371
#define __pyx_codeobj__373 __pyx_mstate_global->__pyx_codeobj__373
#define __pyx_codeobj__374 __pyx_mstate_global->__pyx_codeobj__374
#define __pyx_codeobj__375 __pyx_mstate_global->__pyx_codeobj__375
#define __pyx_codeobj__376 __pyx_mstate_global->__pyx_codeobj__376
#define __pyx_codeobj__378 __pyx_mstate_global->__pyx_codeobj__378
#define __pyx_codeobj__379 __pyx_mstate_global->__pyx_codeobj__379
#define __pyx_codeobj__380 __pyx_mstate_global->__pyx_codeobj__380
#define __pyx_codeobj__382 __pyx_mstate_global->__pyx_codeobj__382
#define __pyx_codeobj__383 __pyx_mstate_global->__pyx_codeobj__383
#define __pyx_codeobj__384 __pyx_mstate_global->__pyx_codeobj__384
#define __pyx_codeobj__386 __pyx_mstate_global->__pyx_codeobj__386
#define __pyx_codeobj__387 __pyx_mstate_global->__pyx_codeobj__387
#define __pyx_codeobj__388 __pyx_mstate_global->__pyx_codeobj__388
#define __pyx_codeobj__390 __pyx_mstate_global->__pyx_codeobj__390
#define __pyx_codeobj__392 __pyx_mstate_global->__pyx_codeobj__392
#define __pyx_codeobj__394 __pyx_mstate_global->__pyx_codeobj__394
#define __pyx_codeobj__396 __pyx_mstate_global->__pyx_codeobj__396
#define __pyx_codeobj__398 __pyx_mstate_global->__pyx_codeobj__398
#define __pyx_codeobj__402 __pyx_mstate_global->__pyx_codeobj__402
#define __pyx_codeobj__404 __pyx_mstate_global->__pyx_codeobj__404
#define __pyx_codeobj__406 __pyx_mstate_global->__pyx_codeobj__406
#define __pyx_codeobj__408 __pyx_mstate_global->__pyx_codeobj__408
#define __pyx_codeobj__410 __pyx_mstate_global->__pyx_codeobj__410
#define __pyx_codeobj__412 __pyx_mstate_global->__pyx_codeobj__412
#define __pyx_codeobj__413 __pyx_mstate_global->__pyx_codeobj__413
#define __pyx_codeobj__414 __pyx_mstate_global->__pyx_codeobj__414
#define __pyx_codeobj__415 __pyx_mstate_global->__pyx_codeobj__415
#define __pyx_codeobj__417 __pyx_mstate_global->__pyx_codeobj__417
#define __pyx_codeobj__419 __pyx_mstate_global->__pyx_codeobj__419
#define __pyx_codeobj__421 __pyx_mstate_global->__pyx_codeobj__421
#define __pyx_codeobj__423 __pyx_mstate_global->__pyx_codeobj__423
#define __pyx_codeobj__425 __pyx_mstate_global->__pyx_codeobj__425
#define __pyx_codeobj__427 __pyx_mstate_global->__pyx_codeobj__427
#define __pyx_codeobj__428 __pyx_mstate_global->__pyx_codeobj__428
#define __pyx_codeobj__429 __pyx_mstate_global->__pyx_codeobj__429
#define __pyx_codeobj__430 __pyx_mstate_global->__pyx_codeobj__430
#define __pyx_codeobj__435 __pyx_mstate_global->__pyx_codeobj__435
#define __pyx_codeobj__437 __pyx_mstate_global->__pyx_codeobj__437
#define __pyx_codeobj__440 __pyx_mstate_global->__pyx_codeobj__440
#define __pyx_codeobj__442 __pyx_mstate_global->__pyx_codeobj__442
#define __pyx_codeobj__443 __pyx_mstate_global->__pyx_codeobj__443
#define __pyx_codeobj__444 __pyx_mstate_global->__pyx_codeobj__444
#define __pyx_codeobj__445 __pyx_mstate_global->__pyx_codeobj__445
#define __pyx_codeobj__446 __pyx_mstate_global->__pyx_codeobj__446
#define __pyx_codeobj__447 __pyx_mstate_global->__pyx_codeobj__447
#define __pyx_codeobj__449 __pyx_mstate_global->__pyx_codeobj__449
#define __pyx_codeobj__451 __pyx_mstate_global->__pyx_codeobj__451
#define __pyx_codeobj__453 __pyx_mstate_global->__pyx_codeobj__453
#define __pyx_codeobj__454 __pyx_mstate_global->__pyx_codeobj__454
#define __pyx_codeobj__456 __pyx_mstate_global->__pyx_codeobj__456
#define __pyx_codeobj__457 __pyx_mstate_global->__pyx_codeobj__457
#define __pyx_codeobj__458 __pyx_mstate_global->__pyx_codeobj__458
#define __pyx_codeobj__459 __pyx_mstate_global->__pyx_codeobj__459
#define __pyx_codeobj__460 __pyx_mstate_global->__pyx_codeobj__460
#define __pyx_codeobj__461 __pyx_mstate_global->__pyx_codeobj__461
#define __pyx_codeobj__463 __pyx_mstate_global->__pyx_codeobj__463
#define __pyx_codeobj__464 __pyx_mstate_global->__pyx_codeobj__464
#define __pyx_codeobj__466 __pyx_mstate_global->__pyx_codeobj__466
#define __pyx_codeobj__468 __pyx_mstate_global->__pyx_codeobj__468
#define __pyx_codeobj__470 __pyx_mstate_global->__pyx_codeobj__470
#define __pyx_codeobj__472 __pyx_mstate_global->__pyx_codeobj__472
#define __pyx_codeobj__475 __pyx_mstate_global->__pyx_codeobj__475
#define __pyx_codeobj__477 __pyx_mstate_global->__pyx_codeobj__477
#define __pyx_codeobj__480 __pyx_mstate_global->__pyx_codeobj__480
#define __pyx_codeobj__482 __pyx_mstate_global->__pyx_codeobj__482
#define __pyx_codeobj__483 __pyx_mstate_global->__pyx_codeobj__483
#define __pyx_codeobj__484 __pyx_mstate_global->__pyx_codeobj__484
#define __pyx_codeobj__486 __pyx_mstate_global->__pyx_codeobj__486
#define __pyx_codeobj__488 __pyx_mstate_global->__pyx_codeobj__488
#define __pyx_codeobj__494 __pyx_mstate_global->__pyx_codeobj__494
#define __pyx_codeobj__496 __pyx_mstate_global->__pyx_codeobj__496
#define __pyx_codeobj__498 __pyx_mstate_global->__pyx_codeobj__498
#define __pyx_codeobj__499 __pyx_mstate_global->__pyx_codeobj__499
#define __pyx_codeobj__500 __pyx_mstate_global->__pyx_codeobj__500
#define __pyx_codeobj__502 __pyx_mstate_global->__pyx_codeobj__502
#define __pyx_codeobj__505 __pyx_mstate_global->__pyx_codeobj__505
#define __pyx_codeobj__507 __pyx_mstate_global->__pyx_codeobj__507
#define __pyx_codeobj__509 __pyx_mstate_global->__pyx_codeobj__509
#define __pyx_codeobj__511 __pyx_mstate_global->__pyx_codeobj__511
#define __pyx_codeobj__513 __pyx_mstate_global->__pyx_codeobj__513
#define __pyx_codeobj__515 __pyx_mstate_global->__pyx_codeobj__515
#define __pyx_codeobj__516 __pyx_mstate_global->__pyx_codeobj__516
#define __pyx_codeobj__517 __pyx_mstate_global->__pyx_codeobj__517
#define __pyx_codeobj__519 __pyx_mstate_global->__pyx_codeobj__519
#define __pyx_codeobj__520 __pyx_mstate_global->__pyx_codeobj__520
#define __pyx_codeobj__521 __pyx_mstate_global->__pyx_codeobj__521
#define __pyx_codeobj__523 __pyx_mstate_global->__pyx_codeobj__523
#define __pyx_codeobj__524 __pyx_mstate_global->__pyx_codeobj__524
#define __pyx_codeobj__525 __pyx_mstate_global->__pyx_codeobj__525
#define __pyx_codeobj__527 __pyx_mstate_global->__pyx_codeobj__527
#define __pyx_codeobj__529 __pyx_mstate_global->__pyx_codeobj__529
#define __pyx_codeobj__530 __pyx_mstate_global->__pyx_codeobj__530
#define __pyx_codeobj__532 __pyx_mstate_global->__pyx_codeobj__532
#define __pyx_codeobj__534 __pyx_mstate_global->__pyx_codeobj__534
#define __pyx_codeobj__536 __pyx_mstate_global->__pyx_codeobj__536
/* #### Code section: module_code ### */

/* "lxml/etree.pyx":92
 * 
 * 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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__ = {"__getitem__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); __PYX_ERR(0, 92, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__getitem__") < 0)) __PYX_ERR(0, 92, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 92, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":93
 * 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_ERR(0, 93, __pyx_L1_error)

  /* "lxml/etree.pyx":92
 * 
 * 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;
}

/* "lxml/etree.pyx":95
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__ = {"__setitem__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 1); __PYX_ERR(0, 95, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 2); __PYX_ERR(0, 95, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setitem__") < 0)) __PYX_ERR(0, 95, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 95, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":96
 * 
 *     def __setitem__(self, key, value):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
 */
  __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
  __PYX_ERR(0, 96, __pyx_L1_error)

  /* "lxml/etree.pyx":95
 *         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;
}

/* "lxml/etree.pyx":98
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__ = {"__delitem__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, 1); __PYX_ERR(0, 98, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__delitem__") < 0)) __PYX_ERR(0, 98, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":99
 * 
 *     def __delitem__(self, key):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
  __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
  __PYX_ERR(0, 99, __pyx_L1_error)

  /* "lxml/etree.pyx":98
 *         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;
}

/* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__ = {"__contains__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, 1); __PYX_ERR(0, 101, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__contains__") < 0)) __PYX_ERR(0, 101, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":102
 * 
 *     def __contains__(self, key):
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "lxml/etree.pyx":104
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__ = {"__len__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__len__") < 0)) __PYX_ERR(0, 104, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__len__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 104, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(__pyx_self, __pyx_v_self);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":105
 * 
 *     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;

  /* "lxml/etree.pyx":104
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */

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

/* "lxml/etree.pyx":107
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__ = {"__iter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__iter__") < 0)) __PYX_ERR(0, 107, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 107, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":108
 * 
 *     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;

  /* "lxml/etree.pyx":107
 *         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;
}

/* "lxml/etree.pyx":173
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []
 * 
 * cdef _update_default_namespace_prefixes_items():             # <<<<<<<<<<<<<<
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
 */

static PyObject *__pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(void) {
  PyObject *__pyx_7genexpr__pyx_v_ns = NULL;
  PyObject *__pyx_7genexpr__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_update_default_namespace_prefixes_items", 1);

  /* "lxml/etree.pyx":179
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()             # <<<<<<<<<<<<<<
 * 
 * _update_default_namespace_prefixes_items()
 */
  { /* enter inner scope */

    /* "lxml/etree.pyx":176
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {             # <<<<<<<<<<<<<<
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":178
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()             # <<<<<<<<<<<<<<
 *     }.items()
 * 
 */
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 178, __pyx_L5_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, 1, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L5_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_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 178, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(0, 178, __pyx_L5_error)
      if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_7))) __PYX_ERR(0, 178, __pyx_L5_error)
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_ns, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_prefix, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "lxml/etree.pyx":177
 *     global _DEFAULT_NAMESPACE_PREFIXES_ITEMS
 *     _DEFAULT_NAMESPACE_PREFIXES_ITEMS = {
 *         ns.decode('utf-8') : prefix.decode('utf-8')             # <<<<<<<<<<<<<<
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()
 */
      if (unlikely(__pyx_7genexpr__pyx_v_ns == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(0, 177, __pyx_L5_error)
      }
      __pyx_t_7 = __Pyx_decode_bytes(__pyx_7genexpr__pyx_v_ns, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__pyx_7genexpr__pyx_v_prefix == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
        __PYX_ERR(0, 177, __pyx_L5_error)
      }
      __pyx_t_6 = __Pyx_decode_bytes(__pyx_7genexpr__pyx_v_prefix, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_7, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 177, __pyx_L5_error)
      __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;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns); __pyx_7genexpr__pyx_v_ns = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix); __pyx_7genexpr__pyx_v_prefix = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns); __pyx_7genexpr__pyx_v_ns = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix); __pyx_7genexpr__pyx_v_prefix = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */

  /* "lxml/etree.pyx":179
 *         ns.decode('utf-8') : prefix.decode('utf-8')
 *         for ns, prefix in _DEFAULT_NAMESPACE_PREFIXES.items()
 *     }.items()             # <<<<<<<<<<<<<<
 * 
 * _update_default_namespace_prefixes_items()
 */
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":173
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []
 * 
 * cdef _update_default_namespace_prefixes_items():             # <<<<<<<<<<<<<<
 *     cdef bytes ns, prefix
 *     global _DEFAULT_NAMESPACE_PREFIXES_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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._update_default_namespace_prefixes_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_ns);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":185
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"register_namespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_1register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_register_namespace};
static PyObject *__pyx_pw_4lxml_5etree_1register_namespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_prefix)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); __PYX_ERR(0, 185, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "register_namespace") < 0)) __PYX_ERR(0, 185, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 185, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  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("register_namespace", 1);

  /* "lxml/etree.pyx":191
 *     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_ERR(0, 191, __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_ERR(0, 191, __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;

  /* "lxml/etree.pyx":192
 *     """
 *     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_INCREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __pyx_t_1 = __pyx_v_4lxml_5etree__check_internal_prefix; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_prefix_utf};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":193
 *     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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __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_ERR(0, 193, __pyx_L1_error)

    /* "lxml/etree.pyx":192
 *     """
 *     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)
 */
  }

  /* "lxml/etree.pyx":194
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 194, __pyx_L1_error)

  /* "lxml/etree.pyx":195
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)             # <<<<<<<<<<<<<<
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_uri_utf); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "lxml/etree.pyx":196
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 */
  __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_uri_utf, __pyx_kp_b_http_www_w3_org_XML_1998_namespa, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 196, __pyx_L1_error)
  if (!__pyx_t_6) {
    goto __pyx_L6_next_or;
  } else {
  }
  __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_prefix_utf, __pyx_n_b_xml, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 196, __pyx_L1_error)
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_L6_next_or:;

  /* "lxml/etree.pyx":197
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):             # <<<<<<<<<<<<<<
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 */
  __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_prefix_utf, __pyx_n_b_xml, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 197, __pyx_L1_error)
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_uri_utf, __pyx_kp_b_http_www_w3_org_XML_1998_namespa, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 197, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;

  /* "lxml/etree.pyx":196
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 */
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":198
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")             # <<<<<<<<<<<<<<
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __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_ERR(0, 198, __pyx_L1_error)

    /* "lxml/etree.pyx":196
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'             # <<<<<<<<<<<<<<
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 */
  }

  /* "lxml/etree.pyx":199
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     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 '%.30s'", "items");
    __PYX_ERR(0, 199, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PySequence_ListKeepNew(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __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_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
      #endif
      if (__pyx_t_7 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
    #else
    __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 199, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 199, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "lxml/etree.pyx":200
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     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_6 = (__Pyx_PyBytes_Equals(__pyx_v_k, __pyx_v_uri_utf, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_v, __pyx_v_prefix_utf, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_5) {

      /* "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
 *     _update_default_namespace_prefixes_items()
 */
      if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 201, __pyx_L1_error)
      }
      if (unlikely((PyDict_DelItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_k) < 0))) __PYX_ERR(0, 201, __pyx_L1_error)

      /* "lxml/etree.pyx":200
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     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
 */
    }

    /* "lxml/etree.pyx":199
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):             # <<<<<<<<<<<<<<
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":202
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf             # <<<<<<<<<<<<<<
 *     _update_default_namespace_prefixes_items()
 * 
 */
  if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 202, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_uri_utf, __pyx_v_prefix_utf) < 0))) __PYX_ERR(0, 202, __pyx_L1_error)

  /* "lxml/etree.pyx":203
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 *     _update_default_namespace_prefixes_items()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":185
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """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_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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;
}

/* "lxml/etree.pyx":215
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         super(_Error, self).__init__(message)
 *         if error_log is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_error_log = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_message,&__pyx_n_s_error_log,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_error_log);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 215, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_message = values[0];
    __pyx_v_error_log = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 215, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9LxmlError___init__(((struct __pyx_obj_4lxml_5etree_LxmlError *)__pyx_v_self), __pyx_v_message, __pyx_v_error_log);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9LxmlError___init__(struct __pyx_obj_4lxml_5etree_LxmlError *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_error_log) {
  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__", 1);

  /* "lxml/etree.pyx":216
 *     """
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)             # <<<<<<<<<<<<<<
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__Error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__Error)) __PYX_ERR(0, 216, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 216, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __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_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_message};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __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;

  /* "lxml/etree.pyx":217
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 */
  __pyx_t_5 = (__pyx_v_error_log == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":218
 *         super(_Error, self).__init__(message)
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         else:
 *             self.error_log = error_log.copy()
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree___copyGlobalErrorLog(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error_log, __pyx_t_1) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "lxml/etree.pyx":217
 *     def __init__(self, message, error_log=None):
 *         super(_Error, self).__init__(message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":220
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 *             self.error_log = error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * cdef object _Error = Error
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error_log, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error_log, __pyx_t_1) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":215
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         super(_Error, self).__init__(message)
 *         if error_log 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_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":235
 * 
 * # version information
 * cdef tuple __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  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 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackDottedVersion", 1);

  /* "lxml/etree.pyx":236
 * # version information
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []             # <<<<<<<<<<<<<<
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_version_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":237
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_version, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_ascii};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyList_New(1 * 4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < 4; __pyx_temp++) {
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0)) __PYX_ERR(0, 237, __pyx_L1_error);
    }
  }
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __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_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 4, NULL, NULL, &__pyx_slice__6, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":238
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
 */
  if (likely(PyList_CheckExact(__pyx_v_l)) || PyTuple_CheckExact(__pyx_v_l)) {
    __pyx_t_3 = __pyx_v_l; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 238, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":239
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "lxml/etree.pyx":240
 *     for item in l:
 *         try:
 *             item = int(item)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             if item.startswith('dev'):
 */
        __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "lxml/etree.pyx":239
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
 */
      }
      __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_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":241
 *         try:
 *             item = int(item)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             if item.startswith('dev'):
 *                 count = item[3:]
 */
      __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_5) {
        __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 241, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_4);

        /* "lxml/etree.pyx":242
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith('dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_startswith); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 242, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_n_u_dev};
          __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 242, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 242, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":243
 *         except ValueError:
 *             if item.startswith('dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith('alpha'):
 */
          __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_item, 3, 0, NULL, NULL, &__pyx_slice__7, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 243, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "lxml/etree.pyx":244
 *             if item.startswith('dev'):
 *                 count = item[3:]
 *                 item = -300             # <<<<<<<<<<<<<<
 *             elif item.startswith('alpha'):
 *                 count = item[5:]
 */
          __Pyx_INCREF(__pyx_int_neg_300);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_int_neg_300);

          /* "lxml/etree.pyx":242
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith('dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":245
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith('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_ERR(0, 245, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_n_u_alpha};
          __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 245, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 245, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":246
 *                 item = -300
 *             elif item.startswith('alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith('beta'):
 */
          __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_item, 5, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 246, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "lxml/etree.pyx":247
 *             elif item.startswith('alpha'):
 *                 count = item[5:]
 *                 item = -200             # <<<<<<<<<<<<<<
 *             elif item.startswith('beta'):
 *                 count = item[4:]
 */
          __Pyx_INCREF(__pyx_int_neg_200);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_int_neg_200);

          /* "lxml/etree.pyx":245
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith('alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
 */
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":248
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith('beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_startswith); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 248, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_n_u_beta};
          __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 248, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 248, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":249
 *                 item = -200
 *             elif item.startswith('beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
 */
          __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_item, 4, 0, NULL, NULL, &__pyx_slice__9, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 249, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "lxml/etree.pyx":250
 *             elif item.startswith('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);

          /* "lxml/etree.pyx":248
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith('beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
          goto __pyx_L15;
        }

        /* "lxml/etree.pyx":252
 *                 item = -100
 *             else:
 *                 count = 0             # <<<<<<<<<<<<<<
 *             if count:
 *                 item += int(count)
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_int_0);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_int_0);
        }
        __pyx_L15:;

        /* "lxml/etree.pyx":253
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item += int(count)
 *         version_list.append(item)
 */
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 253, __pyx_L7_except_error)
        if (__pyx_t_14) {

          /* "lxml/etree.pyx":254
 *                 count = 0
 *             if count:
 *                 item += int(count)             # <<<<<<<<<<<<<<
 *         version_list.append(item)
 *     return tuple(version_list)
 */
          __pyx_t_11 = __Pyx_PyNumber_Int(__pyx_v_count); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 254, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_item, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 254, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "lxml/etree.pyx":253
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item += int(count)
 *         version_list.append(item)
 */
        }
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;

      /* "lxml/etree.pyx":239
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
 */
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L6_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_L12_try_end:;
    }

    /* "lxml/etree.pyx":255
 *             if count:
 *                 item += int(count)
 *         version_list.append(item)             # <<<<<<<<<<<<<<
 *     return tuple(version_list)
 * 
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_version_list, __pyx_v_item); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 255, __pyx_L1_error)

    /* "lxml/etree.pyx":238
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":256
 *                 item += int(count)
 *         version_list.append(item)
 *     return tuple(version_list)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_AsTuple(__pyx_v_version_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":235
 * 
 * # version information
 * cdef tuple __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [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_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __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;
}

/* "lxml/etree.pyx":258
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
 */

static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int __pyx_v_c_version, struct __pyx_opt_args_4lxml_5etree___unpackIntVersion *__pyx_optional_args) {
  int __pyx_v_base = ((int)0x64);
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackIntVersion", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_base = __pyx_optional_args->base;
    }
  }

  /* "lxml/etree.pyx":259
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (             # <<<<<<<<<<<<<<
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "lxml/etree.pyx":260
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (
 *         ((c_version // (base*base)) % base),             # <<<<<<<<<<<<<<
 *         ((c_version // base)        % base),
 *         (c_version                  % base)
 */
  __pyx_t_1 = (__pyx_v_base * __pyx_v_base);
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 260, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_t_1 == (int)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_c_version))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 260, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_div_int(__pyx_v_c_version, __pyx_t_1);
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 260, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyInt_From_int(__Pyx_mod_int(__pyx_t_2, __pyx_v_base)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "lxml/etree.pyx":261
 *     return (
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),             # <<<<<<<<<<<<<<
 *         (c_version                  % base)
 *         )
 */
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 261, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_base == (int)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_c_version))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 261, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_div_int(__pyx_v_c_version, __pyx_v_base);
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 261, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyInt_From_int(__Pyx_mod_int(__pyx_t_2, __pyx_v_base)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "lxml/etree.pyx":262
 *         ((c_version // (base*base)) % base),
 *         ((c_version // base)        % base),
 *         (c_version                  % base)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  if (unlikely(__pyx_v_base == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 262, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyInt_From_int(__Pyx_mod_int(__pyx_v_c_version, __pyx_v_base)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "lxml/etree.pyx":260
 * cdef tuple __unpackIntVersion(int c_version, int base=100):
 *     return (
 *         ((c_version // (base*base)) % base),             # <<<<<<<<<<<<<<
 *         ((c_version // base)        % base),
 *         (c_version                  % base)
 */
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5)) __PYX_ERR(0, 260, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":258
 *     return tuple(version_list)
 * 
 * cdef tuple __unpackIntVersion(int c_version, int base=100):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version // (base*base)) % base),
 */

  /* 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.__unpackIntVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":306
 * 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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "lxml/etree.pyx":307
 *     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_ERR(0, 307, __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;

  /* "lxml/etree.pyx":306
 * 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;
}

/* "lxml/etree.pyx":309
 *         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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":310
 * 
 *     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 '%.30s'", "append");
    __PYX_ERR(0, 310, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_storage, __pyx_v_obj); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error)

  /* "lxml/etree.pyx":311
 *     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;

  /* "lxml/etree.pyx":309
 *         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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":313
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":314
 * 
 *     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_ERR(0, 314, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_storage, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 314, __pyx_L1_error)

  /* "lxml/etree.pyx":315
 *     cdef int clear(self) except -1:
 *         del self._storage[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":313
 *         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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":322
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         return 0
 */

static int __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 1);

  /* "lxml/etree.pyx":323
 *     cdef object _exc_info
 *     cdef int clear(self) except -1:
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __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;

  /* "lxml/etree.pyx":324
 *     cdef int clear(self) except -1:
 *         self._exc_info = None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void _store_raised(self) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":322
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         return 0
 */

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

/* "lxml/etree.pyx":326
 *         return 0
 * 
 *     cdef void _store_raised(self) noexcept:             # <<<<<<<<<<<<<<
 *         try:
 *             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) {
  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;
  PyObject *__pyx_t_6 = NULL;
  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("_store_raised", 1);

  /* "lxml/etree.pyx":327
 * 
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "lxml/etree.pyx":328
 *     cdef void _store_raised(self) noexcept:
 *         try:
 *             self._exc_info = sys.exc_info()             # <<<<<<<<<<<<<<
 *         except BaseException as e:
 *             self._store_exception(e)
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L6_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->_exc_info);
        __Pyx_DECREF(__pyx_v_self->_exc_info);
        __pyx_v_self->_exc_info = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "lxml/etree.pyx":327
 * 
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
 */
      }
      __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_L11_try_end;
      __pyx_L6_error:;
      __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;

      /* "lxml/etree.pyx":329
 *         try:
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:             # <<<<<<<<<<<<<<
 *             self._store_exception(e)
 *         finally:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_BaseException);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree._ExceptionContext._store_raised", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 329, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_e = __pyx_t_5;
        /*try:*/ {

          /* "lxml/etree.pyx":330
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
 *             self._store_exception(e)             # <<<<<<<<<<<<<<
 *         finally:
 *             return  # and swallow any further exceptions
 */
          __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->__pyx_vtab)->_store_exception(__pyx_v_self, __pyx_v_e); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 330, __pyx_L17_error)
        }

        /* "lxml/etree.pyx":329
 *         try:
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:             # <<<<<<<<<<<<<<
 *             self._store_exception(e)
 *         finally:
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L18;
          }
          __pyx_L17_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 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;
            {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            }
            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_L8_except_error;
          }
          __pyx_L18:;
        }
        __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_L7_exception_handled;
      }
      goto __pyx_L8_except_error;

      /* "lxml/etree.pyx":327
 * 
 *     cdef void _store_raised(self) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             self._exc_info = sys.exc_info()
 *         except BaseException as e:
 */
      __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_L11_try_end:;
    }
  }

  /* "lxml/etree.pyx":332
 *             self._store_exception(e)
 *         finally:
 *             return  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int _store_exception(self, exception) except -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      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_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L23_return;
      }
      __pyx_L23_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __Pyx_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_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "lxml/etree.pyx":326
 *         return 0
 * 
 *     cdef void _store_raised(self) noexcept:             # <<<<<<<<<<<<<<
 *         try:
 *             self._exc_info = sys.exc_info()
 */

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

/* "lxml/etree.pyx":334
 *             return  # and swallow any further exceptions
 * 
 *     cdef int _store_exception(self, exception) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = (exception, None, None)
 *         return 0
 */

static int __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception) {
  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("_store_exception", 1);

  /* "lxml/etree.pyx":335
 * 
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_exception);
  __Pyx_GIVEREF(__pyx_v_exception);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception)) __PYX_ERR(0, 335, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None)) __PYX_ERR(0, 335, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(0, 335, __pyx_L1_error);
  __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;

  /* "lxml/etree.pyx":336
 *     cdef int _store_exception(self, exception) except -1:
 *         self._exc_info = (exception, None, None)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _has_raised(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":334
 *             return  # and swallow any further exceptions
 * 
 *     cdef int _store_exception(self, exception) except -1:             # <<<<<<<<<<<<<<
 *         self._exc_info = (exception, None, None)
 *         return 0
 */

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

/* "lxml/etree.pyx":338
 *         return 0
 * 
 *     cdef bint _has_raised(self) except -1:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;

  /* "lxml/etree.pyx":339
 * 
 *     cdef bint _has_raised(self) except -1:
 *         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;

  /* "lxml/etree.pyx":338
 *         return 0
 * 
 *     cdef bint _has_raised(self) except -1:             # <<<<<<<<<<<<<<
 *         return self._exc_info is not None
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":341
 *         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;
  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("_raise_if_stored", 1);

  /* "lxml/etree.pyx":342
 * 
 *     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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":343
 *     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;

    /* "lxml/etree.pyx":342
 * 
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:             # <<<<<<<<<<<<<<
 *             return 0
 *         type, value, traceback = self._exc_info
 */
  }

  /* "lxml/etree.pyx":344
 *         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_2 = __pyx_v_self->_exc_info;
  __Pyx_INCREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 344, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_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_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 344, __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_ERR(0, 344, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_type = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_value = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_traceback = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":345
 *             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;

  /* "lxml/etree.pyx":346
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
 */
  __pyx_t_8 = (__pyx_v_value == Py_None);
  if (__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_traceback == Py_None);
  __pyx_t_1 = __pyx_t_8;
  __pyx_L7_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":347
 *         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_ERR(0, 347, __pyx_L1_error)

    /* "lxml/etree.pyx":346
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
 */
  }

  /* "lxml/etree.pyx":349
 *             raise type
 *         else:
 *             raise type, value, traceback             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_type, __pyx_v_value, __pyx_v_traceback, 0);
    __PYX_ERR(0, 349, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":341
 *         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_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._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;
}

/* "src/lxml/proxy.pxi":9
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline _Element getProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """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;
  __Pyx_RefNannySetupContext("getProxy", 1);

  /* "src/lxml/proxy.pxi":13
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return <_Element>c_node._private
 *     else:
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->_private != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":14
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:
 *         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;

    /* "src/lxml/proxy.pxi":13
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return <_Element>c_node._private
 *     else:
 */
  }

  /* "src/lxml/proxy.pxi":16
 *         return <_Element>c_node._private
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/proxy.pxi":9
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline _Element getProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """Get a proxy for a given node.
 *     """
 */

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

/* "src/lxml/proxy.pxi":21
 * @cython.linetrace(False)
 * @cython.profile(False)
 * 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;
  int __pyx_t_1;

  /* "src/lxml/proxy.pxi":22
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     return True
 */
  __pyx_t_1 = (__pyx_v_c_node->_private == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":23
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:
 *         return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":22
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     return True
 */
  }

  /* "src/lxml/proxy.pxi":24
 *     if c_node._private is NULL:
 *         return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":21
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline bint hasProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node._private is NULL:
 *         return False
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":29
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline int _registerProxy(_Element proxy, _Document doc,             # <<<<<<<<<<<<<<
 *                                xmlNode* c_node) except -1:
 *     """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;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerProxy", 1);

  /* "src/lxml/proxy.pxi":34
 *     """
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), "double registering proxy!"             # <<<<<<<<<<<<<<
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 34, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_1);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_double_registering_proxy, 0, 0);
      __PYX_ERR(6, 34, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 34, __pyx_L1_error)
  #endif

  /* "src/lxml/proxy.pxi":35
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), "double registering proxy!"
 *     proxy._doc = doc             # <<<<<<<<<<<<<<
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy
 */
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  __Pyx_GOTREF((PyObject *)__pyx_v_proxy->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
  __pyx_v_proxy->_doc = __pyx_v_doc;

  /* "src/lxml/proxy.pxi":36
 *     assert not hasProxy(c_node), "double registering proxy!"
 *     proxy._doc = doc
 *     proxy._c_node = c_node             # <<<<<<<<<<<<<<
 *     c_node._private = <void*>proxy
 *     return 0
 */
  __pyx_v_proxy->_c_node = __pyx_v_c_node;

  /* "src/lxml/proxy.pxi":37
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_node->_private = ((void *)__pyx_v_proxy);

  /* "src/lxml/proxy.pxi":38
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":29
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline int _registerProxy(_Element proxy, _Document doc,             # <<<<<<<<<<<<<<
 *                                xmlNode* c_node) except -1:
 *     """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;
}

/* "src/lxml/proxy.pxi":43
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline int _unregisterProxy(_Element proxy) except -1:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":46
 *     """Unregister a proxy for the node it's proxying for.
 *     """
 *     cdef xmlNode* c_node = proxy._c_node             # <<<<<<<<<<<<<<
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL
 */
  __pyx_t_1 = __pyx_v_proxy->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/proxy.pxi":47
 *     """
 *     cdef xmlNode* c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"             # <<<<<<<<<<<<<<
 *     c_node._private = NULL
 *     return 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_c_node->_private == ((void *)__pyx_v_proxy));
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Tried_to_unregister_unknown_prox, 0, 0);
      __PYX_ERR(6, 47, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 47, __pyx_L1_error)
  #endif

  /* "src/lxml/proxy.pxi":48
 *     cdef xmlNode* c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_node->_private = NULL;

  /* "src/lxml/proxy.pxi":49
 *     assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
 *     c_node._private = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":43
 * @cython.linetrace(False)
 * @cython.profile(False)
 * cdef inline int _unregisterProxy(_Element proxy) except -1:             # <<<<<<<<<<<<<<
 *     """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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":55
 * # 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;
  xmlDoc *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":56
 * 
 * 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 == ((xmlDoc *)NULL))) __PYX_ERR(6, 56, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":55
 * # 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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":58
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":67
 *     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) {
  } else {
    __pyx_t_1 = __pyx_v_with_siblings;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->prev == NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->next == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":68
 *     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);

    /* "src/lxml/proxy.pxi":69
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":71
 *         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;

      /* "src/lxml/proxy.pxi":69
 *     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
 */
    }

    /* "src/lxml/proxy.pxi":67
 *     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:
 */
  }

  /* "src/lxml/proxy.pxi":73
 *             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_3 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_base_doc, 0); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(6, 73, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/proxy.pxi":74
 * 
 *     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);

  /* "src/lxml/proxy.pxi":75
 *     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)
 * 
 */
  (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_new_root));

  /* "src/lxml/proxy.pxi":76
 *     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);

  /* "src/lxml/proxy.pxi":78
 *     _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_4 = __pyx_v_c_node->children;
  __pyx_v_c_new_root->children = __pyx_t_4;

  /* "src/lxml/proxy.pxi":79
 * 
 *     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_4 = __pyx_v_c_node->last;
  __pyx_v_c_new_root->last = __pyx_t_4;

  /* "src/lxml/proxy.pxi":80
 *     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;

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

  /* "src/lxml/proxy.pxi":86
 * 
 *     # 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_4 = __pyx_v_c_new_root->children;
  __pyx_v_c_child = __pyx_t_4;

  /* "src/lxml/proxy.pxi":87
 *     # 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);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":88
 *     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;

    /* "src/lxml/proxy.pxi":89
 *     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_4 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_4;
  }

  /* "src/lxml/proxy.pxi":91
 *         c_child = c_child.next
 * 
 *     c_doc.children = c_new_root             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
 */
  __pyx_v_c_doc->children = __pyx_v_c_new_root;

  /* "src/lxml/proxy.pxi":92
 * 
 *     c_doc.children = c_new_root
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:
 */
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":58
 *     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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":94
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     # 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;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/proxy.pxi":99
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":100
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:
 *         return             # <<<<<<<<<<<<<<
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 * 
 */
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":99
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:             # <<<<<<<<<<<<<<
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 */
  }

  /* "src/lxml/proxy.pxi":101
 *     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);

  /* "src/lxml/proxy.pxi":104
 * 
 *     # 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);

  /* "src/lxml/proxy.pxi":105
 *     # 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;

  /* "src/lxml/proxy.pxi":106
 *     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);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":107
 *     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;

    /* "src/lxml/proxy.pxi":108
 *     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;
  }

  /* "src/lxml/proxy.pxi":111
 * 
 *     # 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;

  /* "src/lxml/proxy.pxi":112
 *     # 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);

  /* "src/lxml/proxy.pxi":94
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/proxy.pxi":114
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/proxy.pxi":123
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":124
 *     """
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":125
 *     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);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":126
 *         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);

        /* "src/lxml/proxy.pxi":125
 *     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
 */
      }

      /* "src/lxml/proxy.pxi":124
 *     """
 *     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
 */
    }

    /* "src/lxml/proxy.pxi":123
 *     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:
 */
  }

  /* "src/lxml/proxy.pxi":128
 *                 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_ERR(6, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":114
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/proxy.pxi":133
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_t_1;

  /* "src/lxml/proxy.pxi":138
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":140
 *     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;

    /* "src/lxml/proxy.pxi":138
 *     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
 */
  }

  /* "src/lxml/proxy.pxi":141
 *         #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);

  /* "src/lxml/proxy.pxi":142
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":144
 *     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);

    /* "src/lxml/proxy.pxi":145
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)             # <<<<<<<<<<<<<<
 *         return 1
 *     return 0
 */
    xmlFreeNode(__pyx_v_c_top);

    /* "src/lxml/proxy.pxi":146
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)
 *         return 1             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":142
 *         return 0
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:             # <<<<<<<<<<<<<<
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 */
  }

  /* "src/lxml/proxy.pxi":147
 *         tree.xmlFreeNode(c_top)
 *         return 1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":133
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Attempt deallocation of c_node (or higher up in tree).
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":149
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """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_v_c_next;
  xmlNode *__pyx_r;
  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;

  /* "src/lxml/proxy.pxi":154
 *     cdef xmlNode* c_next
 *     #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); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 154, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":156
 *     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;

    /* "src/lxml/proxy.pxi":154
 *     cdef xmlNode* c_next
 *     #print "trying to do deallocating:", c_node.type
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 */
  }

  /* "src/lxml/proxy.pxi":157
 *         #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);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":158
 *         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;

    /* "src/lxml/proxy.pxi":160
 *         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:
      case XML_HTML_DOCUMENT_NODE:

      /* "src/lxml/proxy.pxi":163
 *                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;

      /* "src/lxml/proxy.pxi":160
 *         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"
 */
      break;
      default: break;
    }

    /* "src/lxml/proxy.pxi":165
 *             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); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 165, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":167
 *         if hasProxy(c_node):
 *             #print "Not freeing: proxies still exist"
 *             return NULL             # <<<<<<<<<<<<<<
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):
 */
      __pyx_r = NULL;
      goto __pyx_L0;

      /* "src/lxml/proxy.pxi":165
 *             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
 */
    }
  }

  /* "src/lxml/proxy.pxi":169
 *             return NULL
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     # see whether we have siblings to deallocate
 */
  __pyx_t_1 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_node) != 0));
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":170
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":169
 *             return NULL
 *     # see whether we have children to deallocate
 *     if not canDeallocateChildNodes(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     # see whether we have siblings to deallocate
 */
  }

  /* "src/lxml/proxy.pxi":172
 *         return NULL
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev             # <<<<<<<<<<<<<<
 *     while c_next:
 *         if _isElement(c_next):
 */
  __pyx_t_2 = __pyx_v_c_node->prev;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/proxy.pxi":173
 *     # see whether we have siblings to deallocate
 *     c_next = c_node.prev
 *     while c_next:             # <<<<<<<<<<<<<<
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_next != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":174
 *     c_next = c_node.prev
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 */
    __pyx_t_1 = _isElement(__pyx_v_c_next);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":175
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.prev
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_next); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 175, __pyx_L1_error)
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_next) != 0));
      __pyx_t_1 = __pyx_t_3;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":176
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL             # <<<<<<<<<<<<<<
 *         c_next = c_next.prev
 *     c_next = c_node.next
 */
        __pyx_r = NULL;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":175
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.prev
 */
      }

      /* "src/lxml/proxy.pxi":174
 *     c_next = c_node.prev
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 */
    }

    /* "src/lxml/proxy.pxi":177
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 *         c_next = c_next.prev             # <<<<<<<<<<<<<<
 *     c_next = c_node.next
 *     while c_next:
 */
    __pyx_t_2 = __pyx_v_c_next->prev;
    __pyx_v_c_next = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":178
 *                 return NULL
 *         c_next = c_next.prev
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     while c_next:
 *         if _isElement(c_next):
 */
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "src/lxml/proxy.pxi":179
 *         c_next = c_next.prev
 *     c_next = c_node.next
 *     while c_next:             # <<<<<<<<<<<<<<
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_next != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":180
 *     c_next = c_node.next
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 */
    __pyx_t_1 = _isElement(__pyx_v_c_next);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":181
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.next
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_next); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 181, __pyx_L1_error)
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_next) != 0));
      __pyx_t_1 = __pyx_t_3;
      __pyx_L18_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":182
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL             # <<<<<<<<<<<<<<
 *         c_next = c_next.next
 *     return c_node
 */
        __pyx_r = NULL;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":181
 *     while c_next:
 *         if _isElement(c_next):
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):             # <<<<<<<<<<<<<<
 *                 return NULL
 *         c_next = c_next.next
 */
      }

      /* "src/lxml/proxy.pxi":180
 *     c_next = c_node.next
 *     while c_next:
 *         if _isElement(c_next):             # <<<<<<<<<<<<<<
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 */
    }

    /* "src/lxml/proxy.pxi":183
 *             if hasProxy(c_next) or not canDeallocateChildNodes(c_next):
 *                 return NULL
 *         c_next = c_next.next             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __pyx_t_2 = __pyx_v_c_next->next;
    __pyx_v_c_next = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":184
 *                 return NULL
 *         c_next = c_next.next
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":149
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Return the top of the tree that can be deallocated, or NULL.
 *     """
 */

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

/* "src/lxml/proxy.pxi":186
 *     return c_node
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":188
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:
 *     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;

  /* "src/lxml/proxy.pxi":189
 *     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);

  /* "src/lxml/proxy.pxi":190
 *     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); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 190, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/proxy.pxi":191
 *     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;

    /* "src/lxml/proxy.pxi":190
 *     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)
 */
  }

  /* "src/lxml/proxy.pxi":192
 *     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);

  /* "src/lxml/proxy.pxi":193
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":186
 *     return c_node
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 */

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

/* "src/lxml/proxy.pxi":198
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """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;
  xmlNs *__pyx_t_4;

  /* "src/lxml/proxy.pxi":205
 *     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;

  /* "src/lxml/proxy.pxi":206
 *     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) {
    __pyx_t_3 = (__pyx_v_c_parent != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = _isElementOrXInclude(__pyx_v_c_parent);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/proxy.pxi":207
 *     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);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":208
 *     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_4 = __pyx_v_c_parent->nsDef;
    __pyx_v_c_new_ns = __pyx_t_4;

    /* "src/lxml/proxy.pxi":209
 *                         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;

      /* "src/lxml/proxy.pxi":211
 *         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
 */
      (void)(xmlNewNs(__pyx_v_c_to_node, __pyx_v_c_new_ns->href, __pyx_v_c_new_ns->prefix));

      /* "src/lxml/proxy.pxi":212
 *             # 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_4 = __pyx_v_c_new_ns->next;
      __pyx_v_c_new_ns = __pyx_t_4;
    }

    /* "src/lxml/proxy.pxi":213
 *             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_1 = __pyx_v_c_parent->parent;
    __pyx_v_c_parent = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":198
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":227
 * 
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:
 */

static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache) {
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_v_ns_map_ptr;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":229
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache->size == 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":230
 *     cdef _ns_update_map* ns_map_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;

    /* "src/lxml/proxy.pxi":229
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef _ns_update_map* ns_map_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/proxy.pxi":232
 *         c_ns_cache.size = 20
 *     else:
 *         c_ns_cache.size *= 2             # <<<<<<<<<<<<<<
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 */
  /*else*/ {
    __pyx_v_c_ns_cache->size = (__pyx_v_c_ns_cache->size * 2);
  }
  __pyx_L3:;

  /* "src/lxml/proxy.pxi":233
 *     else:
 *         c_ns_cache.size *= 2
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(             # <<<<<<<<<<<<<<
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:
 */
  __pyx_v_ns_map_ptr = ((__pyx_t_4lxml_5etree__ns_update_map *)lxml_realloc(__pyx_v_c_ns_cache->ns_map, __pyx_v_c_ns_cache->size, (sizeof(__pyx_t_4lxml_5etree__ns_update_map))));

  /* "src/lxml/proxy.pxi":235
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
 */
  __pyx_t_1 = (!(__pyx_v_ns_map_ptr != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/proxy.pxi":236
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()
 */
    lxml_free(__pyx_v_c_ns_cache->ns_map);

    /* "src/lxml/proxy.pxi":237
 *     if not ns_map_ptr:
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr
 */
    __pyx_v_c_ns_cache->ns_map = NULL;

    /* "src/lxml/proxy.pxi":238
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     c_ns_cache.ns_map = ns_map_ptr
 *     return 0
 */
    PyErr_NoMemory(); __PYX_ERR(6, 238, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":235
 *     ns_map_ptr = <_ns_update_map*> python.lxml_realloc(
 *         c_ns_cache.ns_map, c_ns_cache.size, sizeof(_ns_update_map))
 *     if not ns_map_ptr:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *         c_ns_cache.ns_map = NULL
 */
  }

  /* "src/lxml/proxy.pxi":239
 *         c_ns_cache.ns_map = NULL
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_ns_cache->ns_map = __pyx_v_ns_map_ptr;

  /* "src/lxml/proxy.pxi":240
 *         raise MemoryError()
 *     c_ns_cache.ns_map = ns_map_ptr
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":227
 * 
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef _ns_update_map* ns_map_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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":243
 * 
 * 
 * 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;
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_update_map __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/proxy.pxi":245
 * 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.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache->last >= __pyx_v_c_ns_cache->size);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":246
 *                                  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.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 *     c_ns_cache.last += 1
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__growNsCache(__pyx_v_c_ns_cache); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(6, 246, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":245
 * 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.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 */
  }

  /* "src/lxml/proxy.pxi":247
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)             # <<<<<<<<<<<<<<
 *     c_ns_cache.last += 1
 * 
 */
  __pyx_t_3.old = __pyx_v_c_old_ns;
  __pyx_t_3.new = __pyx_v_c_new_ns;
  (__pyx_v_c_ns_cache->ns_map[__pyx_v_c_ns_cache->last]) = __pyx_t_3;

  /* "src/lxml/proxy.pxi":248
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.ns_map[c_ns_cache.last] = _ns_update_map(old=c_old_ns, new=c_new_ns)
 *     c_ns_cache.last += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_c_ns_cache->last = (__pyx_v_c_ns_cache->last + 1);

  /* "src/lxml/proxy.pxi":243
 * 
 * 
 * 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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":251
 * 
 * 
 * cdef int _stripRedundantNamespaceDeclarations(xmlNode* c_element, _nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                               xmlNs** c_del_ns_list) except -1:
 *     """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;
  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;

  /* "src/lxml/proxy.pxi":261
 *     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);

  /* "src/lxml/proxy.pxi":262
 *     # 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);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":263
 *     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);

    /* "src/lxml/proxy.pxi":265
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":267
 *         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 == ((int)-1))) __PYX_ERR(6, 267, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":268
 *             # 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);

      /* "src/lxml/proxy.pxi":265
 *         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])
 */
      goto __pyx_L5;
    }

    /* "src/lxml/proxy.pxi":271
 *         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
 */
    /*else*/ {
      __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 == ((int)-1))) __PYX_ERR(6, 271, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":273
 *             _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;

      /* "src/lxml/proxy.pxi":274
 *             # 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]);

      /* "src/lxml/proxy.pxi":275
 *             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]);

      /* "src/lxml/proxy.pxi":276
 *             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:;
  }

  /* "src/lxml/proxy.pxi":277
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":251
 * 
 * 
 * cdef int _stripRedundantNamespaceDeclarations(xmlNode* c_element, _nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                               xmlNs** c_del_ns_list) except -1:
 *     """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:;
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":280
 * 
 * 
 * cdef void _cleanUpFromNamespaceAdaptation(xmlNode* c_start_node,             # <<<<<<<<<<<<<<
 *                                           _nscache* c_ns_cache, xmlNs* c_del_ns_list) noexcept:
 *     # Try to recover from exceptions with really bad timing.  We were in the middle
 */

static void __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(xmlNode *__pyx_v_c_start_node, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_t_1;
  xmlNs *__pyx_t_2;

  /* "src/lxml/proxy.pxi":286
 *     # by re-adding the original xmlNs declarations (which might still be used in some
 *     # places).
 *     if c_ns_cache.ns_map:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache->ns_map != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":287
 *     # places).
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:
 */
    lxml_free(__pyx_v_c_ns_cache->ns_map);

    /* "src/lxml/proxy.pxi":286
 *     # by re-adding the original xmlNs declarations (which might still be used in some
 *     # places).
 *     if c_ns_cache.ns_map:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 */
  }

  /* "src/lxml/proxy.pxi":288
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:             # <<<<<<<<<<<<<<
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list
 */
  __pyx_t_1 = (__pyx_v_c_del_ns_list != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":289
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:             # <<<<<<<<<<<<<<
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
 */
    __pyx_t_1 = (!(__pyx_v_c_start_node->nsDef != 0));
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":290
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list             # <<<<<<<<<<<<<<
 *         else:
 *             c_ns = c_start_node.nsDef
 */
      __pyx_v_c_start_node->nsDef = __pyx_v_c_del_ns_list;

      /* "src/lxml/proxy.pxi":289
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:
 *         if not c_start_node.nsDef:             # <<<<<<<<<<<<<<
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
 */
      goto __pyx_L5;
    }

    /* "src/lxml/proxy.pxi":292
 *             c_start_node.nsDef = c_del_ns_list
 *         else:
 *             c_ns = c_start_node.nsDef             # <<<<<<<<<<<<<<
 *             while c_ns.next:
 *                 c_ns = c_ns.next
 */
    /*else*/ {
      __pyx_t_2 = __pyx_v_c_start_node->nsDef;
      __pyx_v_c_ns = __pyx_t_2;

      /* "src/lxml/proxy.pxi":293
 *         else:
 *             c_ns = c_start_node.nsDef
 *             while c_ns.next:             # <<<<<<<<<<<<<<
 *                 c_ns = c_ns.next
 *             c_ns.next = c_del_ns_list
 */
      while (1) {
        __pyx_t_1 = (__pyx_v_c_ns->next != 0);
        if (!__pyx_t_1) break;

        /* "src/lxml/proxy.pxi":294
 *             c_ns = c_start_node.nsDef
 *             while c_ns.next:
 *                 c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *             c_ns.next = c_del_ns_list
 * 
 */
        __pyx_t_2 = __pyx_v_c_ns->next;
        __pyx_v_c_ns = __pyx_t_2;
      }

      /* "src/lxml/proxy.pxi":295
 *             while c_ns.next:
 *                 c_ns = c_ns.next
 *             c_ns.next = c_del_ns_list             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_c_ns->next = __pyx_v_c_del_ns_list;
    }
    __pyx_L5:;

    /* "src/lxml/proxy.pxi":288
 *     if c_ns_cache.ns_map:
 *         python.lxml_free(c_ns_cache.ns_map)
 *     if c_del_ns_list:             # <<<<<<<<<<<<<<
 *         if not c_start_node.nsDef:
 *             c_start_node.nsDef = c_del_ns_list
 */
  }

  /* "src/lxml/proxy.pxi":280
 * 
 * 
 * cdef void _cleanUpFromNamespaceAdaptation(xmlNode* c_start_node,             # <<<<<<<<<<<<<<
 *                                           _nscache* c_ns_cache, xmlNs* c_del_ns_list) noexcept:
 *     # Try to recover from exceptions with really bad timing.  We were in the middle
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":298
 * 
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     """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;
  CYTHON_UNUSED xmlDoc *__pyx_v_c_doc;
  __pyx_t_4lxml_5etree__nscache __pyx_v_c_ns_cache;
  xmlNs *__pyx_v_c_del_ns_list;
  PyObject *__pyx_v_proxy_count = 0;
  struct LxmlElement *__pyx_v_proxy = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  __pyx_t_4lxml_5etree__nscache __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;
  xmlNode *__pyx_t_11;
  int __pyx_t_12;
  size_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("moveNodeToDocument", 1);

  /* "src/lxml/proxy.pxi":331
 *     cdef xmlNode* c_start_node
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 *     cdef tree.xmlAttr* c_attr
 *     cdef char* c_name
 */
  __pyx_t_1 = __pyx_v_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/proxy.pxi":334
 *     cdef tree.xmlAttr* c_attr
 *     cdef char* c_name
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_del_ns_list = NULL
 *     cdef proxy_count = 0
 */
  __pyx_t_2.ns_map = NULL;
  __pyx_t_2.size = 0;
  __pyx_t_2.last = 0;
  __pyx_v_c_ns_cache = __pyx_t_2;

  /* "src/lxml/proxy.pxi":335
 *     cdef char* c_name
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]
 *     cdef xmlNs* c_del_ns_list = NULL             # <<<<<<<<<<<<<<
 *     cdef proxy_count = 0
 * 
 */
  __pyx_v_c_del_ns_list = NULL;

  /* "src/lxml/proxy.pxi":336
 *     cdef _nscache c_ns_cache = [NULL, 0, 0]
 *     cdef xmlNs* c_del_ns_list = NULL
 *     cdef proxy_count = 0             # <<<<<<<<<<<<<<
 * 
 *     if not tree._isElementOrXInclude(c_element):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_proxy_count = __pyx_int_0;

  /* "src/lxml/proxy.pxi":338
 *     cdef proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_3 = (!_isElementOrXInclude(__pyx_v_c_element));
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":339
 * 
 *     if not tree._isElementOrXInclude(c_element):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_start_node = c_element
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/proxy.pxi":338
 *     cdef proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "src/lxml/proxy.pxi":341
 *         return 0
 * 
 *     c_start_node = c_element             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 */
  __pyx_v_c_start_node = __pyx_v_c_element;

  /* "src/lxml/proxy.pxi":343
 *     c_start_node = c_element
 * 
 *     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);

  /* "src/lxml/proxy.pxi":344
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if hasProxy(c_element):
 *             proxy_count += 1
 */
  __pyx_t_3 = _isElementOrXInclude(__pyx_v_c_element);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":345
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_element); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(6, 345, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":346
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):
 *             proxy_count += 1             # <<<<<<<<<<<<<<
 * 
 *         # 1) cut out namespaces defined here that are already known by
 */
      __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_proxy_count, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_proxy_count, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/proxy.pxi":345
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
 */
    }

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

      /* "src/lxml/proxy.pxi":351
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/proxy.pxi":352
 *         if c_element.nsDef is not NULL:
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)             # <<<<<<<<<<<<<<
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
 */
          __pyx_t_8 = __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(__pyx_v_c_element, (&__pyx_v_c_ns_cache), (&__pyx_v_c_del_ns_list)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(6, 352, __pyx_L7_error)

          /* "src/lxml/proxy.pxi":351
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
 */
        }
        __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_L7_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/proxy.pxi":353
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:             # <<<<<<<<<<<<<<
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
 *                 raise
 */
        /*except:*/ {
          __Pyx_AddTraceback("lxml.etree.moveNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(6, 353, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);

          /* "src/lxml/proxy.pxi":354
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *                 raise
 * 
 */
          __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(__pyx_v_c_start_node, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list);

          /* "src/lxml/proxy.pxi":355
 *             except:
 *                 _cleanUpFromNamespaceAdaptation(c_start_node, &c_ns_cache, c_del_ns_list)
 *                 raise             # <<<<<<<<<<<<<<
 * 
 *         # 2) make sure the namespaces of an element and its attributes
 */
          __Pyx_GIVEREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_9, __pyx_t_10);
          __pyx_t_4 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; 
          __PYX_ERR(6, 355, __pyx_L9_except_error)
        }

        /* "src/lxml/proxy.pxi":351
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 *             except:
 */
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L12_try_end:;
      }

      /* "src/lxml/proxy.pxi":350
 *         # 1) cut out namespaces defined here that are already known by
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 _stripRedundantNamespaceDeclarations(c_element, &c_ns_cache, &c_del_ns_list)
 */
    }

    /* "src/lxml/proxy.pxi":359
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:             # <<<<<<<<<<<<<<
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
 */
    __pyx_t_3 = (__pyx_v_c_element->ns != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":360
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *         c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__fixCNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_element, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(6, 360, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":359
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         if c_element.ns is not NULL:             # <<<<<<<<<<<<<<
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
 */
    }

    /* "src/lxml/proxy.pxi":362
 *             _fixCNs(doc, c_start_node, c_element, &c_ns_cache, c_del_ns_list)
 * 
 *         c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 */
    __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);

    /* "src/lxml/proxy.pxi":363
 * 
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_3) break;

      /* "src/lxml/proxy.pxi":364
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next
 */
      __pyx_t_3 = (__pyx_v_c_node->ns != NULL);
      if (__pyx_t_3) {

        /* "src/lxml/proxy.pxi":365
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__fixCNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_node, (&__pyx_v_c_ns_cache), __pyx_v_c_del_ns_list); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(6, 365, __pyx_L1_error)

        /* "src/lxml/proxy.pxi":364
 *         c_node = <xmlNode*>c_element.properties
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next
 */
      }

      /* "src/lxml/proxy.pxi":366
 *             if c_node.ns is not NULL:
 *                 _fixCNs(doc, c_start_node, c_node, &c_ns_cache, c_del_ns_list)
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     tree.END_FOR_EACH_FROM(c_element)
 */
      __pyx_t_11 = __pyx_v_c_node->next;
      __pyx_v_c_node = __pyx_t_11;
    }

    /* "src/lxml/proxy.pxi":344
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if hasProxy(c_element):
 *             proxy_count += 1
 */
  }

  /* "src/lxml/proxy.pxi":368
 *             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);

  /* "src/lxml/proxy.pxi":371
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
 */
  __pyx_t_3 = (__pyx_v_c_del_ns_list != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":372
 *     # 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);

    /* "src/lxml/proxy.pxi":371
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
 */
  }

  /* "src/lxml/proxy.pxi":375
 * 
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 * 
 */
  __pyx_t_3 = (__pyx_v_c_ns_cache.ns_map != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":376
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:
 *         python.lxml_free(c_ns_cache.ns_map)             # <<<<<<<<<<<<<<
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 */
    lxml_free(__pyx_v_c_ns_cache.ns_map);

    /* "src/lxml/proxy.pxi":375
 * 
 *     # cleanup
 *     if c_ns_cache.ns_map is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_cache.ns_map)
 * 
 */
  }

  /* "src/lxml/proxy.pxi":379
 * 
 *     # 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_3 = (__pyx_v_doc->_c_doc->dict != __pyx_v_c_source_doc->dict);
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":380
 *     # 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);

    /* "src/lxml/proxy.pxi":379
 * 
 *     # 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)
 * 
 */
  }

  /* "src/lxml/proxy.pxi":384
 *     # 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_10 = PyObject_RichCompare(__pyx_v_proxy_count, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 384, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(6, 384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":385
 *     #    (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_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_proxy_count, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(6, 385, __pyx_L1_error)
    if (__pyx_t_12) {
    } else {
      __pyx_t_3 = __pyx_t_12;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_c_start_node->_private != NULL);
    __pyx_t_3 = __pyx_t_12;
    __pyx_L24_bool_binop_done:;
    if (__pyx_t_3) {

      /* "src/lxml/proxy.pxi":386
 *     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_10 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_start_node)); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_v_proxy = ((struct LxmlElement *)__pyx_t_10);
      __pyx_t_10 = 0;

      /* "src/lxml/proxy.pxi":387
 *         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_3 = (((PyObject *)__pyx_v_proxy) != Py_None);
      if (__pyx_t_3) {

        /* "src/lxml/proxy.pxi":388
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 *                 if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                     proxy._doc = doc
 *             else:
 */
        __pyx_t_3 = (__pyx_v_proxy->_doc != __pyx_v_doc);
        if (__pyx_t_3) {

          /* "src/lxml/proxy.pxi":389
 *             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((PyObject *)__pyx_v_proxy->_doc);
          __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
          __pyx_v_proxy->_doc = __pyx_v_doc;

          /* "src/lxml/proxy.pxi":388
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 *                 if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                     proxy._doc = doc
 *             else:
 */
        }

        /* "src/lxml/proxy.pxi":387
 *         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
 */
        goto __pyx_L26;
      }

      /* "src/lxml/proxy.pxi":391
 *                     proxy._doc = doc
 *             else:
 *                 fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)
 */
      /*else*/ {
        __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_v_proxy_count); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 391, __pyx_L1_error)
        __pyx_t_8 = __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_t_13); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(6, 391, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "src/lxml/proxy.pxi":385
 *     #    (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:
 */
      goto __pyx_L23;
    }

    /* "src/lxml/proxy.pxi":393
 *                 fixElementDocument(c_start_node, doc, proxy_count)
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_v_proxy_count); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 393, __pyx_L1_error)
      __pyx_t_8 = __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_t_13); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(6, 393, __pyx_L1_error)
    }
    __pyx_L23:;

    /* "src/lxml/proxy.pxi":384
 *     # 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)
 */
  }

  /* "src/lxml/proxy.pxi":395
 *             fixElementDocument(c_start_node, doc, proxy_count)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":298
 * 
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     """Fix the xmlNs pointers of a node and its subtree that were moved.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.moveNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_proxy_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/proxy.pxi":398
 * 
 * 
 * cdef void _setTreeDoc(xmlNode* c_node, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlSetTreeDoc()' that deep-fixes the document links iteratively.
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
 */

static void __pyx_f_4lxml_5etree__setTreeDoc(xmlNode *__pyx_v_c_node, xmlDoc *__pyx_v_c_doc) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;

  /* "src/lxml/proxy.pxi":402
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":403
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":404
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 */
    __pyx_v_c_attr = ((xmlAttr *)__pyx_v_c_node->properties);

    /* "src/lxml/proxy.pxi":405
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:             # <<<<<<<<<<<<<<
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_attr != 0);
      if (!__pyx_t_1) break;

      /* "src/lxml/proxy.pxi":406
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
 */
      __pyx_t_1 = (__pyx_v_c_attr->atype == XML_ATTRIBUTE_ID);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":407
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)             # <<<<<<<<<<<<<<
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)
 */
        (void)(xmlRemoveID(__pyx_v_c_node->doc, __pyx_v_c_attr));

        /* "src/lxml/proxy.pxi":406
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
 */
      }

      /* "src/lxml/proxy.pxi":408
 *             if c_attr.atype == tree.XML_ATTRIBUTE_ID:
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_attr.children, c_doc)
 *             c_attr = c_attr.next
 */
      __pyx_v_c_attr->doc = __pyx_v_c_doc;

      /* "src/lxml/proxy.pxi":409
 *                 tree.xmlRemoveID(c_node.doc, c_attr)
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *     # Set doc link for all nodes, not only elements.
 */
      __pyx_f_4lxml_5etree__fixDocChildren(__pyx_v_c_attr->children, __pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":410
 *             c_attr.doc = c_doc
 *             _fixDocChildren(c_attr.children, c_doc)
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc
 */
      __pyx_t_2 = __pyx_v_c_attr->next;
      __pyx_v_c_attr = __pyx_t_2;
    }

    /* "src/lxml/proxy.pxi":403
 *     """
 *     tree.BEGIN_FOR_EACH_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = <tree.xmlAttr*>c_node.properties
 *         while c_attr:
 */
  }

  /* "src/lxml/proxy.pxi":412
 *             c_attr = c_attr.next
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
  __pyx_v_c_node->doc = __pyx_v_c_doc;

  /* "src/lxml/proxy.pxi":413
 *     # Set doc link for all nodes, not only elements.
 *     c_node.doc = c_doc
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":398
 * 
 * 
 * cdef void _setTreeDoc(xmlNode* c_node, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlSetTreeDoc()' that deep-fixes the document links iteratively.
 *     It avoids https://gitlab.gnome.org/GNOME/libxml2/issues/42
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":416
 * 
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     while c_child:
 *         c_child.doc = c_doc
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixDocChildren(xmlNode *__pyx_v_c_child, xmlDoc *__pyx_v_c_doc) {
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/proxy.pxi":417
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:
 *     while c_child:             # <<<<<<<<<<<<<<
 *         c_child.doc = c_doc
 *         if c_child.children:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":418
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:
 *     while c_child:
 *         c_child.doc = c_doc             # <<<<<<<<<<<<<<
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)
 */
    __pyx_v_c_child->doc = __pyx_v_c_doc;

    /* "src/lxml/proxy.pxi":419
 *     while c_child:
 *         c_child.doc = c_doc
 *         if c_child.children:             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next
 */
    __pyx_t_1 = (__pyx_v_c_child->children != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":420
 *         c_child.doc = c_doc
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
      __pyx_f_4lxml_5etree__fixDocChildren(__pyx_v_c_child->children, __pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":419
 *     while c_child:
 *         c_child.doc = c_doc
 *         if c_child.children:             # <<<<<<<<<<<<<<
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next
 */
    }

    /* "src/lxml/proxy.pxi":421
 *         if c_child.children:
 *             _fixDocChildren(c_child.children, c_doc)
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "src/lxml/proxy.pxi":416
 * 
 * 
 * cdef inline void _fixDocChildren(xmlNode* c_child, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *     while c_child:
 *         c_child.doc = c_doc
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":424
 * 
 * 
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
 */

static int __pyx_f_4lxml_5etree__fixCNs(struct LxmlDocument *__pyx_v_doc, 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_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_is_prefixed_attr;
  __pyx_t_4lxml_5etree__ns_update_map __pyx_v_ns_map;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_3;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_4;
  __pyx_t_4lxml_5etree__ns_update_map *__pyx_t_5;
  xmlNs *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fixCNs", 1);

  /* "src/lxml/proxy.pxi":426
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL             # <<<<<<<<<<<<<<
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)
 * 
 */
  __pyx_v_c_ns = NULL;

  /* "src/lxml/proxy.pxi":427
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)             # <<<<<<<<<<<<<<
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 */
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->ns->prefix != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_v_is_prefixed_attr = __pyx_t_1;

  /* "src/lxml/proxy.pxi":429
 *     cdef bint is_prefixed_attr = (c_node.type == tree.XML_ATTRIBUTE_NODE and c_node.ns.prefix)
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:             # <<<<<<<<<<<<<<
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:
 */
  __pyx_t_4 = (__pyx_v_c_ns_cache->ns_map + __pyx_v_c_ns_cache->last);
  for (__pyx_t_5 = __pyx_v_c_ns_cache->ns_map; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_ns_map = (__pyx_t_3[0]);

    /* "src/lxml/proxy.pxi":430
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:             # <<<<<<<<<<<<<<
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
 */
    __pyx_t_1 = (__pyx_v_c_node->ns == __pyx_v_ns_map.old);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":431
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:             # <<<<<<<<<<<<<<
 *                 # avoid dropping prefix from attributes
 *                 continue
 */
      if (__pyx_v_is_prefixed_attr) {
      } else {
        __pyx_t_1 = __pyx_v_is_prefixed_attr;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_2 = (!(__pyx_v_ns_map.new->prefix != 0));
      __pyx_t_1 = __pyx_t_2;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":433
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
 *                 continue             # <<<<<<<<<<<<<<
 *             c_ns = ns_map.new
 *             break
 */
        goto __pyx_L5_continue;

        /* "src/lxml/proxy.pxi":431
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:
 *             if is_prefixed_attr and not ns_map.new.prefix:             # <<<<<<<<<<<<<<
 *                 # avoid dropping prefix from attributes
 *                 continue
 */
      }

      /* "src/lxml/proxy.pxi":434
 *                 # avoid dropping prefix from attributes
 *                 continue
 *             c_ns = ns_map.new             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_t_6 = __pyx_v_ns_map.new;
      __pyx_v_c_ns = __pyx_t_6;

      /* "src/lxml/proxy.pxi":435
 *                 continue
 *             c_ns = ns_map.new
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if c_ns:
 */
      goto __pyx_L6_break;

      /* "src/lxml/proxy.pxi":430
 * 
 *     for ns_map in c_ns_cache.ns_map[:c_ns_cache.last]:
 *         if c_node.ns is ns_map.old:             # <<<<<<<<<<<<<<
 *             if is_prefixed_attr and not ns_map.new.prefix:
 *                 # avoid dropping prefix from attributes
 */
    }
    __pyx_L5_continue:;
  }
  __pyx_L6_break:;

  /* "src/lxml/proxy.pxi":437
 *             break
 * 
 *     if c_ns:             # <<<<<<<<<<<<<<
 *         c_node.ns = c_ns
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_ns != 0);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":438
 * 
 *     if c_ns:
 *         c_node.ns = c_ns             # <<<<<<<<<<<<<<
 *     else:
 *         # not in cache or not acceptable
 */
    __pyx_v_c_node->ns = __pyx_v_c_ns;

    /* "src/lxml/proxy.pxi":437
 *             break
 * 
 *     if c_ns:             # <<<<<<<<<<<<<<
 *         c_node.ns = c_ns
 *     else:
 */
    goto __pyx_L11;
  }

  /* "src/lxml/proxy.pxi":442
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 */
  /*else*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/proxy.pxi":443
 *         # => find a replacement from this document
 *         try:
 *             c_ns = doc._findOrBuildNodeNs(             # <<<<<<<<<<<<<<
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
 */
        __pyx_t_6 = __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_6 == ((xmlNs *)NULL))) __PYX_ERR(6, 443, __pyx_L12_error)
        __pyx_v_c_ns = __pyx_t_6;

        /* "src/lxml/proxy.pxi":446
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
 *             c_node.ns = c_ns             # <<<<<<<<<<<<<<
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:
 */
        __pyx_v_c_node->ns = __pyx_v_c_ns;

        /* "src/lxml/proxy.pxi":447
 *                 c_node.type == tree.XML_ATTRIBUTE_NODE)
 *             c_node.ns = c_ns
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)             # <<<<<<<<<<<<<<
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 */
        __pyx_t_10 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, __pyx_v_c_node->ns, __pyx_v_c_ns); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(6, 447, __pyx_L12_error)

        /* "src/lxml/proxy.pxi":442
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 */
      }
      __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_L17_try_end;
      __pyx_L12_error:;

      /* "src/lxml/proxy.pxi":448
 *             c_node.ns = c_ns
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:             # <<<<<<<<<<<<<<
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._fixCNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0) __PYX_ERR(6, 448, __pyx_L14_except_error)
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);

        /* "src/lxml/proxy.pxi":449
 *             _appendToNsCache(c_ns_cache, c_node.ns, c_ns)
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)             # <<<<<<<<<<<<<<
 *             raise
 *     return 0
 */
        __pyx_f_4lxml_5etree__cleanUpFromNamespaceAdaptation(__pyx_v_c_start_node, __pyx_v_c_ns_cache, __pyx_v_c_del_ns_list);

        /* "src/lxml/proxy.pxi":450
 *         except:
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
        __Pyx_GIVEREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; 
        __PYX_ERR(6, 450, __pyx_L14_except_error)
      }

      /* "src/lxml/proxy.pxi":442
 *         # not in cache or not acceptable
 *         # => find a replacement from this document
 *         try:             # <<<<<<<<<<<<<<
 *             c_ns = doc._findOrBuildNodeNs(
 *                 c_start_node, c_node.ns.href, c_node.ns.prefix,
 */
      __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_L1_error;
      __pyx_L17_try_end:;
    }
  }
  __pyx_L11:;

  /* "src/lxml/proxy.pxi":451
 *             _cleanUpFromNamespaceAdaptation(c_start_node, c_ns_cache, c_del_ns_list)
 *             raise
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":424
 * 
 * 
 * cdef int _fixCNs(_Document doc, xmlNode* c_start_node, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                  _nscache* c_ns_cache, xmlNs* c_del_ns_list) except -1:
 *     cdef xmlNs* c_ns = NULL
 */

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

/* "src/lxml/proxy.pxi":454
 * 
 * 
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element
 */

static int __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;
  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("fixElementDocument", 1);

  /* "src/lxml/proxy.pxi":456
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,
 *                              size_t proxy_count) except -1:
 *     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;

  /* "src/lxml/proxy.pxi":457
 *                              size_t proxy_count) except -1:
 *     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);

  /* "src/lxml/proxy.pxi":458
 *     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);

  /* "src/lxml/proxy.pxi":459
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":460
 *     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_ERR(6, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_proxy, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/proxy.pxi":461
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":462
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 *             if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                 proxy._doc = doc
 *             proxy_count -= 1
 */
      __pyx_t_1 = (__pyx_v_proxy->_doc != __pyx_v_doc);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":463
 *         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((PyObject *)__pyx_v_proxy->_doc);
        __Pyx_DECREF((PyObject *)__pyx_v_proxy->_doc);
        __pyx_v_proxy->_doc = __pyx_v_doc;

        /* "src/lxml/proxy.pxi":462
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 *             if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                 proxy._doc = doc
 *             proxy_count -= 1
 */
      }

      /* "src/lxml/proxy.pxi":464
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
 *             proxy_count -= 1             # <<<<<<<<<<<<<<
 *             if proxy_count == 0:
 *                 return 0
 */
      __pyx_v_proxy_count = (__pyx_v_proxy_count - 1);

      /* "src/lxml/proxy.pxi":465
 *                 proxy._doc = doc
 *             proxy_count -= 1
 *             if proxy_count == 0:             # <<<<<<<<<<<<<<
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)
 */
      __pyx_t_1 = (__pyx_v_proxy_count == 0);
      if (__pyx_t_1) {

        /* "src/lxml/proxy.pxi":466
 *             proxy_count -= 1
 *             if proxy_count == 0:
 *                 return 0             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/proxy.pxi":465
 *                 proxy._doc = doc
 *             proxy_count -= 1
 *             if proxy_count == 0:             # <<<<<<<<<<<<<<
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)
 */
      }

      /* "src/lxml/proxy.pxi":461
 *     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
 */
    }

    /* "src/lxml/proxy.pxi":459
 *     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:
 */
  }

  /* "src/lxml/proxy.pxi":467
 *             if proxy_count == 0:
 *                 return 0
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":454
 * 
 * 
 * cdef int fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count) except -1:
 *     cdef xmlNode* c_node = c_element
 */

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

/* "src/lxml/proxy.pxi":470
 * 
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) noexcept 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;

  /* "src/lxml/proxy.pxi":477
 *     # 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:
    case XML_HTML_DOCUMENT_NODE:

    /* "src/lxml/proxy.pxi":478
 *     # 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)
 */
    __pyx_t_1 = 1;

    /* "src/lxml/proxy.pxi":477
 *     # 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
 */
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":480
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":481
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
 */
    __pyx_t_1 = (__pyx_v_c_element->doc->extSubset != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":482
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 */
      __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(__pyx_v_c_element->doc->extSubset, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":481
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         if c_element.doc.extSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
 */
    }

    /* "src/lxml/proxy.pxi":483
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children
 */
    __pyx_t_1 = (__pyx_v_c_element->doc->intSubset != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":484
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_element = c_element.children
 *         while c_element is not NULL:
 */
      __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(__pyx_v_c_element->doc->intSubset, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":483
 *         if c_element.doc.extSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.extSubset, c_src_dict, c_dict)
 *         if c_element.doc.intSubset:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, c_src_dict, c_dict)
 *         c_element = c_element.children
 */
    }

    /* "src/lxml/proxy.pxi":485
 *         if c_element.doc.intSubset:
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, 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;

    /* "src/lxml/proxy.pxi":486
 *             fixThreadDictNamesForDtd(c_element.doc.intSubset, 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);
      if (!__pyx_t_1) break;

      /* "src/lxml/proxy.pxi":487
 *         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);

      /* "src/lxml/proxy.pxi":488
 *         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;
    }

    /* "src/lxml/proxy.pxi":477
 *     # 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
 */
    goto __pyx_L3;
  }

  /* "src/lxml/proxy.pxi":489
 *             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);
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":490
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":489
 *             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_L3:;

  /* "src/lxml/proxy.pxi":470
 * 
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":493
 * 
 * 
 * cdef inline void _fixThreadDictPtr(const_xmlChar** c_ptr,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__fixThreadDictPtr(const xmlChar **__pyx_v_c_ptr, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  const xmlChar *__pyx_v_c_str;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/proxy.pxi":496
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]             # <<<<<<<<<<<<<<
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):
 *         # return value can be NULL on memory error, but we don't handle that here
 */
  __pyx_v_c_str = (__pyx_v_c_ptr[0]);

  /* "src/lxml/proxy.pxi":497
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):             # <<<<<<<<<<<<<<
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 */
  __pyx_t_2 = (__pyx_v_c_str != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_src_dict != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_str) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":499
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)             # <<<<<<<<<<<<<<
 *         if c_str:
 *             c_ptr[0] = c_str
 */
    __pyx_v_c_str = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_str, -1);

    /* "src/lxml/proxy.pxi":500
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:             # <<<<<<<<<<<<<<
 *             c_ptr[0] = c_str
 * 
 */
    __pyx_t_1 = (__pyx_v_c_str != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":501
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:
 *             c_ptr[0] = c_str             # <<<<<<<<<<<<<<
 * 
 * 
 */
      (__pyx_v_c_ptr[0]) = __pyx_v_c_str;

      /* "src/lxml/proxy.pxi":500
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 *         if c_str:             # <<<<<<<<<<<<<<
 *             c_ptr[0] = c_str
 * 
 */
    }

    /* "src/lxml/proxy.pxi":497
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 *     c_str = c_ptr[0]
 *     if c_str and c_src_dict and tree.xmlDictOwns(c_src_dict, c_str):             # <<<<<<<<<<<<<<
 *         # return value can be NULL on memory error, but we don't handle that here
 *         c_str = tree.xmlDictLookup(c_dict, c_str, -1)
 */
  }

  /* "src/lxml/proxy.pxi":493
 * 
 * 
 * cdef inline void _fixThreadDictPtr(const_xmlChar** c_ptr,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":504
 * 
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept 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;

  /* "src/lxml/proxy.pxi":507
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 */
  __pyx_v_c_node = __pyx_v_c_element;

  /* "src/lxml/proxy.pxi":508
 *                                     tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "src/lxml/proxy.pxi":509
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:
    case XML_XINCLUDE_START:

    /* "src/lxml/proxy.pxi":510
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     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);

    /* "src/lxml/proxy.pxi":512
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":513
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_node.name, 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__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":509
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 */
    break;
    case XML_TEXT_NODE:

    /* "src/lxml/proxy.pxi":516
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         pass  # don't touch c_node.name
 */
    __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":514
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_node.name, 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)
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/proxy.pxi":517
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         pass  # don't touch c_node.name
 *     else:
 */
    break;
    default:

    /* "src/lxml/proxy.pxi":520
 *         pass  # don't touch c_node.name
 *     else:
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);
    break;
  }

  /* "src/lxml/proxy.pxi":521
 *     else:
 *         _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "src/lxml/proxy.pxi":504
 * 
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":524
 * 
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) noexcept 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;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/proxy.pxi":528
 *                                                  tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
 */
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_attr);

  /* "src/lxml/proxy.pxi":529
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/proxy.pxi":530
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 */
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_COMMENT_NODE:
      __pyx_t_1 = 0;
      break;
      default:
      __pyx_t_1 = 1;
      break;
    }
    __pyx_t_2 = __pyx_t_1;
    if (__pyx_t_2) {

      /* "src/lxml/proxy.pxi":531
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 */
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_node->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":530
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         if c_node.type not in (tree.XML_TEXT_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_node.name, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 */
    }

    /* "src/lxml/proxy.pxi":533
 *             _fixThreadDictPtr(&c_node.name, 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_3 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_3;

    /* "src/lxml/proxy.pxi":534
 *         # 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_2 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_2) break;

      /* "src/lxml/proxy.pxi":535
 *         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);

      /* "src/lxml/proxy.pxi":536
 *         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_3 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_3;
    }

    /* "src/lxml/proxy.pxi":537
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/proxy.pxi":524
 * 
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":540
 * 
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept 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;

  /* "src/lxml/proxy.pxi":543
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept 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_2 = (__pyx_v_c_node->content != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/proxy.pxi":544
 *                                              tree.xmlDict* c_dict) noexcept 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)));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/proxy.pxi":543
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept 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):
 */
  if (__pyx_t_1) {

    /* "src/lxml/proxy.pxi":545
 *     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_1 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->content) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/proxy.pxi":547
 *         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_v_c_node->content = ((xmlChar *)xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->content, -1));

      /* "src/lxml/proxy.pxi":545
 *     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)
 */
    }

    /* "src/lxml/proxy.pxi":543
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept 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):
 */
  }

  /* "src/lxml/proxy.pxi":540
 * 
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":550
 * 
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept 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;

  /* "src/lxml/proxy.pxi":553
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/proxy.pxi":554
 *                                         tree.xmlDict* c_dict) noexcept nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":555
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
 *         c_ns = c_ns.next
 */
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_ns->href), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":556
 *     while c_ns is not NULL:
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 * 
 */
    __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_ns->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "src/lxml/proxy.pxi":557
 *         _fixThreadDictPtr(&c_ns.href, c_src_dict, c_dict)
 *         _fixThreadDictPtr(&c_ns.prefix, c_src_dict, c_dict)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":550
 * 
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":560
 * 
 * 
 * cdef void fixThreadDictNamesForDtd(tree.xmlDtd* c_dtd,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 */

static void __pyx_f_4lxml_5etree_fixThreadDictNamesForDtd(xmlDtd *__pyx_v_c_dtd, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_node;
  xmlElement *__pyx_v_c_element;
  xmlAttribute *__pyx_v_c_attribute;
  xmlEntity *__pyx_v_c_entity;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlAttribute *__pyx_t_3;

  /* "src/lxml/proxy.pxi":568
 *     cdef tree.xmlEntity* c_entity
 * 
 *     c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 */
  __pyx_t_1 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/proxy.pxi":569
 * 
 *     c_node = c_dtd.children
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != 0);
    if (!__pyx_t_2) break;

    /* "src/lxml/proxy.pxi":570
 *     c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
 */
    switch (__pyx_v_c_node->type) {
      case XML_ELEMENT_DECL:

      /* "src/lxml/proxy.pxi":571
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node             # <<<<<<<<<<<<<<
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 */
      __pyx_v_c_element = ((xmlElement *)__pyx_v_c_node);

      /* "src/lxml/proxy.pxi":572
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 */
      __pyx_t_2 = (__pyx_v_c_element->content != 0);
      if (__pyx_t_2) {

        /* "src/lxml/proxy.pxi":573
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_element->content->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":574
 *             if c_element.content:
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_attribute = c_element.attributes
 *             while c_attribute:
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_element->content->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":572
 *         if c_node.type == tree.XML_ELEMENT_DECL:
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 */
      }

      /* "src/lxml/proxy.pxi":575
 *                 _fixThreadDictPtr(&c_element.content.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes             # <<<<<<<<<<<<<<
 *             while c_attribute:
 *                 _fixThreadDictPtr(&c_attribute.defaultValue, c_src_dict, c_dict)
 */
      __pyx_t_3 = __pyx_v_c_element->attributes;
      __pyx_v_c_attribute = __pyx_t_3;

      /* "src/lxml/proxy.pxi":576
 *                 _fixThreadDictPtr(&c_element.content.prefix, c_src_dict, c_dict)
 *             c_attribute = c_element.attributes
 *             while c_attribute:             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.defaultValue, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 */
      while (1) {
        __pyx_t_2 = (__pyx_v_c_attribute != 0);
        if (!__pyx_t_2) break;

        /* "src/lxml/proxy.pxi":577
 *             c_attribute = c_element.attributes
 *             while c_attribute:
 *                 _fixThreadDictPtr(&c_attribute.defaultValue, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->defaultValue), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":578
 *             while c_attribute:
 *                 _fixThreadDictPtr(&c_attribute.defaultValue, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":579
 *                 _fixThreadDictPtr(&c_attribute.defaultValue, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->prefix), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":580
 *                 _fixThreadDictPtr(&c_attribute.name, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 */
        __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_attribute->elem), __pyx_v_c_src_dict, __pyx_v_c_dict);

        /* "src/lxml/proxy.pxi":581
 *                 _fixThreadDictPtr(&c_attribute.prefix, c_src_dict, c_dict)
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node
 */
        __pyx_t_3 = __pyx_v_c_attribute->nexth;
        __pyx_v_c_attribute = __pyx_t_3;
      }

      /* "src/lxml/proxy.pxi":570
 *     c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *             c_element = <tree.xmlElement*>c_node
 *             if c_element.content:
 */
      break;
      case XML_ENTITY_DECL:

      /* "src/lxml/proxy.pxi":583
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 */
      __pyx_v_c_entity = ((xmlEntity *)__pyx_v_c_node);

      /* "src/lxml/proxy.pxi":584
 *         elif c_node.type == tree.XML_ENTITY_DECL:
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 */
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->name), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":585
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
 */
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->ExternalID), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":586
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
 *         c_node = c_node.next
 */
      __pyx_f_4lxml_5etree__fixThreadDictPtr((&__pyx_v_c_entity->SystemID), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":587
 *             _fixThreadDictPtr(&c_entity.ExternalID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
 */
      __pyx_f_4lxml_5etree__fixThreadDictPtr(((const xmlChar **)(&__pyx_v_c_entity->content)), __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "src/lxml/proxy.pxi":582
 *                 _fixThreadDictPtr(&c_attribute.elem, c_src_dict, c_dict)
 *                 c_attribute = c_attribute.nexth
 *         elif c_node.type == tree.XML_ENTITY_DECL:             # <<<<<<<<<<<<<<
 *             c_entity = <tree.xmlEntity*>c_node
 *             _fixThreadDictPtr(&c_entity.name, c_src_dict, c_dict)
 */
      break;
      default: break;
    }

    /* "src/lxml/proxy.pxi":588
 *             _fixThreadDictPtr(&c_entity.SystemID, c_src_dict, c_dict)
 *             _fixThreadDictPtr(<const_xmlChar**>&c_entity.content, c_src_dict, c_dict)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "src/lxml/proxy.pxi":560
 * 
 * 
 * cdef void fixThreadDictNamesForDtd(tree.xmlDtd* c_dtd,             # <<<<<<<<<<<<<<
 *                                    tree.xmlDict* c_src_dict,
 *                                    tree.xmlDict* c_dict) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/proxy.pxi":594
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__adoptForeignDoc(xmlDoc *__pyx_v_c_doc, struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc *__pyx_optional_args) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
  int __pyx_v_is_owned = ((int)1);
  xmlElementType __pyx_v_doc_type;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlElementType __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_adoptForeignDoc", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parser = __pyx_optional_args->parser;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_is_owned = __pyx_optional_args->is_owned;
      }
    }
  }

  /* "src/lxml/proxy.pxi":599
 *     dereference into lxml proxy objects.
 *     """
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 */
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/proxy.pxi":600
 *     """
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")             # <<<<<<<<<<<<<<
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 600, __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_ERR(6, 600, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":599
 *     dereference into lxml proxy objects.
 *     """
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 */
  }

  /* "src/lxml/proxy.pxi":601
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         doc_type = c_doc.type
 *         if is_owned:
 */
  switch (__pyx_v_c_doc->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  __pyx_t_3 = __pyx_t_1;
  if (__pyx_t_3) {

    /* "src/lxml/proxy.pxi":602
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type             # <<<<<<<<<<<<<<
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)
 */
    __pyx_t_4 = __pyx_v_c_doc->type;
    __pyx_v_doc_type = __pyx_t_4;

    /* "src/lxml/proxy.pxi":603
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 *         if is_owned:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 */
    if (__pyx_v_is_owned) {

      /* "src/lxml/proxy.pxi":604
 *         doc_type = c_doc.type
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 * 
 */
      xmlFreeDoc(__pyx_v_c_doc);

      /* "src/lxml/proxy.pxi":603
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 *         if is_owned:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 */
    }

    /* "src/lxml/proxy.pxi":605
 *         if is_owned:
 *             tree.xmlFreeDoc(c_doc)
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
 */
    __pyx_t_2 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_doc_type, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Illegal_document_provided_expect, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 605, __pyx_L1_error)

    /* "src/lxml/proxy.pxi":601
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         doc_type = c_doc.type
 *         if is_owned:
 */
  }

  /* "src/lxml/proxy.pxi":607
 *         raise ValueError(f"Illegal document provided: expected XML or HTML, found {doc_type}")
 * 
 *     cdef xmlNode* c_node = <xmlNode*>c_doc             # <<<<<<<<<<<<<<
 * 
 *     if is_owned:
 */
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_doc);

  /* "src/lxml/proxy.pxi":609
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
 * 
 *     if is_owned:             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
 */
  if (__pyx_v_is_owned) {

    /* "src/lxml/proxy.pxi":610
 * 
 *     if is_owned:
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *         c_node._private = NULL
 *         tree.END_FOR_EACH_FROM(c_node)
 */
    BEGIN_FOR_EACH_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

    /* "src/lxml/proxy.pxi":611
 *     if is_owned:
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_FROM(c_node)
 *     else:
 */
    __pyx_v_c_node->_private = NULL;

    /* "src/lxml/proxy.pxi":612
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
 *         tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         # create a fresh copy that lxml owns
 */
    END_FOR_EACH_FROM(__pyx_v_c_node);

    /* "src/lxml/proxy.pxi":609
 *     cdef xmlNode* c_node = <xmlNode*>c_doc
 * 
 *     if is_owned:             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_FROM(<xmlNode*>c_doc, c_node, 1)
 *         c_node._private = NULL
 */
    goto __pyx_L6;
  }

  /* "src/lxml/proxy.pxi":615
 *     else:
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             raise MemoryError()
 */
  /*else*/ {
    __pyx_v_c_doc = xmlCopyDoc(__pyx_v_c_doc, 1);

    /* "src/lxml/proxy.pxi":616
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
    __pyx_t_3 = (__pyx_v_c_doc == NULL);
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/proxy.pxi":617
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     return _documentFactory(c_doc, parser)
 */
      PyErr_NoMemory(); __PYX_ERR(6, 617, __pyx_L1_error)

      /* "src/lxml/proxy.pxi":616
 *         # create a fresh copy that lxml owns
 *         c_doc = tree.xmlCopyDoc(c_doc, 1)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
    }
  }
  __pyx_L6:;

  /* "src/lxml/proxy.pxi":619
 *             raise MemoryError()
 * 
 *     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_ERR(6, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/proxy.pxi":594
 * # adopt an xmlDoc from an external libxml2 document source
 * 
 * cdef _Document _adoptForeignDoc(xmlDoc* c_doc, _BaseParser parser=None, bint is_owned=True):             # <<<<<<<<<<<<<<
 *     """Convert and wrap an externally produced xmlDoc for use in lxml.
 *     Assures that all '_private' pointers are NULL to prevent accidental
 */

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

/* "src/lxml/apihelpers.pxi":6
 * 
 * 
 * cdef void displayNode(xmlNode* c_node, indent) noexcept:             # <<<<<<<<<<<<<<
 *     # 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("displayNode", 1);

  /* "src/lxml/apihelpers.pxi":9
 *     # to help with debugging
 *     cdef xmlNode* c_child
 *     try:             # <<<<<<<<<<<<<<
 *         print(indent * ' ', <long>c_node)
 *         c_child = c_node.children
 */
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":10
 *     cdef xmlNode* c_child
 *     try:
 *         print(indent * ' ', <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__11); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 10, __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_ERR(7, 10, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 10, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(7, 10, __pyx_L4_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(7, 10, __pyx_L4_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 10, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":11
 *     try:
 *         print(indent * ' ', <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;

    /* "src/lxml/apihelpers.pxi":12
 *         print(indent * ' ', <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);
      if (!__pyx_t_5) break;

      /* "src/lxml/apihelpers.pxi":13
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *     finally:
 */
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_indent, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_f_4lxml_5etree_displayNode(__pyx_v_c_child, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":14
 *         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;
    }
  }

  /* "src/lxml/apihelpers.pxi":16
 *             c_child = c_child.next
 *     finally:
 *         return  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
    }
  }

  /* "src/lxml/apihelpers.pxi":6
 * 
 * 
 * cdef void displayNode(xmlNode* c_node, indent) noexcept:             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
 */

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

/* "src/lxml/apihelpers.pxi":18
 *         return  # swallow any exceptions
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node = element._c_node
 *     return (
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__isHtmlDocument(struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":19
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:
 *     cdef xmlNode* c_node = element._c_node             # <<<<<<<<<<<<<<
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and
 */
  __pyx_t_1 = __pyx_v_element->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":21
 *     cdef xmlNode* c_node = element._c_node
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and             # <<<<<<<<<<<<<<
 *         c_node.doc.properties & tree.XML_DOC_HTML != 0
 *     )
 */
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->doc != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":22
 *     return (
 *         c_node is not NULL and c_node.doc is not NULL and
 *         c_node.doc.properties & tree.XML_DOC_HTML != 0             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_3 = ((__pyx_v_c_node->doc->properties & XML_DOC_HTML) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":18
 *         return  # swallow any exceptions
 * 
 * cdef inline bint _isHtmlDocument(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node = element._c_node
 *     return (
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":25
 *     )
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, "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
  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("_assertValidNode", 1);

  /* "src/lxml/apihelpers.pxi":26
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_element->_c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 26, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_Element_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 26, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(7, 26, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 26, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":25
 *     )
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
 */

  /* 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._assertValidNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":28
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, "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
  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("_assertValidDoc", 1);

  /* "src/lxml/apihelpers.pxi":29
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentOrRaise(object input):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_doc->_c_doc != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_doc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_Document_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(7, 29, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 29, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":28
 *     assert element._c_node is not NULL, "invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
 */

  /* 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._assertValidDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":31
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """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;
  PyObject *__pyx_t_2 = NULL;
  const char *__pyx_t_3;
  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("_documentOrRaise", 1);

  /* "src/lxml/apihelpers.pxi":38
 *     """
 *     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, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":39
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 */
    __pyx_t_1 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":40
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
 */
      __pyx_t_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":39
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 */
      goto __pyx_L4;
    }

    /* "src/lxml/apihelpers.pxi":42
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);
    }
    __pyx_L4:;

    /* "src/lxml/apihelpers.pxi":38
 *     """
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":43
 *         else:
 *             doc = None
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":44
 *             doc = None
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
 */
    __pyx_t_2 = ((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":43
 *         else:
 *             doc = None
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":45
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_ptype_4lxml_5etree__Document); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":46
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 */
    __pyx_t_2 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":45
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":48
 *         doc = <_Document>input
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 */
  /*else*/ {
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(7, 48, __pyx_L1_error)
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_input_object, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(7, 48, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":49
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":50
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     _assertValidDoc(doc)
 *     return doc
 */
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(7, 50, __pyx_L1_error)
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Input_object_has_no_document, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(7, 50, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":49
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Input object has no document: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidDoc(doc)
 */
  }

  /* "src/lxml/apihelpers.pxi":51
 *     if doc is None:
 *         raise ValueError, f"Input object has no document: {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 == ((int)-1))) __PYX_ERR(7, 51, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":52
 *         raise ValueError, f"Input object has no document: {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;

  /* "src/lxml/apihelpers.pxi":31
 *     assert doc._c_doc is not NULL, "invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """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_2);
  __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;
}

/* "src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """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;
  PyObject *__pyx_t_2 = NULL;
  const char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rootNodeOrRaise", 1);

  /* "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, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "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_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":61
 *      """
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 */
    goto __pyx_L3;
  }

  /* "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_1 = __Pyx_TypeCheck(__pyx_v_input, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "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_2 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "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):
 */
    goto __pyx_L3;
  }

  /* "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, __pyx_ptype_4lxml_5etree__Document); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":66
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 66, __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_ERR(7, 66, __pyx_L1_error)
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":65
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         node = (<_Document>input).getroot()
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":68
 *         node = (<_Document>input).getroot()
 *     else:
 *         raise TypeError, f"Invalid input object: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 */
  /*else*/ {
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(7, 68, __pyx_L1_error)
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_input_object, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(7, 68, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {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, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 */
  __pyx_t_6 = (((PyObject *)__pyx_v_node) == Py_None);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_node->_c_node != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":70
 *         raise TypeError, f"Invalid input object: {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, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)
 */
  __pyx_t_6 = (__pyx_v_node->_c_node->type != XML_ELEMENT_NODE);
  __pyx_t_1 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {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, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 */
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":71
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     _assertValidNode(node)
 *     return node
 */
    __pyx_t_3 = _fqtypename(__pyx_v_input);
    __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(7, 71, __pyx_L1_error)
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_3, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Input_object_is_not_an_XML_eleme, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(7, 71, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, f"Invalid input object: {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, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 */
  }

  /* "src/lxml/apihelpers.pxi":72
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_t_7 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 72, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":73
 *         raise ValueError, f"Input object is not an XML element: {python._fqtypename(input).decode('utf8')}"
 *     _assertValidNode(node)
 *     return node             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     """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_2);
  __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;
}

/* "src/lxml/apihelpers.pxi":75
 *     return node
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node is c_ancestor:
 */

static int __pyx_f_4lxml_5etree__isAncestorOrSame(xmlNode *__pyx_v_c_ancestor, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":76
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node is c_ancestor:
 *             return True
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":77
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:
 *         if c_node is c_ancestor:             # <<<<<<<<<<<<<<
 *             return True
 *         c_node = c_node.parent
 */
    __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_ancestor);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":78
 *     while c_node:
 *         if c_node is c_ancestor:
 *             return True             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     return False
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":77
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:
 *     while c_node:
 *         if c_node is c_ancestor:             # <<<<<<<<<<<<<<
 *             return True
 *         c_node = c_node.parent
 */
    }

    /* "src/lxml/apihelpers.pxi":79
 *         if c_node is c_ancestor:
 *             return True
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "src/lxml/apihelpers.pxi":80
 *             return True
 *         c_node = c_node.parent
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":75
 *     return node
 * 
 * cdef bint _isAncestorOrSame(xmlNode* c_ancestor, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node is c_ancestor:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":82
 *     return False
 * 
 * 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;
  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;
  xmlNode *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_makeElement", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "src/lxml/apihelpers.pxi":100
 *     """
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":101
 *     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_2 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":100
 *     """
 *     cdef xmlNode* c_node
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 */
  }

  /* "src/lxml/apihelpers.pxi":102
 *     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_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 102, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_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_ERR(7, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 102, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_name_utf = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":103
 *         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_6 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_parser->_for_html;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":104
 *     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 == ((int)-1))) __PYX_ERR(7, 104, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":105
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":106
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(7, 106, __pyx_L1_error)
      __pyx_v_c_doc = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":105
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newHTMLDoc()
 *     else:
 */
    }

    /* "src/lxml/apihelpers.pxi":103
 *         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:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":108
 *             c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 */
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 108, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":109
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":110
 *         _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_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(7, 110, __pyx_L1_error)
      __pyx_v_c_doc = __pyx_t_2;

      /* "src/lxml/apihelpers.pxi":109
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
    }
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":111
 *         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 == ((xmlNode *)NULL))) __PYX_ERR(7, 111, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_8;

  /* "src/lxml/apihelpers.pxi":112
 *             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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":113
 *     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_6 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_c_doc != NULL);
    __pyx_t_1 = __pyx_t_6;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":114
 *     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);

      /* "src/lxml/apihelpers.pxi":113
 *     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()
 */
    }

    /* "src/lxml/apihelpers.pxi":115
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     try:
 *         if doc is None:
 */
    PyErr_NoMemory(); __PYX_ERR(7, 115, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":112
 *             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)
 */
  }

  /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":117
 *         raise MemoryError()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 */
      __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":118
 *     try:
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 */
        (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node));

        /* "src/lxml/apihelpers.pxi":119
 *         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_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 119, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":117
 *         raise MemoryError()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 */
      }

      /* "src/lxml/apihelpers.pxi":120
 *             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);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":121
 *             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 == ((int)-1))) __PYX_ERR(7, 121, __pyx_L13_error)

        /* "src/lxml/apihelpers.pxi":120
 *             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:
 */
      }

      /* "src/lxml/apihelpers.pxi":122
 *         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_1 = (__pyx_v_tail != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":123
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(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 == ((int)-1))) __PYX_ERR(7, 123, __pyx_L13_error)

        /* "src/lxml/apihelpers.pxi":122
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 */
      }

      /* "src/lxml/apihelpers.pxi":125
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(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__setNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 125, __pyx_L13_error)

      /* "src/lxml/apihelpers.pxi":126
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(doc, c_node)
 *     except:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 126, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":127
 *         _setNodeNamespaces(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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 127, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = ((struct LxmlElement *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L17_try_return;

      /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 */
    }
    __pyx_L13_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;

    /* "src/lxml/apihelpers.pxi":128
 *         _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_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(7, 128, __pyx_L15_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);

      /* "src/lxml/apihelpers.pxi":130
 *     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);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":132
 *         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);
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":133
 *             # 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);

          /* "src/lxml/apihelpers.pxi":132
 *         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)
 */
        }

        /* "src/lxml/apihelpers.pxi":134
 *             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);

        /* "src/lxml/apihelpers.pxi":130
 *     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:
 */
      }

      /* "src/lxml/apihelpers.pxi":135
 *                 _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_1 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":137
 *         if doc is None:
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
        xmlFreeDoc(__pyx_v_c_doc);

        /* "src/lxml/apihelpers.pxi":135
 *                 _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)
 */
      }

      /* "src/lxml/apihelpers.pxi":138
 *             # 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_3);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4);
      __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; 
      __PYX_ERR(7, 138, __pyx_L15_except_error)
    }

    /* "src/lxml/apihelpers.pxi":116
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 */
    __pyx_L15_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L17_try_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":82
 *     return False
 * 
 * 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/apihelpers.pxi":140
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     """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;
  xmlDoc *__pyx_t_2;
  xmlNode *__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("_initNewElement", 1);

  /* "src/lxml/apihelpers.pxi":150
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
 */
  if (__pyx_v_is_html) {

    /* "src/lxml/apihelpers.pxi":151
 *     cdef _Document doc
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newHTMLDoc()
 *     else:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 151, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":152
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(7, 152, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":150
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":154
 *         c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 154, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":155
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(7, 155, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_2;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":156
 *         _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_3 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((xmlNode *)NULL))) __PYX_ERR(7, 156, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":157
 *         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_4 = (__pyx_v_c_node == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":158
 *     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_4 = (__pyx_v_c_doc != NULL);
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":159
 *     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);

      /* "src/lxml/apihelpers.pxi":158
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 */
    }

    /* "src/lxml/apihelpers.pxi":160
 *         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_ERR(7, 160, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":157
 *         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)
 */
  }

  /* "src/lxml/apihelpers.pxi":161
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 */
  (void)(xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node));

  /* "src/lxml/apihelpers.pxi":162
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(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_ERR(7, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":164
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 164, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":165
 *     # add namespaces to node if necessary
 *     _setNodeNamespaces(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_ERR(7, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":166
 *     _setNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)             # <<<<<<<<<<<<<<
 *     element._init()
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_element, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 166, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":167
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 *     element._init()             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_init_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":168
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":140
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     """Initialise a new Element object.
 */

  /* 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._initNewElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":170
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     """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;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlDoc *__pyx_t_7;
  xmlNode *__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;
  __Pyx_RefNannySetupContext("_makeSubElement", 1);

  /* "src/lxml/apihelpers.pxi":177
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_parent) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_parent->_doc) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":178
 *     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_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":177
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
 */
  }

  /* "src/lxml/apihelpers.pxi":179
 *     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_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 179, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":180
 *         return None
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     c_doc = parent._doc._c_doc
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 180, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 180, __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;

  /* "src/lxml/apihelpers.pxi":181
 *     _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_7 = __pyx_v_parent->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_7;

  /* "src/lxml/apihelpers.pxi":183
 *     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_2 = (((PyObject *)__pyx_v_parent->_doc->_parser) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_parent->_doc->_parser->_for_html;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":184
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 184, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":183
 *     c_doc = parent._doc._c_doc
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/apihelpers.pxi":186
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 * 
 *     c_node = _createElement(c_doc, name_utf)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 186, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "src/lxml/apihelpers.pxi":188
 *         _tagValidOrRaise(name_utf)
 * 
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise MemoryError()
 */
  __pyx_t_8 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_8 == ((xmlNode *)NULL))) __PYX_ERR(7, 188, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_8;

  /* "src/lxml/apihelpers.pxi":189
 * 
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":190
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 */
    PyErr_NoMemory(); __PYX_ERR(7, 190, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":189
 * 
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)
 */
  }

  /* "src/lxml/apihelpers.pxi":191
 *     if c_node is NULL:
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  (void)(xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node));

  /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":194
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      __pyx_t_1 = (__pyx_v_text != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":195
 *     try:
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 195, __pyx_L10_error)

        /* "src/lxml/apihelpers.pxi":194
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      }

      /* "src/lxml/apihelpers.pxi":196
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
 */
      __pyx_t_1 = (__pyx_v_tail != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":197
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 * 
 *         # add namespaces to node if necessary
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 197, __pyx_L10_error)

        /* "src/lxml/apihelpers.pxi":196
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
 */
      }

      /* "src/lxml/apihelpers.pxi":200
 * 
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_4), __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 200, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":201
 *         # add namespaces to node if necessary
 *         _setNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(parent._doc, c_node)
 *     except:
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_4), __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 201, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/apihelpers.pxi":202
 *         _setNodeNamespaces(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_6 = ((PyObject *)__pyx_v_parent->_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_ERR(7, 202, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L14_try_return;

      /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
    }
    __pyx_L10_error:;
    __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;

    /* "src/lxml/apihelpers.pxi":203
 *         _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_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(7, 203, __pyx_L12_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);

      /* "src/lxml/apihelpers.pxi":205
 *     except:
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
      __pyx_t_12 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_3 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_12), __pyx_v_c_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 205, __pyx_L12_except_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "src/lxml/apihelpers.pxi":206
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_5);
      __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; 
      __PYX_ERR(7, 206, __pyx_L12_except_error)
    }

    /* "src/lxml/apihelpers.pxi":193
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
    __pyx_L12_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L14_try_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":170
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     """Create a new child element and initialize text content, namespaces and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __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;
}

/* "src/lxml/apihelpers.pxi":209
 * 
 * 
 * cdef int _setNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                             object node_ns_utf, object nsmap) except -1:
 *     """Lookup current namespace prefixes, then set namespace structure for
 */

static int __pyx_f_4lxml_5etree__setNodeNamespaces(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_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;
  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)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setNodeNamespaces", 0);
  __Pyx_INCREF(__pyx_v_node_ns_utf);

  /* "src/lxml/apihelpers.pxi":219
 *     cdef list nsdefs
 * 
 *     if nsmap:             # <<<<<<<<<<<<<<
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 219, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":220
 * 
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__iter_nsmap(__pyx_v_nsmap); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 220, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 220, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 220, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 220, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 220, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 220, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 220, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 220, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(7, 220, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        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_ERR(7, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 220, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
        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_ERR(7, 220, __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_ERR(7, 220, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_href, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/apihelpers.pxi":221
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)             # <<<<<<<<<<<<<<
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_href); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/apihelpers.pxi":222
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)             # <<<<<<<<<<<<<<
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:
 */
      __pyx_t_10 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_href_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(7, 222, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":223
 *             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);

      /* "src/lxml/apihelpers.pxi":224
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:             # <<<<<<<<<<<<<<
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)
 */
      __pyx_t_1 = (__pyx_v_prefix != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":225
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:
 *                 prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *                 _prefixValidOrRaise(prefix_utf)
 *                 c_prefix = _xcstr(prefix_utf)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 225, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":226
 *             if prefix is not None:
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *                 c_prefix = _xcstr(prefix_utf)
 *             else:
 */
        __pyx_t_10 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(7, 226, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":227
 *                 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);

        /* "src/lxml/apihelpers.pxi":224
 *             _uriValidOrRaise(href_utf)
 *             c_href = _xcstr(href_utf)
 *             if prefix is not None:             # <<<<<<<<<<<<<<
 *                 prefix_utf = _utf8(prefix)
 *                 _prefixValidOrRaise(prefix_utf)
 */
        goto __pyx_L8;
      }

      /* "src/lxml/apihelpers.pxi":229
 *                 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)
 */
      /*else*/ {
        __pyx_v_c_prefix = ((const xmlChar *)NULL);
      }
      __pyx_L8:;

      /* "src/lxml/apihelpers.pxi":231
 *                 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);

      /* "src/lxml/apihelpers.pxi":232
 *             # 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_11 = (__pyx_v_c_ns == NULL);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_1 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "src/lxml/apihelpers.pxi":233
 *             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_11 = (__pyx_v_c_ns->href == NULL);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_1 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "src/lxml/apihelpers.pxi":234
 *             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_11 = (xmlStrcmp(__pyx_v_c_ns->href, __pyx_v_c_href) != 0);
      __pyx_t_1 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;

      /* "src/lxml/apihelpers.pxi":232
 *             # 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:
 */
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":235
 *                     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);

        /* "src/lxml/apihelpers.pxi":232
 *             # 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:
 */
      }

      /* "src/lxml/apihelpers.pxi":236
 *                     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_1 = (__Pyx_PyBytes_Equals(__pyx_v_href_utf, __pyx_v_node_ns_utf, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 236, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":237
 *                 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);

        /* "src/lxml/apihelpers.pxi":238
 *             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);

        /* "src/lxml/apihelpers.pxi":236
 *                     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
 */
      }

      /* "src/lxml/apihelpers.pxi":220
 * 
 *     if nsmap:
 *         for prefix, href in _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *             href_utf = _utf8(href)
 *             _uriValidOrRaise(href_utf)
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":219
 *     cdef list nsdefs
 * 
 *     if nsmap:             # <<<<<<<<<<<<<<
 *         for prefix, href in _iter_nsmap(nsmap):
 *             href_utf = _utf8(href)
 */
  }

  /* "src/lxml/apihelpers.pxi":240
 *                 node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 */
  __pyx_t_1 = (__pyx_v_node_ns_utf != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":241
 * 
 *     if node_ns_utf is not None:
 *         _uriValidOrRaise(node_ns_utf)             # <<<<<<<<<<<<<<
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0
 */
    __pyx_t_10 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_node_ns_utf); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(7, 241, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":242
 *     if node_ns_utf is not None:
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_10 = __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_10 == ((int)-1))) __PYX_ERR(7, 242, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":240
 *                 node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 */
  }

  /* "src/lxml/apihelpers.pxi":243
 *         _uriValidOrRaise(node_ns_utf)
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":209
 * 
 * 
 * cdef int _setNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                             object node_ns_utf, object nsmap) except -1:
 *     """Lookup current namespace prefixes, then set namespace structure for
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_AddTraceback("lxml.etree._setNodeNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __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;
}

/* "src/lxml/apihelpers.pxi":246
 * 
 * 
 * cdef dict _build_nsmap(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """
 *     Namespace prefix->URI mapping known in the context of this Element.
 */

static PyObject *__pyx_f_4lxml_5etree__build_nsmap(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
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNs *__pyx_t_4;
  xmlNode *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_nsmap", 1);

  /* "src/lxml/apihelpers.pxi":252
 *     """
 *     cdef xmlNs* c_ns
 *     nsmap = {}             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *         c_ns = c_node.nsDef
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nsmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":253
 *     cdef xmlNs* c_ns
 *     nsmap = {}
 *     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_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":254
 *     nsmap = {}
 *     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:
 *             if c_ns.prefix or c_ns.href:
 */
    __pyx_t_4 = __pyx_v_c_node->nsDef;
    __pyx_v_c_ns = __pyx_t_4;

    /* "src/lxml/apihelpers.pxi":255
 *     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:             # <<<<<<<<<<<<<<
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_ns != NULL);
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":256
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:             # <<<<<<<<<<<<<<
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:
 */
      __pyx_t_3 = (__pyx_v_c_ns->prefix != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_ns->href != 0);
      __pyx_t_2 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":257
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)             # <<<<<<<<<<<<<<
 *                 if prefix not in nsmap:
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 257, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "src/lxml/apihelpers.pxi":258
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
 */
        __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_prefix, __pyx_v_nsmap, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(7, 258, __pyx_L1_error)
        if (__pyx_t_2) {

          /* "src/lxml/apihelpers.pxi":259
 *                 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_1 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely((PyDict_SetItem(__pyx_v_nsmap, __pyx_v_prefix, __pyx_t_1) < 0))) __PYX_ERR(7, 259, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "src/lxml/apihelpers.pxi":258
 *             if c_ns.prefix or c_ns.href:
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
 */
        }

        /* "src/lxml/apihelpers.pxi":256
 *         c_ns = c_node.nsDef
 *         while c_ns is not NULL:
 *             if c_ns.prefix or c_ns.href:             # <<<<<<<<<<<<<<
 *                 prefix = funicodeOrNone(c_ns.prefix)
 *                 if prefix not in nsmap:
 */
      }

      /* "src/lxml/apihelpers.pxi":260
 *                 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_4 = __pyx_v_c_ns->next;
      __pyx_v_c_ns = __pyx_t_4;
    }

    /* "src/lxml/apihelpers.pxi":261
 *                     nsmap[prefix] = funicodeOrNone(c_ns.href)
 *             c_ns = c_ns.next
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     return nsmap
 * 
 */
    __pyx_t_5 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "src/lxml/apihelpers.pxi":262
 *             c_ns = c_ns.next
 *         c_node = c_node.parent
 *     return nsmap             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nsmap);
  __pyx_r = __pyx_v_nsmap;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":246
 * 
 * 
 * cdef dict _build_nsmap(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """
 *     Namespace prefix->URI mapping known in the context of this Element.
 */

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

/* "src/lxml/apihelpers.pxi":265
 * 
 * 
 * cdef _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an nsmap mapping.
 */

static PyObject *__pyx_f_4lxml_5etree__iter_nsmap(PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_default_ns = NULL;
  PyObject *__pyx_v_nsdefs = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_k = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_v = 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;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_nsmap", 1);

  /* "src/lxml/apihelpers.pxi":273
 *     in Py3.x.
 *     """
 *     if isinstance(nsmap, dict):             # <<<<<<<<<<<<<<
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 */
  __pyx_t_1 = PyDict_Check(__pyx_v_nsmap); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":275
 *     if isinstance(nsmap, dict):
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()             # <<<<<<<<<<<<<<
 *     if len(nsmap) <= 1:
 *         return nsmap.items()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 275, __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;

    /* "src/lxml/apihelpers.pxi":273
 *     in Py3.x.
 *     """
 *     if isinstance(nsmap, dict):             # <<<<<<<<<<<<<<
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 */
  }

  /* "src/lxml/apihelpers.pxi":276
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 *     if len(nsmap) <= 1:             # <<<<<<<<<<<<<<
 *         return nsmap.items()
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_nsmap); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(7, 276, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_6 <= 1);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":277
 *         return nsmap.items()
 *     if len(nsmap) <= 1:
 *         return nsmap.items()             # <<<<<<<<<<<<<<
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 277, __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;

    /* "src/lxml/apihelpers.pxi":276
 *         # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *         return nsmap.items()
 *     if len(nsmap) <= 1:             # <<<<<<<<<<<<<<
 *         return nsmap.items()
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 */
  }

  /* "src/lxml/apihelpers.pxi":279
 *         return nsmap.items()
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):             # <<<<<<<<<<<<<<
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
 */
  __pyx_t_7 = (((PyObject *)Py_TYPE(__pyx_v_nsmap)) != ((PyObject *)(&PyDict_Type)));
  if (__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = __pyx_v_4lxml_5etree_OrderedDict;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_nsmap, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_7;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":280
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order             # <<<<<<<<<<<<<<
 *     if None not in nsmap:
 *         return sorted(nsmap.items())
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 280, __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;

    /* "src/lxml/apihelpers.pxi":279
 *         return nsmap.items()
 *     # nsmap will usually be a plain unordered dict => avoid type checking overhead
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):             # <<<<<<<<<<<<<<
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
 */
  }

  /* "src/lxml/apihelpers.pxi":281
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:             # <<<<<<<<<<<<<<
 *         return sorted(nsmap.items())
 * 
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_nsmap, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 281, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":282
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:
 *         return sorted(nsmap.items())             # <<<<<<<<<<<<<<
 * 
 *     # Move the default namespace to the end.  This makes sure libxml2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_9 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(7, 282, __pyx_L1_error)
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":281
 *     if type(nsmap) is not dict and isinstance(nsmap, OrderedDict):
 *         return nsmap.items()  # keep existing order
 *     if None not in nsmap:             # <<<<<<<<<<<<<<
 *         return sorted(nsmap.items())
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":290
 *     # elements serialise without prefix (i.e. into the non-default
 *     # namespace).
 *     default_ns = nsmap[None]             # <<<<<<<<<<<<<<
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()
 */
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_nsmap, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_default_ns = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/apihelpers.pxi":291
 *     # namespace).
 *     default_ns = nsmap[None]
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]             # <<<<<<<<<<<<<<
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 291, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = 0;
    if (unlikely(__pyx_v_nsmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(7, 291, __pyx_L11_error)
    }
    __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_nsmap, 0, __pyx_n_s_items, (&__pyx_t_10), (&__pyx_t_5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 291, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4);
    __pyx_t_4 = __pyx_t_3;
    __pyx_t_3 = 0;
    while (1) {
      __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_10, &__pyx_t_6, &__pyx_t_3, &__pyx_t_8, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_11 == 0)) break;
      if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(7, 291, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_k, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_v, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_1 = (__pyx_8genexpr1__pyx_v_k != Py_None);
      if (__pyx_t_1) {
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 291, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_8genexpr1__pyx_v_k);
        __Pyx_GIVEREF(__pyx_8genexpr1__pyx_v_k);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_8genexpr1__pyx_v_k)) __PYX_ERR(7, 291, __pyx_L11_error);
        __Pyx_INCREF(__pyx_8genexpr1__pyx_v_v);
        __Pyx_GIVEREF(__pyx_8genexpr1__pyx_v_v);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_8genexpr1__pyx_v_v)) __PYX_ERR(7, 291, __pyx_L11_error);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(7, 291, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_v_nsdefs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/apihelpers.pxi":292
 *     default_ns = nsmap[None]
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()             # <<<<<<<<<<<<<<
 *     nsdefs.append((None, default_ns))
 *     return nsdefs
 */
  __pyx_t_9 = PyList_Sort(__pyx_v_nsdefs); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(7, 292, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":293
 *     nsdefs = [(k, v) for k, v in nsmap.items() if k is not None]
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))             # <<<<<<<<<<<<<<
 *     return nsdefs
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None)) __PYX_ERR(7, 293, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_default_ns);
  __Pyx_GIVEREF(__pyx_v_default_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_default_ns)) __PYX_ERR(7, 293, __pyx_L1_error);
  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_nsdefs, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(7, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/apihelpers.pxi":294
 *     nsdefs.sort()
 *     nsdefs.append((None, default_ns))
 *     return nsdefs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nsdefs);
  __pyx_r = __pyx_v_nsdefs;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":265
 * 
 * 
 * cdef _iter_nsmap(nsmap):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an nsmap mapping.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._iter_nsmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_default_ns);
  __Pyx_XDECREF(__pyx_v_nsdefs);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":297
 * 
 * 
 * cdef _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an attrib mapping.
 */

static PyObject *__pyx_f_4lxml_5etree__iter_attrib(PyObject *__pyx_v_attrib) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_attrib", 1);

  /* "src/lxml/apihelpers.pxi":303
 *     """
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):             # <<<<<<<<<<<<<<
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
 */
  __Pyx_INCREF(__pyx_v_4lxml_5etree_OrderedDict);
  __pyx_t_1 = __pyx_v_4lxml_5etree_OrderedDict;
  __pyx_t_3 = PyDict_Check(__pyx_v_attrib); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_attrib, __pyx_ptype_4lxml_5etree__Attrib); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_attrib, __pyx_t_1); 
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":304
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):
 *         return attrib.items()             # <<<<<<<<<<<<<<
 *     # assume it's an unordered mapping of some kind
 *     return sorted(attrib.items())
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 304, __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;

    /* "src/lxml/apihelpers.pxi":303
 *     """
 *     # dicts are insertion-ordered in Py3.6+ => keep the user provided order.
 *     if isinstance(attrib, (dict, _Attrib, OrderedDict)):             # <<<<<<<<<<<<<<
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
 */
  }

  /* "src/lxml/apihelpers.pxi":306
 *         return attrib.items()
 *     # assume it's an unordered mapping of some kind
 *     return sorted(attrib.items())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_8 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 306, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":297
 * 
 * 
 * cdef _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *     """
 *     Create a reproducibly ordered iterable from an attrib mapping.
 */

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

/* "src/lxml/apihelpers.pxi":309
 * 
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     """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;
  Py_ssize_t __pyx_t_5;
  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;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNodeAttributes", 1);

  /* "src/lxml/apihelpers.pxi":314
 *     cdef bint is_html
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:
 */
  __pyx_t_2 = (__pyx_v_attrib != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_attrib, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 314, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":315
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {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_ssize_strlen(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(7, 315, __pyx_L1_error)
    __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_4, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_attribute_dictionary, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(7, 315, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":314
 *     cdef bint is_html
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, 'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:
 */
  }

  /* "src/lxml/apihelpers.pxi":316
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:             # <<<<<<<<<<<<<<
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 316, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(7, 316, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":317
 *         raise TypeError, f"Invalid attribute dictionary: {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;

    /* "src/lxml/apihelpers.pxi":316
 *     if attrib is not None and not hasattr(attrib, 'items'):
 *         raise TypeError, f"Invalid attribute dictionary: {python._fqtypename(attrib).decode('utf8')}"
 *     if not attrib and not extra:             # <<<<<<<<<<<<<<
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 */
  }

  /* "src/lxml/apihelpers.pxi":318
 *     if not attrib and not extra:
 *         return  # nothing to do
 *     is_html = doc._parser._for_html             # <<<<<<<<<<<<<<
 *     seen = set()
 *     if extra:
 */
  __pyx_t_1 = __pyx_v_doc->_parser->_for_html;
  __pyx_v_is_html = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":319
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 *     seen = set()             # <<<<<<<<<<<<<<
 *     if extra:
 *         for name, value in extra.items():
 */
  __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_seen = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/apihelpers.pxi":320
 *     is_html = doc._parser._for_html
 *     seen = set()
 *     if extra:             # <<<<<<<<<<<<<<
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 320, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":321
 *     seen = set()
 *     if extra:
 *         for name, value in extra.items():             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 */
    __pyx_t_5 = 0;
    if (unlikely(__pyx_v_extra == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(7, 321, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_extra, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7);
    __pyx_t_7 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_8, &__pyx_t_5, &__pyx_t_6, &__pyx_t_10, NULL, __pyx_t_9);
      if (unlikely(__pyx_t_11 == 0)) break;
      if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(7, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "src/lxml/apihelpers.pxi":322
 *     if extra:
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):
 */
      __pyx_t_11 = __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_11 == ((int)-1))) __PYX_ERR(7, 322, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/apihelpers.pxi":320
 *     is_html = doc._parser._for_html
 *     seen = set()
 *     if extra:             # <<<<<<<<<<<<<<
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
  }

  /* "src/lxml/apihelpers.pxi":323
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(7, 323, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":324
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__iter_attrib(__pyx_v_attrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_10 = __pyx_t_7; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_8 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 324, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_10))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 324, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(7, 324, __pyx_L1_error)
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 324, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(7, 324, __pyx_L1_error)
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_12(__pyx_t_10);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 324, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(7, 324, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_13);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 324, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(7, 324, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 324, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
        index = 0; __pyx_t_6 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_6)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(7, 324, __pyx_L1_error)
        __pyx_t_15 = NULL;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(7, 324, __pyx_L1_error)
        __pyx_L16_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "src/lxml/apihelpers.pxi":325
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_9 = __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_9 == ((int)-1))) __PYX_ERR(7, 325, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":324
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 *         for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "src/lxml/apihelpers.pxi":323
 *         for name, value in extra.items():
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         for name, value in _iter_attrib(attrib):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
  }

  /* "src/lxml/apihelpers.pxi":309
 * 
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     """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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":328
 * 
 * 
 * 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;
  xmlNs *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addAttributeToNode", 1);

  /* "src/lxml/apihelpers.pxi":330
 * 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_ERR(7, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 330, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 330, __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;

  /* "src/lxml/apihelpers.pxi":331
 *                              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)
 */
  if (unlikely(__pyx_v_seen_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(7, 331, __pyx_L1_error)
  }
  __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_seen_tags, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(7, 331, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":332
 *     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;

    /* "src/lxml/apihelpers.pxi":331
 *                              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)
 */
  }

  /* "src/lxml/apihelpers.pxi":333
 *     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 '%.30s'", "add");
    __PYX_ERR(7, 333, __pyx_L1_error)
  }
  __pyx_t_5 = PySet_Add(__pyx_v_seen_tags, __pyx_v_tag); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 333, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":334
 *         return 0
 *     seen_tags.add(tag)
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 */
  __pyx_t_4 = (!__pyx_v_is_html);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":335
 *     seen_tags.add(tag)
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(7, 335, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":334
 *         return 0
 *     seen_tags.add(tag)
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 */
  }

  /* "src/lxml/apihelpers.pxi":336
 *     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_ERR(7, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":337
 *         _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_4 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":338
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))             # <<<<<<<<<<<<<<
 *     else:
 *         _uriValidOrRaise(ns_utf)
 */
    (void)(xmlNewProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf)));

    /* "src/lxml/apihelpers.pxi":337
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":340
 *         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,
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_ns_utf); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(7, 340, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":341
 *     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_7 = __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_7 == ((xmlNs *)NULL))) __PYX_ERR(7, 341, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_7;

    /* "src/lxml/apihelpers.pxi":342
 *         _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
 */
    (void)(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:;

  /* "src/lxml/apihelpers.pxi":344
 *         tree.xmlNewNsProp(c_node, c_ns,
 *                           _xcstr(name_utf), _xcstr(value_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":328
 * 
 * 
 * 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;
}

/* "src/lxml/apihelpers.pxi":352
 * 
 * 
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,             # <<<<<<<<<<<<<<
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
 */

static int __pyx_f_4lxml_5etree__collectNsDefs(xmlNode *__pyx_v_c_element, __pyx_t_4lxml_5etree__ns_node_ref **__pyx_v__c_ns_list, size_t *__pyx_v__c_ns_list_len, size_t *__pyx_v__c_ns_list_size) {
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_c_ns_list_size;
  xmlNs *__pyx_v_c_nsdef;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_nsref_ptr;
  int __pyx_r;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;
  __pyx_t_4lxml_5etree__ns_node_ref __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":354
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
 */
  __pyx_v_c_ns_list = (__pyx_v__c_ns_list[0]);

  /* "src/lxml/apihelpers.pxi":355
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
 * 
 */
  __pyx_v_c_ns_list_len = (__pyx_v__c_ns_list_len[0]);

  /* "src/lxml/apihelpers.pxi":356
 *     c_ns_list = _c_ns_list[0]
 *     cdef size_t c_ns_list_len = _c_ns_list_len[0]
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]             # <<<<<<<<<<<<<<
 * 
 *     c_nsdef = c_element.nsDef
 */
  __pyx_v_c_ns_list_size = (__pyx_v__c_ns_list_size[0]);

  /* "src/lxml/apihelpers.pxi":358
 *     cdef size_t c_ns_list_size = _c_ns_list_size[0]
 * 
 *     c_nsdef = c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 */
  __pyx_t_1 = __pyx_v_c_element->nsDef;
  __pyx_v_c_nsdef = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":359
 * 
 *     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_2 = (__pyx_v_c_nsdef != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":360
 *     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_2 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":361
 *     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_2 = (__pyx_v_c_ns_list == NULL);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":362
 *         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;

        /* "src/lxml/apihelpers.pxi":361
 *     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:
 */
        goto __pyx_L6;
      }

      /* "src/lxml/apihelpers.pxi":364
 *                 c_ns_list_size = 20
 *             else:
 *                 c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_realloc(
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 */
      /*else*/ {
        __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
      }
      __pyx_L6:;

      /* "src/lxml/apihelpers.pxi":365
 *             else:
 *                 c_ns_list_size *= 2
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_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 *)lxml_realloc(__pyx_v_c_ns_list, __pyx_v_c_ns_list_size, (sizeof(__pyx_t_4lxml_5etree__ns_node_ref))));

      /* "src/lxml/apihelpers.pxi":367
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_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:
 *                     python.lxml_free(c_ns_list)
 */
      __pyx_t_2 = (__pyx_v_c_nsref_ptr == NULL);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":368
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
 */
        __pyx_t_2 = (__pyx_v_c_ns_list != NULL);
        if (__pyx_t_2) {

          /* "src/lxml/apihelpers.pxi":369
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)             # <<<<<<<<<<<<<<
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()
 */
          lxml_free(__pyx_v_c_ns_list);

          /* "src/lxml/apihelpers.pxi":370
 *                 if c_ns_list is not NULL:
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr
 */
          (__pyx_v__c_ns_list[0]) = NULL;

          /* "src/lxml/apihelpers.pxi":368
 *                 c_ns_list, c_ns_list_size, sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
 */
        }

        /* "src/lxml/apihelpers.pxi":371
 *                     python.lxml_free(c_ns_list)
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             c_ns_list = c_nsref_ptr
 * 
 */
        PyErr_NoMemory(); __PYX_ERR(7, 371, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":367
 *             c_nsref_ptr = <_ns_node_ref*> python.lxml_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:
 *                     python.lxml_free(c_ns_list)
 */
      }

      /* "src/lxml/apihelpers.pxi":372
 *                     _c_ns_list[0] = NULL
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)
 */
      __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;

      /* "src/lxml/apihelpers.pxi":360
 *     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
 */
    }

    /* "src/lxml/apihelpers.pxi":374
 *             c_ns_list = c_nsref_ptr
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)             # <<<<<<<<<<<<<<
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next
 */
    __pyx_t_3.ns = __pyx_v_c_nsdef;
    __pyx_t_3.node = __pyx_v_c_element;
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]) = __pyx_t_3;

    /* "src/lxml/apihelpers.pxi":375
 * 
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, 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);

    /* "src/lxml/apihelpers.pxi":376
 *         c_ns_list[c_ns_list_len] = _ns_node_ref(c_nsdef, c_element)
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     _c_ns_list_size[0] = c_ns_list_size
 */
    __pyx_t_1 = __pyx_v_c_nsdef->next;
    __pyx_v_c_nsdef = __pyx_t_1;
  }

  /* "src/lxml/apihelpers.pxi":378
 *         c_nsdef = c_nsdef.next
 * 
 *     _c_ns_list_size[0] = c_ns_list_size             # <<<<<<<<<<<<<<
 *     _c_ns_list_len[0] = c_ns_list_len
 *     _c_ns_list[0] = c_ns_list
 */
  (__pyx_v__c_ns_list_size[0]) = __pyx_v_c_ns_list_size;

  /* "src/lxml/apihelpers.pxi":379
 * 
 *     _c_ns_list_size[0] = c_ns_list_size
 *     _c_ns_list_len[0] = c_ns_list_len             # <<<<<<<<<<<<<<
 *     _c_ns_list[0] = c_ns_list
 * 
 */
  (__pyx_v__c_ns_list_len[0]) = __pyx_v_c_ns_list_len;

  /* "src/lxml/apihelpers.pxi":380
 *     _c_ns_list_size[0] = c_ns_list_size
 *     _c_ns_list_len[0] = c_ns_list_len
 *     _c_ns_list[0] = c_ns_list             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (__pyx_v__c_ns_list[0]) = __pyx_v_c_ns_list;

  /* "src/lxml/apihelpers.pxi":352
 * 
 * 
 * cdef int _collectNsDefs(xmlNode* c_element, _ns_node_ref **_c_ns_list,             # <<<<<<<<<<<<<<
 *                         size_t *_c_ns_list_len, size_t *_c_ns_list_size) except -1:
 *     c_ns_list = _c_ns_list[0]
 */

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

/* "src/lxml/apihelpers.pxi":383
 * 
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element, set prefixes_to_keep) except -1:             # <<<<<<<<<<<<<<
 *     """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, PyObject *__pyx_v_prefixes_to_keep) {
  xmlNode *__pyx_v_c_node;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  size_t __pyx_v_c_ns_list_size;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_i;
  xmlNs *__pyx_v_c_nsdef;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  xmlNode *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  xmlNs *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_removeUnusedNamespaceDeclarations", 1);

  /* "src/lxml/apihelpers.pxi":391
 *     """
 *     cdef xmlNode* c_node
 *     cdef _ns_node_ref* c_ns_list = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_size = 0
 *     cdef size_t c_ns_list_len = 0
 */
  __pyx_v_c_ns_list = NULL;

  /* "src/lxml/apihelpers.pxi":392
 *     cdef xmlNode* c_node
 *     cdef _ns_node_ref* c_ns_list = NULL
 *     cdef size_t c_ns_list_size = 0             # <<<<<<<<<<<<<<
 *     cdef size_t c_ns_list_len = 0
 *     cdef size_t i
 */
  __pyx_v_c_ns_list_size = 0;

  /* "src/lxml/apihelpers.pxi":393
 *     cdef _ns_node_ref* c_ns_list = NULL
 *     cdef size_t c_ns_list_size = 0
 *     cdef size_t c_ns_list_len = 0             # <<<<<<<<<<<<<<
 *     cdef size_t i
 * 
 */
  __pyx_v_c_ns_list_len = 0;

  /* "src/lxml/apihelpers.pxi":396
 *     cdef size_t i
 * 
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 */
  __pyx_t_2 = (__pyx_v_c_element->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_element->parent->type == XML_DOCUMENT_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":398
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__collectNsDefs(__pyx_v_c_element->parent, (&__pyx_v_c_ns_list), (&__pyx_v_c_ns_list_len), (&__pyx_v_c_ns_list_size)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 398, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":396
 *     cdef size_t i
 * 
 *     if c_element.parent and c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include declarations on the document node
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 */
  }

  /* "src/lxml/apihelpers.pxi":400
 *         _collectNsDefs(c_element.parent, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "src/lxml/apihelpers.pxi":402
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:             # <<<<<<<<<<<<<<
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_element->nsDef != 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":403
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)             # <<<<<<<<<<<<<<
 * 
 *     # remove all namespace declarations from the list that are referenced
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__collectNsDefs(__pyx_v_c_element, (&__pyx_v_c_ns_list), (&__pyx_v_c_ns_list_len), (&__pyx_v_c_ns_list_size)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 403, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":402
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     if c_element.nsDef:             # <<<<<<<<<<<<<<
 *         _collectNsDefs(c_element, &c_ns_list, &c_ns_list_len, &c_ns_list_size)
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":406
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 */
  __pyx_t_2 = (__pyx_v_c_ns_list_len != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_element->type == XML_ELEMENT_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":407
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:
 */
    __pyx_v_c_node = __pyx_v_c_element;

    /* "src/lxml/apihelpers.pxi":408
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element
 *         while c_node and c_ns_list_len:             # <<<<<<<<<<<<<<
 *             if c_node.ns:
 *                 for i in range(c_ns_list_len):
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_ns_list_len != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L12_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":409
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
 */
      __pyx_t_1 = (__pyx_v_c_node->ns != 0);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":410
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:
 *                 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_4 = __pyx_v_c_ns_list_len;
        __pyx_t_5 = __pyx_t_4;
        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
          __pyx_v_i = __pyx_t_6;

          /* "src/lxml/apihelpers.pxi":411
 *             if c_node.ns:
 *                 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] = c_ns_list[c_ns_list_len]
 */
          __pyx_t_1 = (__pyx_v_c_node->ns == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":412
 *                 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] = c_ns_list[c_ns_list_len]
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 */
            __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len - 1);

            /* "src/lxml/apihelpers.pxi":413
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]             # <<<<<<<<<<<<<<
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
 */
            (__pyx_v_c_ns_list[__pyx_v_i]) = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]);

            /* "src/lxml/apihelpers.pxi":415
 *                         c_ns_list[i] = c_ns_list[c_ns_list_len]
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break             # <<<<<<<<<<<<<<
 *             if c_node is c_element:
 *                 # continue with attributes
 */
            goto __pyx_L16_break;

            /* "src/lxml/apihelpers.pxi":411
 *             if c_node.ns:
 *                 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] = c_ns_list[c_ns_list_len]
 */
          }
        }
        __pyx_L16_break:;

        /* "src/lxml/apihelpers.pxi":409
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 *             if c_node.ns:             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
 */
      }

      /* "src/lxml/apihelpers.pxi":416
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_element);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":418
 *             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);

        /* "src/lxml/apihelpers.pxi":416
 *                         #c_ns_list[c_ns_list_len] = _ns_node_ref(NULL, NULL)
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
        goto __pyx_L18;
      }

      /* "src/lxml/apihelpers.pxi":420
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 */
      /*else*/ {
        __pyx_t_7 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_7;
      }
      __pyx_L18:;
    }

    /* "src/lxml/apihelpers.pxi":406
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_ns_list_len and c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node and c_ns_list_len:
 */
  }

  /* "src/lxml/apihelpers.pxi":421
 *             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);

  /* "src/lxml/apihelpers.pxi":423
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = (__pyx_v_c_ns_list == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":424
 * 
 *     if c_ns_list is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # free all namespace declarations that remained in the list,
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":423
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":429
 *     # except for those we should keep explicitly
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):             # <<<<<<<<<<<<<<
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 */
  __pyx_t_4 = __pyx_v_c_ns_list_len;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "src/lxml/apihelpers.pxi":430
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:             # <<<<<<<<<<<<<<
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
 */
    __pyx_t_1 = (__pyx_v_prefixes_to_keep != ((PyObject*)Py_None));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":431
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:             # <<<<<<<<<<<<<<
 *                 continue
 *         c_node = c_ns_list[i].node
 */
      __pyx_t_2 = ((__pyx_v_c_ns_list[__pyx_v_i]).ns->prefix != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyBytes_FromCString((__pyx_v_c_ns_list[__pyx_v_i]).ns->prefix); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__pyx_v_prefixes_to_keep == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(7, 431, __pyx_L1_error)
      }
      __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_8, __pyx_v_prefixes_to_keep, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(7, 431, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L24_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":432
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue             # <<<<<<<<<<<<<<
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 */
        goto __pyx_L20_continue;

        /* "src/lxml/apihelpers.pxi":431
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:             # <<<<<<<<<<<<<<
 *                 continue
 *         c_node = c_ns_list[i].node
 */
      }

      /* "src/lxml/apihelpers.pxi":430
 *     cdef xmlNs* c_nsdef
 *     for i in range(c_ns_list_len):
 *         if prefixes_to_keep is not None:             # <<<<<<<<<<<<<<
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
 */
    }

    /* "src/lxml/apihelpers.pxi":433
 *             if c_ns_list[i].ns.prefix and c_ns_list[i].ns.prefix in prefixes_to_keep:
 *                 continue
 *         c_node = c_ns_list[i].node             # <<<<<<<<<<<<<<
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 */
    __pyx_t_7 = (__pyx_v_c_ns_list[__pyx_v_i]).node;
    __pyx_v_c_node = __pyx_t_7;

    /* "src/lxml/apihelpers.pxi":434
 *                 continue
 *         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_9 = __pyx_v_c_node->nsDef;
    __pyx_v_c_nsdef = __pyx_t_9;

    /* "src/lxml/apihelpers.pxi":435
 *         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_1 = (__pyx_v_c_nsdef == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":436
 *         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_9 = __pyx_v_c_node->nsDef->next;
      __pyx_v_c_node->nsDef = __pyx_t_9;

      /* "src/lxml/apihelpers.pxi":435
 *         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:
 */
      goto __pyx_L26;
    }

    /* "src/lxml/apihelpers.pxi":438
 *             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
 */
    /*else*/ {
      while (1) {
        __pyx_t_1 = (__pyx_v_c_nsdef->next != (__pyx_v_c_ns_list[__pyx_v_i]).ns);
        if (!__pyx_t_1) break;

        /* "src/lxml/apihelpers.pxi":439
 *         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_9 = __pyx_v_c_nsdef->next;
        __pyx_v_c_nsdef = __pyx_t_9;
      }

      /* "src/lxml/apihelpers.pxi":440
 *             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_9 = __pyx_v_c_nsdef->next->next;
      __pyx_v_c_nsdef->next = __pyx_t_9;
    }
    __pyx_L26:;

    /* "src/lxml/apihelpers.pxi":441
 *                 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);
    __pyx_L20_continue:;
  }

  /* "src/lxml/apihelpers.pxi":443
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_list)
 *     return 0
 */
  __pyx_t_1 = (__pyx_v_c_ns_list != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":444
 * 
 *     if c_ns_list is not NULL:
 *         python.lxml_free(c_ns_list)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    lxml_free(__pyx_v_c_ns_list);

    /* "src/lxml/apihelpers.pxi":443
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_list)
 *     return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":445
 *     if c_ns_list is not NULL:
 *         python.lxml_free(c_ns_list)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":383
 * 
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element, set prefixes_to_keep) except -1:             # <<<<<<<<<<<<<<
 *     """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_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._removeUnusedNamespaceDeclarations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":447
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  xmlNs *__pyx_t_4;

  /* "src/lxml/apihelpers.pxi":456
 *     """
 *     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;

  /* "src/lxml/apihelpers.pxi":458
 *     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_2 = (__pyx_v_c_href == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ENTITY_REF_NODE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":459
 *     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;

    /* "src/lxml/apihelpers.pxi":458
 *     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:
 */
  }

  /* "src/lxml/apihelpers.pxi":460
 *     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_1 = (xmlStrcmp(__pyx_v_c_href, XML_XML_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":462
 *     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;

    /* "src/lxml/apihelpers.pxi":460
 *     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)
 */
  }

  /* "src/lxml/apihelpers.pxi":463
 *         # 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_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":464
 *         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;

    /* "src/lxml/apihelpers.pxi":463
 *         # 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:
 */
  }

  /* "src/lxml/apihelpers.pxi":465
 *     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);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":466
 *         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_3 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":467
 *     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;

  /* "src/lxml/apihelpers.pxi":468
 *         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_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":469
 *     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_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":470
 *     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_4 = __pyx_v_c_node->nsDef;
      __pyx_v_c_ns = __pyx_t_4;

      /* "src/lxml/apihelpers.pxi":471
 *         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_1 = (__pyx_v_c_ns != NULL);
        if (!__pyx_t_1) break;

        /* "src/lxml/apihelpers.pxi":472
 *             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_2 = (__pyx_v_c_ns->href != NULL);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L19_bool_binop_done;
        }
        __pyx_t_2 = (xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L19_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":473
 *             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_2 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L22_bool_binop_done;
          }
          __pyx_t_1 = __pyx_v_is_attribute;
          __pyx_L22_bool_binop_done:;
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":477
 *                         # 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_1 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":478
 *                         # 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;

              /* "src/lxml/apihelpers.pxi":477
 *                         # 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(
 */
            }

            /* "src/lxml/apihelpers.pxi":473
 *             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
 */
            goto __pyx_L21;
          }

          /* "src/lxml/apihelpers.pxi":480
 *                             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_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);

          /* "src/lxml/apihelpers.pxi":479
 *                         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:
 *                         # start node is in namespace scope => found!
 */
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":482
 *                         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;

            /* "src/lxml/apihelpers.pxi":479
 *                         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:
 *                         # start node is in namespace scope => found!
 */
          }
          __pyx_L21:;

          /* "src/lxml/apihelpers.pxi":472
 *             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
 */
        }

        /* "src/lxml/apihelpers.pxi":483
 *                         # 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_4 = __pyx_v_c_ns->next;
        __pyx_v_c_ns = __pyx_t_4;
      }

      /* "src/lxml/apihelpers.pxi":484
 *                         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_2 = (__pyx_v_c_node != __pyx_v_c_element);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_node->ns != NULL);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":486
 *             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_4 = __pyx_v_c_node->ns;
        __pyx_v_c_ns = __pyx_t_4;

        /* "src/lxml/apihelpers.pxi":487
 *                 # 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);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L29_bool_binop_done;
        }
        __pyx_t_2 = (xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L29_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":488
 *                 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_2 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L32_bool_binop_done;
          }
          __pyx_t_1 = __pyx_v_is_attribute;
          __pyx_L32_bool_binop_done:;
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":492
 *                         # 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_1 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_1) {

              /* "src/lxml/apihelpers.pxi":493
 *                         # 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;

              /* "src/lxml/apihelpers.pxi":492
 *                         # 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(
 */
            }

            /* "src/lxml/apihelpers.pxi":488
 *                 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
 */
            goto __pyx_L31;
          }

          /* "src/lxml/apihelpers.pxi":495
 *                             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_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);

          /* "src/lxml/apihelpers.pxi":494
 *                         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:
 *                         # start node is in namespace scope => found!
 */
          if (__pyx_t_1) {

            /* "src/lxml/apihelpers.pxi":497
 *                         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;

            /* "src/lxml/apihelpers.pxi":494
 *                         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:
 *                         # start node is in namespace scope => found!
 */
          }
          __pyx_L31:;

          /* "src/lxml/apihelpers.pxi":487
 *                 # 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
 */
        }

        /* "src/lxml/apihelpers.pxi":484
 *                         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
 */
      }

      /* "src/lxml/apihelpers.pxi":469
 *     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:
 */
    }

    /* "src/lxml/apihelpers.pxi":498
 *                         # 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_3 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":500
 *         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_1 = (__pyx_v_c_default_ns != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":501
 *     # 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_1 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, NULL) == __pyx_v_c_default_ns);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":502
 *     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;

      /* "src/lxml/apihelpers.pxi":501
 *     # 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
 */
    }

    /* "src/lxml/apihelpers.pxi":500
 *         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
 */
  }

  /* "src/lxml/apihelpers.pxi":503
 *         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;

  /* "src/lxml/apihelpers.pxi":447
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute) noexcept:             # <<<<<<<<<<<<<<
 *     """Search a namespace declaration that covers a node (element or
 *     attribute).
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":505
 *     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;
  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;

  /* "src/lxml/apihelpers.pxi":509
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":510
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":511
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_parent = c_node.parent
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":509
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":513
 *         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;

  /* "src/lxml/apihelpers.pxi":515
 *     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;

  /* "src/lxml/apihelpers.pxi":516
 *     # 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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":517
 *     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;

    /* "src/lxml/apihelpers.pxi":518
 *     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;
  }

  /* "src/lxml/apihelpers.pxi":522
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":523
 *     # 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;

    /* "src/lxml/apihelpers.pxi":524
 *     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);
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":525
 *         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 == ((int)-1))) __PYX_ERR(7, 525, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":526
 *         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;
    }

    /* "src/lxml/apihelpers.pxi":522
 *     # 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:
 */
  }

  /* "src/lxml/apihelpers.pxi":529
 * 
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":530
 *     # 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;

    /* "src/lxml/apihelpers.pxi":529
 * 
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_node.children
 *     else:
 */
    goto __pyx_L9;
  }

  /* "src/lxml/apihelpers.pxi":532
 *         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:
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_node->prev->next = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":533
 *     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:;

  /* "src/lxml/apihelpers.pxi":534
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":535
 *         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;

    /* "src/lxml/apihelpers.pxi":534
 *         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:
 */
    goto __pyx_L10;
  }

  /* "src/lxml/apihelpers.pxi":537
 *         c_parent.last = c_node.last
 *     else:
 *         c_node.next.prev = c_node.last             # <<<<<<<<<<<<<<
 *         c_node.last.next = c_node.next
 * 
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_node->last;
    __pyx_v_c_node->next->prev = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":538
 *     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:;

  /* "src/lxml/apihelpers.pxi":541
 * 
 *     # 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;

  /* "src/lxml/apihelpers.pxi":542
 *     # 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;

  /* "src/lxml/apihelpers.pxi":543
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":505
 *     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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":545
 *     return 0
 * 
 * cdef unicode _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", 1);

  /* "src/lxml/apihelpers.pxi":546
 * 
 * cdef unicode _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));

  /* "src/lxml/apihelpers.pxi":547
 * cdef unicode _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);

  /* "src/lxml/apihelpers.pxi":548
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(value)
 *     finally:
 */
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":549
 *     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_ERR(7, 549, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "src/lxml/apihelpers.pxi":551
 *         result = funicode(value)
 *     finally:
 *         tree.xmlFree(value)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_value);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:;
  }

  /* "src/lxml/apihelpers.pxi":552
 *     finally:
 *         tree.xmlFree(value)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _attributeValueFromNsName(xmlNode* c_element,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":545
 *     return 0
 * 
 * cdef unicode _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;
}

/* "src/lxml/apihelpers.pxi":554
 *     return result
 * 
 * cdef unicode _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", 1);

  /* "src/lxml/apihelpers.pxi":556
 * cdef unicode _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);

  /* "src/lxml/apihelpers.pxi":557
 *                                        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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":558
 *     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_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":557
 *                                        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:
 */
  }

  /* "src/lxml/apihelpers.pxi":559
 *     if c_result is NULL:
 *         return None
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":560
 *         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_ERR(7, 560, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "src/lxml/apihelpers.pxi":562
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:;
  }

  /* "src/lxml/apihelpers.pxi":563
 *     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;

  /* "src/lxml/apihelpers.pxi":554
 *     return result
 * 
 * cdef unicode _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;
}

/* "src/lxml/apihelpers.pxi":565
 *     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", 1);

  /* "src/lxml/apihelpers.pxi":566
 * 
 * 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_ERR(7, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 566, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 566, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":567
 * 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) {
    __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;

  /* "src/lxml/apihelpers.pxi":568
 *     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);

  /* "src/lxml/apihelpers.pxi":569
 *     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);
  if (__pyx_t_5) {

    /* "src/lxml/apihelpers.pxi":571
 *     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;

    /* "src/lxml/apihelpers.pxi":569
 *     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
 */
  }

  /* "src/lxml/apihelpers.pxi":572
 *         # XXX free namespace that is not in use..?
 *         return default
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "src/lxml/apihelpers.pxi":573
 *         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_ERR(7, 573, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "src/lxml/apihelpers.pxi":575
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      __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_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:;
  }

  /* "src/lxml/apihelpers.pxi":576
 *     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;

  /* "src/lxml/apihelpers.pxi":565
 *     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;
}

/* "src/lxml/apihelpers.pxi":578
 *     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", 1);

  /* "src/lxml/apihelpers.pxi":579
 * 
 * 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_ERR(7, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":578
 *     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;
}

/* "src/lxml/apihelpers.pxi":581
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_ns
 */

static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_value;
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  int __pyx_v_is_html;
  const xmlChar *__pyx_v_c_tag;
  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);

  /* "src/lxml/apihelpers.pxi":584
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     is_html = element._doc._parser._for_html
 *     if not is_html:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 584, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 584, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":585
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html             # <<<<<<<<<<<<<<
 *     if not is_html:
 *         _attributeValidOrRaise(tag)
 */
  __pyx_t_4 = __pyx_v_element->_doc->_parser->_for_html;
  __pyx_v_is_html = __pyx_t_4;

  /* "src/lxml/apihelpers.pxi":586
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 */
  __pyx_t_4 = (!__pyx_v_is_html);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":587
 *     is_html = element._doc._parser._for_html
 *     if not is_html:
 *         _attributeValidOrRaise(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_tag); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 587, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":586
 *     ns, tag = _getNsTag(key)
 *     is_html = element._doc._parser._for_html
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 */
  }

  /* "src/lxml/apihelpers.pxi":588
 *     if not is_html:
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)             # <<<<<<<<<<<<<<
 *     if value is None and is_html:
 *         c_value = NULL
 */
  __pyx_v_c_tag = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag);

  /* "src/lxml/apihelpers.pxi":589
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:             # <<<<<<<<<<<<<<
 *         c_value = NULL
 *     else:
 */
  __pyx_t_6 = (__pyx_v_value == Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = __pyx_v_is_html;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":590
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:
 *         c_value = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         if isinstance(value, QName):
 */
    __pyx_v_c_value = NULL;

    /* "src/lxml/apihelpers.pxi":589
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 *     if value is None and is_html:             # <<<<<<<<<<<<<<
 *         c_value = NULL
 *     else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":592
 *         c_value = NULL
 *     else:
 *         if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *             value = _resolveQNameText(element, value)
 *         else:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_4lxml_5etree_QName); 
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":593
 *     else:
 *         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_ERR(7, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/apihelpers.pxi":592
 *         c_value = NULL
 *     else:
 *         if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *             value = _resolveQNameText(element, value)
 *         else:
 */
      goto __pyx_L7;
    }

    /* "src/lxml/apihelpers.pxi":595
 *             value = _resolveQNameText(element, value)
 *         else:
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_value = _xcstr(value)
 *     if ns is None:
 */
    /*else*/ {
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "src/lxml/apihelpers.pxi":596
 *         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);
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":597
 *             value = _utf8(value)
 *         c_value = _xcstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":598
 *         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;

    /* "src/lxml/apihelpers.pxi":597
 *             value = _utf8(value)
 *         c_value = _xcstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
 */
    goto __pyx_L8;
  }

  /* "src/lxml/apihelpers.pxi":600
 *         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
 */
  /*else*/ {
    __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 == ((xmlNs *)NULL))) __PYX_ERR(7, 600, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_7;
  }
  __pyx_L8:;

  /* "src/lxml/apihelpers.pxi":601
 *     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
 * 
 */
  (void)(xmlSetNsProp(__pyx_v_element->_c_node, __pyx_v_c_ns, __pyx_v_c_tag, __pyx_v_c_value));

  /* "src/lxml/apihelpers.pxi":602
 *         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;

  /* "src/lxml/apihelpers.pxi":581
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_value
 *     cdef xmlNs* c_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._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;
}

/* "src/lxml/apihelpers.pxi":604
 *     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", 1);

  /* "src/lxml/apihelpers.pxi":605
 * 
 * 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_ERR(7, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 605, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 605, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":606
 * 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) {
    __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;

  /* "src/lxml/apihelpers.pxi":607
 *     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 (unlikely(__pyx_t_5)) {

    /* "src/lxml/apihelpers.pxi":608
 *     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_ERR(7, 608, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":607
 *     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
 */
  }

  /* "src/lxml/apihelpers.pxi":609
 *     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) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":604
 *     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;
}

/* "src/lxml/apihelpers.pxi":611
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":612
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     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);

  /* "src/lxml/apihelpers.pxi":613
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":615
 *     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;

    /* "src/lxml/apihelpers.pxi":613
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:
 *     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
 */
  }

  /* "src/lxml/apihelpers.pxi":616
 *         # XXX free namespace that is not in use..?
 *         return -1
 *     tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (void)(xmlRemoveProp(__pyx_v_c_attr));

  /* "src/lxml/apihelpers.pxi":617
 *         return -1
 *     tree.xmlRemoveProp(c_attr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":611
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":619
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":624
 *     """
 *     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;

  /* "src/lxml/apihelpers.pxi":625
 *     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;

  /* "src/lxml/apihelpers.pxi":626
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":627
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":628
 *     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);

      /* "src/lxml/apihelpers.pxi":627
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
 */
    }

    /* "src/lxml/apihelpers.pxi":629
 *         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;
  }

  /* "src/lxml/apihelpers.pxi":631
 *         c_attr = c_attr.next
 * 
 *     if not count:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_2 = (!(__pyx_v_count != 0));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":632
 * 
 *     if not count:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     attributes = [None] * count
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":631
 *         c_attr = c_attr.next
 * 
 *     if not count:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":634
 *         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_ERR(7, 634, __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);
      __Pyx_GIVEREF(Py_None);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None)) __PYX_ERR(7, 634, __pyx_L1_error);
    }
  }
  __pyx_v_attributes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":635
 * 
 *     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;

  /* "src/lxml/apihelpers.pxi":636
 *     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;

  /* "src/lxml/apihelpers.pxi":637
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":638
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":639
 *     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:
 */
      switch (__pyx_v_collecttype) {
        case 1:

        /* "src/lxml/apihelpers.pxi":640
 *         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_ERR(7, 640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":639
 *     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:
 */
        break;
        case 2:

        /* "src/lxml/apihelpers.pxi":642
 *                 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_ERR(7, 642, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":641
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 */
        break;
        default:

        /* "src/lxml/apihelpers.pxi":644
 *                 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_ERR(7, 644, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/apihelpers.pxi":645
 *             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_ERR(7, 645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);

        /* "src/lxml/apihelpers.pxi":644
 *                 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_ERR(7, 644, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(7, 644, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(7, 644, __pyx_L1_error);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
        __pyx_t_5 = 0;
        break;
      }

      /* "src/lxml/apihelpers.pxi":646
 *                 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_ERR(7, 646, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":647
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return attributes
 */
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/apihelpers.pxi":638
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 */
    }

    /* "src/lxml/apihelpers.pxi":648
 *             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;
  }

  /* "src/lxml/apihelpers.pxi":649
 *             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;

  /* "src/lxml/apihelpers.pxi":619
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":657
 * 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(r'\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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stripEncodingDeclaration", 1);

  /* "src/lxml/apihelpers.pxi":659
 * cdef object _stripEncodingDeclaration(object xml_string):
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(r'\g<1>\g<2>', xml_string)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __pyx_t_2 = __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_kp_u_g_1_g_2, __pyx_v_xml_string};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 659, __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;

  /* "src/lxml/apihelpers.pxi":657
 * 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(r'\g<1>\g<2>', xml_string)
 */

  /* 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._stripEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":661
 *     return __REPLACE_XML_ENCODING(r'\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;
  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("_hasEncodingDeclaration", 1);

  /* "src/lxml/apihelpers.pxi":663
 * 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) noexcept:
 */
  __Pyx_INCREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __pyx_t_2 = __pyx_v_4lxml_5etree___HAS_XML_ENCODING; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_xml_string};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_5 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":661
 *     return __REPLACE_XML_ENCODING(r'\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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._hasEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":665
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":666
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->children) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":665
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":668
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":669
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":668
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":671
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasNonWhitespaceTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":672
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:
 *     return _hasNonWhitespaceText(c_node, tail=True)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.tail = 1;
  __pyx_t_1 = __pyx_f_4lxml_5etree__hasNonWhitespaceText(__pyx_v_c_node, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 672, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":671
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef inline bint _hasNonWhitespaceTail(xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 */

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

/* "src/lxml/apihelpers.pxi":674
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
 */

static int __pyx_f_4lxml_5etree__hasNonWhitespaceText(xmlNode *__pyx_v_c_node, struct __pyx_opt_args_4lxml_5etree__hasNonWhitespaceText *__pyx_optional_args) {
  int __pyx_v_tail = ((int)0);
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlNode *__pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hasNonWhitespaceText", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_tail = __pyx_optional_args->tail;
    }
  }

  /* "src/lxml/apihelpers.pxi":675
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)             # <<<<<<<<<<<<<<
 *     if c_text_node is NULL:
 *         return False
 */
  if (__pyx_v_c_node) {
  } else {
    __pyx_t_1 = __pyx_v_c_node;
    goto __pyx_L3_bool_binop_done;
  }
  if (__pyx_v_tail) {
    __pyx_t_2 = __pyx_v_c_node->next;
  } else {
    __pyx_t_2 = __pyx_v_c_node->children;
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_v_c_text_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":676
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     while c_text_node is not NULL:
 */
  __pyx_t_4 = (__pyx_v_c_text_node == NULL);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":677
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
 *         return False             # <<<<<<<<<<<<<<
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":676
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     while c_text_node is not NULL:
 */
  }

  /* "src/lxml/apihelpers.pxi":678
 *     if c_text_node is NULL:
 *         return False
 *     while c_text_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True
 */
  while (1) {
    __pyx_t_4 = (__pyx_v_c_text_node != NULL);
    if (!__pyx_t_4) break;

    /* "src/lxml/apihelpers.pxi":679
 *         return False
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():             # <<<<<<<<<<<<<<
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 */
    __pyx_t_5 = ((__pyx_v_c_text_node->content[0]) != '\x00');
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_7 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_text_node); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_isspace); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(7, 679, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = (!__pyx_t_5);
    __pyx_t_4 = __pyx_t_10;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_4) {

      /* "src/lxml/apihelpers.pxi":680
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True             # <<<<<<<<<<<<<<
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 *     return False
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":679
 *         return False
 *     while c_text_node is not NULL:
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():             # <<<<<<<<<<<<<<
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 */
    }

    /* "src/lxml/apihelpers.pxi":681
 *         if c_text_node.content[0] != c'\0' and not _collectText(c_text_node).isspace():
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_text_node->next);
  }

  /* "src/lxml/apihelpers.pxi":682
 *             return True
 *         c_text_node = _textNodeOrSkip(c_text_node.next)
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef unicode _collectText(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":674
 *     return _hasNonWhitespaceText(c_node, tail=True)
 * 
 * cdef bint _hasNonWhitespaceText(xmlNode* c_node, bint tail=False) except -1:             # <<<<<<<<<<<<<<
 *     c_text_node = c_node and _textNodeOrSkip(c_node.next if tail else c_node.children)
 *     if c_text_node is NULL:
 */

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

/* "src/lxml/apihelpers.pxi":684
 *     return False
 * 
 * cdef unicode _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":695
 *     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;

  /* "src/lxml/apihelpers.pxi":696
 *     # 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;

  /* "src/lxml/apihelpers.pxi":697
 *     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;

  /* "src/lxml/apihelpers.pxi":698
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":699
 *     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');
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":700
 *     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;

      /* "src/lxml/apihelpers.pxi":699
 *     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
 */
    }

    /* "src/lxml/apihelpers.pxi":701
 *         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);

    /* "src/lxml/apihelpers.pxi":702
 *             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);
  }

  /* "src/lxml/apihelpers.pxi":705
 * 
 *     # 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);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":706
 *     # 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);
    __pyx_t_2 = (__pyx_v_scount > 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_kp_u__12);
      __pyx_t_4 = __pyx_kp_u__12;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    }
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_4))) __PYX_ERR(7, 706, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":705
 * 
 *     # handle two most common cases first
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         return '' if scount > 0 else None
 *     if scount == 1:
 */
  }

  /* "src/lxml/apihelpers.pxi":707
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":708
 *         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_ERR(7, 708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":707
 *     if c_text is NULL:
 *         return '' if scount > 0 else None
 *     if scount == 1:             # <<<<<<<<<<<<<<
 *         return funicode(c_text)
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":711
 * 
 *     # 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__12);
  __pyx_v_result = __pyx_kp_b__12;

  /* "src/lxml/apihelpers.pxi":712
 *     # 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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":713
 *     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_FromCString(((unsigned char *)__pyx_v_c_node->content)); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 713, __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_ERR(7, 713, __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;

    /* "src/lxml/apihelpers.pxi":714
 *     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);
  }

  /* "src/lxml/apihelpers.pxi":715
 *         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) noexcept:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_result == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(7, 715, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsWritableUString(__pyx_v_result); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(7, 715, __pyx_L1_error)
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)((unsigned char *)__pyx_t_6))); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":684
 *     return False
 * 
 * cdef unicode _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":717
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Remove all text nodes.
 * 
 */

static void __pyx_f_4lxml_5etree__removeText(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":723
 *     """
 *     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);

  /* "src/lxml/apihelpers.pxi":724
 *     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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":725
 *     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);

    /* "src/lxml/apihelpers.pxi":726
 *     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);

    /* "src/lxml/apihelpers.pxi":727
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    xmlFreeNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":728
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":717
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Remove all text nodes.
 * 
 */

  /* function exit code */
}

/* "src/lxml/apihelpers.pxi":730
 *         c_node = c_next
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
 */

static xmlNode *__pyx_f_4lxml_5etree__createTextNode(xmlDoc *__pyx_v_doc, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text = NULL;
  xmlNode *__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("_createTextNode", 1);

  /* "src/lxml/apihelpers.pxi":732
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_4lxml_5etree_CDATA); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":734
 *     if isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),             # <<<<<<<<<<<<<<
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_2);

    /* "src/lxml/apihelpers.pxi":735
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(value)
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/apihelpers.pxi":733
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(             # <<<<<<<<<<<<<<
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 */
    __pyx_v_c_text_node = xmlNewCDataBlock(__pyx_v_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_2), PyBytes_GET_SIZE(__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":732
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             doc, _xcstr((<CDATA>value)._utf8_data),
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":737
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
 *         text = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":738
 *     else:
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     if not c_text_node:
 *         raise MemoryError()
 */
    __pyx_v_c_text_node = xmlNewDocText(__pyx_v_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":739
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return c_text_node
 */
  __pyx_t_1 = (!(__pyx_v_c_text_node != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":740
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return c_text_node
 * 
 */
    PyErr_NoMemory(); __PYX_ERR(7, 740, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":739
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(doc, _xcstr(text))
 *     if not c_text_node:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return c_text_node
 */
  }

  /* "src/lxml/apihelpers.pxi":741
 *     if not c_text_node:
 *         raise MemoryError()
 *     return c_text_node             # <<<<<<<<<<<<<<
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
 */
  __pyx_r = __pyx_v_c_text_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":730
 *         c_node = c_next
 * 
 * cdef xmlNode* _createTextNode(xmlDoc* doc, value) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     if isinstance(value, CDATA):
 */

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

/* "src/lxml/apihelpers.pxi":743
 *     return c_text_node
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 */

static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":745
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
 *     # 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);

  /* "src/lxml/apihelpers.pxi":746
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":747
 *     _removeText(c_node.children)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":746
 *     # 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
 */
  }

  /* "src/lxml/apihelpers.pxi":749
 *         return 0
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)             # <<<<<<<<<<<<<<
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__createTextNode(__pyx_v_c_node->doc, __pyx_v_value); if (unlikely(__pyx_t_2 == ((xmlNode *)NULL))) __PYX_ERR(7, 749, __pyx_L1_error)
  __pyx_v_c_text_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":750
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->children == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":751
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 */
    (void)(xmlAddChild(__pyx_v_c_node, __pyx_v_c_text_node));

    /* "src/lxml/apihelpers.pxi":750
 *     # now add new text node with value at start
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":753
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_c_node->children, __pyx_v_c_text_node));
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":754
 *     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;

  /* "src/lxml/apihelpers.pxi":743
 *     return c_text_node
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 */

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

/* "src/lxml/apihelpers.pxi":756
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 */

static int __pyx_f_4lxml_5etree__setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":758
 * cdef int _setTailText(xmlNode* c_node, value) except -1:
 *     # 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);

  /* "src/lxml/apihelpers.pxi":759
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now append new text node with value
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":760
 *     _removeText(c_node.next)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":759
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now append new text node with value
 */
  }

  /* "src/lxml/apihelpers.pxi":762
 *         return 0
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)             # <<<<<<<<<<<<<<
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__createTextNode(__pyx_v_c_node->doc, __pyx_v_value); if (unlikely(__pyx_t_2 == ((xmlNode *)NULL))) __PYX_ERR(7, 762, __pyx_L1_error)
  __pyx_v_c_text_node = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":763
 *     # now append new text node with value
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     tree.xmlAddNextSibling(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (void)(xmlAddNextSibling(__pyx_v_c_node, __pyx_v_c_text_node));

  /* "src/lxml/apihelpers.pxi":764
 *     c_text_node = _createTextNode(c_node.doc, value)
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _resolveQNameText(_Element element, value):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":756
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 */

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

/* "src/lxml/apihelpers.pxi":766
 *     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;
  xmlNs *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_resolveQNameText", 1);

  /* "src/lxml/apihelpers.pxi":768
 * 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_ERR(7, 768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(7, 768, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(7, 768, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":769
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/apihelpers.pxi":770
 *     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) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_tag))) __PYX_ERR(7, 770, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_tag);
    __pyx_r = ((PyObject*)__pyx_v_tag);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":769
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
 */
  }

  /* "src/lxml/apihelpers.pxi":772
 *         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))
 */
  /*else*/ {

    /* "src/lxml/apihelpers.pxi":773
 *     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_5 = __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_5 == ((xmlNs *)NULL))) __PYX_ERR(7, 772, __pyx_L1_error)
    __pyx_v_c_ns = __pyx_t_5;

    /* "src/lxml/apihelpers.pxi":774
 *         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) noexcept:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyBytes_FromFormat(((char *)"%s:%s"), __pyx_v_c_ns->prefix, PyBytes_AS_STRING(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":766
 *     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;
}

/* "src/lxml/apihelpers.pxi":776
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":777
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":776
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":779
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":782
 *     "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;

  /* "src/lxml/apihelpers.pxi":783
 *     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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":784
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":785
 *     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);

      /* "src/lxml/apihelpers.pxi":784
 *     count = 0
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_node = c_node.next
 */
    }

    /* "src/lxml/apihelpers.pxi":786
 *         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;
  }

  /* "src/lxml/apihelpers.pxi":787
 *             count += 1
 *         c_node = c_node.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _findChildSlice(
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":779
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":789
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findChildSlice", 1);

  /* "src/lxml/apihelpers.pxi":797
 *     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;

  /* "src/lxml/apihelpers.pxi":798
 *     """
 *     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);

  /* "src/lxml/apihelpers.pxi":799
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":800
 *     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;

    /* "src/lxml/apihelpers.pxi":801
 *     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;

    /* "src/lxml/apihelpers.pxi":802
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":803
 *         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;

      /* "src/lxml/apihelpers.pxi":802
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             c_step[0] = 1
 *         else:
 */
      goto __pyx_L4;
    }

    /* "src/lxml/apihelpers.pxi":805
 *             c_step[0] = 1
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)             # <<<<<<<<<<<<<<
 *         return 0
 *     python.PySlice_GetIndicesEx(
 */
    /*else*/ {
      __pyx_t_2 = ((PySliceObject*)__pyx_v_sliceobject)->step;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = _PyEval_SliceIndex(__pyx_t_2, __pyx_v_c_step); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(7, 805, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L4:;

    /* "src/lxml/apihelpers.pxi":806
 *         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;

    /* "src/lxml/apihelpers.pxi":799
 *     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
 */
  }

  /* "src/lxml/apihelpers.pxi":807
 *             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_3 = 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_3 == ((int)-1))) __PYX_ERR(7, 807, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":809
 *     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_1 = (__pyx_v_start > __Pyx_div_Py_ssize_t(__pyx_v_childcount, 2));
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":810
 *         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));

    /* "src/lxml/apihelpers.pxi":809
 *     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:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":812
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_parent, __pyx_v_start);
  }
  __pyx_L5:;

  /* "src/lxml/apihelpers.pxi":813
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":789
 *     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_2);
  __Pyx_AddTraceback("lxml.etree._findChildSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":815
 *     return 0
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     """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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_isFullSlice", 1);

  /* "src/lxml/apihelpers.pxi":818
 *     """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;

  /* "src/lxml/apihelpers.pxi":819
 *     """
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":820
 *     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;

    /* "src/lxml/apihelpers.pxi":819
 *     """
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     if sliceobject.start is None and \
 */
  }

  /* "src/lxml/apihelpers.pxi":821
 *     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) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/apihelpers.pxi":822
 *         return 0
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             return 1
 */
  __pyx_t_2 = (((PySliceObject*)__pyx_v_sliceobject)->stop == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/apihelpers.pxi":821
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 */
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":823
 *     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_1 = (((PySliceObject*)__pyx_v_sliceobject)->step == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":824
 *             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;

      /* "src/lxml/apihelpers.pxi":823
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 */
    }

    /* "src/lxml/apihelpers.pxi":825
 *         if sliceobject.step is None:
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)             # <<<<<<<<<<<<<<
 *         if step == 1:
 *             return 1
 */
    __pyx_t_3 = ((PySliceObject*)__pyx_v_sliceobject)->step;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = _PyEval_SliceIndex(__pyx_t_3, (&__pyx_v_step)); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(7, 825, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":826
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
 */
    __pyx_t_1 = (__pyx_v_step == 1);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":827
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 *             return 1             # <<<<<<<<<<<<<<
 *         return 0
 *     return 0
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":826
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
 */
    }

    /* "src/lxml/apihelpers.pxi":828
 *         if step == 1:
 *             return 1
 *         return 0             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":821
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 */
  }

  /* "src/lxml/apihelpers.pxi":829
 *             return 1
 *         return 0
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _collectChildren(_Element element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":815
 *     return 0
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     """Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 */

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

/* "src/lxml/apihelpers.pxi":831
 *     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", 1);

  /* "src/lxml/apihelpers.pxi":833
 * 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_ERR(7, 833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":834
 *     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;

  /* "src/lxml/apihelpers.pxi":835
 *     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);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":836
 *     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));
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":837
 *     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);

      /* "src/lxml/apihelpers.pxi":836
 *     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:
 */
    }

    /* "src/lxml/apihelpers.pxi":838
 *         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);
      if (!__pyx_t_3) break;

      /* "src/lxml/apihelpers.pxi":839
 *             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_ERR(7, 839, __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 == ((int)-1))) __PYX_ERR(7, 839, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":840
 *         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);
    }

    /* "src/lxml/apihelpers.pxi":835
 *     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)
 */
  }

  /* "src/lxml/apihelpers.pxi":841
 *             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) noexcept:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":831
 *     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;
}

/* "src/lxml/apihelpers.pxi":843
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":844
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_index < 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":845
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     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;

    /* "src/lxml/apihelpers.pxi":844
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 */
  }

  /* "src/lxml/apihelpers.pxi":847
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 *         return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:
 */
  /*else*/ {
    __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":843
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":849
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":854
 *     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;

  /* "src/lxml/apihelpers.pxi":855
 *     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;

  /* "src/lxml/apihelpers.pxi":856
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":857
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":858
 *     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);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":859
 *         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;

        /* "src/lxml/apihelpers.pxi":858
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
 */
      }

      /* "src/lxml/apihelpers.pxi":860
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/apihelpers.pxi":857
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    }

    /* "src/lxml/apihelpers.pxi":861
 *                 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;
  }

  /* "src/lxml/apihelpers.pxi":862
 *             c += 1
 *         c_child = c_child.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":849
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":864
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":870
 *     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;

  /* "src/lxml/apihelpers.pxi":871
 *     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;

  /* "src/lxml/apihelpers.pxi":872
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":873
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":874
 *     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);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":875
 *         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;

        /* "src/lxml/apihelpers.pxi":874
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
 */
      }

      /* "src/lxml/apihelpers.pxi":876
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.prev
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/apihelpers.pxi":873
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    }

    /* "src/lxml/apihelpers.pxi":877
 *                 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;
  }

  /* "src/lxml/apihelpers.pxi":878
 *             c += 1
 *         c_child = c_child.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":864
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index) noexcept:             # <<<<<<<<<<<<<<
 *     """Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":880
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """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;

  /* "src/lxml/apihelpers.pxi":887
 *     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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":888
 *     """
 *     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
 */
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_CDATA_SECTION_NODE:

      /* "src/lxml/apihelpers.pxi":890
 *         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;

      /* "src/lxml/apihelpers.pxi":888
 *     """
 *     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
 */
      break;
      case XML_XINCLUDE_START:

      /* "src/lxml/apihelpers.pxi":891
 *                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_END:

      /* "src/lxml/apihelpers.pxi":893
 *         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;

      /* "src/lxml/apihelpers.pxi":891
 *                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
 */
      break;
      default:

      /* "src/lxml/apihelpers.pxi":895
 *             c_node = c_node.next
 *         else:
 *             return NULL             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      break;
    }
  }

  /* "src/lxml/apihelpers.pxi":896
 *         else:
 *             return NULL
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":880
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":898
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":901
 *     """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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":902
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.next
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":901
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.next
 */
  }

  /* "src/lxml/apihelpers.pxi":903
 *     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;

  /* "src/lxml/apihelpers.pxi":904
 *         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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":905
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":906
 *     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;

      /* "src/lxml/apihelpers.pxi":905
 *     c_node = c_node.next
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.next
 */
    }

    /* "src/lxml/apihelpers.pxi":907
 *         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;
  }

  /* "src/lxml/apihelpers.pxi":908
 *             return c_node
 *         c_node = c_node.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":898
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":910
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "src/lxml/apihelpers.pxi":913
 *     """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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":914
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":913
 *     """Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.prev
 */
  }

  /* "src/lxml/apihelpers.pxi":915
 *     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;

  /* "src/lxml/apihelpers.pxi":916
 *         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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":917
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":918
 *     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;

      /* "src/lxml/apihelpers.pxi":917
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.prev
 */
    }

    /* "src/lxml/apihelpers.pxi":919
 *         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;
  }

  /* "src/lxml/apihelpers.pxi":920
 *             return c_node
 *         c_node = c_node.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":910
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     """Given a node, find the next sibling that is an element.
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":922
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;

  /* "src/lxml/apihelpers.pxi":924
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
 *     "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_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!_isElement(__pyx_v_c_node));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":925
 *     "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;

    /* "src/lxml/apihelpers.pxi":924
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.parent
 */
  }

  /* "src/lxml/apihelpers.pxi":926
 *     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_3 = __pyx_v_c_node->parent;
  __pyx_v_c_node = __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":927
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (!_isElement(__pyx_v_c_node));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":928
 *     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;

    /* "src/lxml/apihelpers.pxi":927
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
 */
  }

  /* "src/lxml/apihelpers.pxi":929
 *     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) noexcept:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":922
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     "Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":931
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     """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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":945
 *     * 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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":946
 *     """
 *     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;

    /* "src/lxml/apihelpers.pxi":945
 *     * its name string equals the c_name string
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 */
  }

  /* "src/lxml/apihelpers.pxi":947
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":949
 *     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_2 = (__pyx_v_c_name == NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_href == NULL);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":947
 *     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
 */
  }

  /* "src/lxml/apihelpers.pxi":950
 *         # 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_1 = (__pyx_v_c_name == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":951
 *         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_1 = (__pyx_v_c_href == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":953
 *         if c_href is NULL:
 *             # always match
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             c_node_href = _getNs(c_node)
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":951
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:
 *         if c_href is NULL:             # <<<<<<<<<<<<<<
 *             # always match
 *             return 1
 */
    }

    /* "src/lxml/apihelpers.pxi":955
 *             return 1
 *         else:
 *             c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'
 */
    /*else*/ {
      __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":956
 *         else:
 *             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);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":957
 *             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;

        /* "src/lxml/apihelpers.pxi":956
 *         else:
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *                 return c_href[0] == c'\0'
 *             else:
 */
      }

      /* "src/lxml/apihelpers.pxi":959
 *                 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:
 */
      /*else*/ {
        __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
        goto __pyx_L0;
      }
    }

    /* "src/lxml/apihelpers.pxi":950
 *         # 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
 */
  }

  /* "src/lxml/apihelpers.pxi":960
 *             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_1 = (__pyx_v_c_href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":961
 *                 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_1 = (_getNs(__pyx_v_c_node) != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":962
 *     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;

      /* "src/lxml/apihelpers.pxi":961
 *                 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
 */
    }

    /* "src/lxml/apihelpers.pxi":963
 *         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_2 = (__pyx_v_c_node->name == __pyx_v_c_name);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":960
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:             # <<<<<<<<<<<<<<
 *         if _getNs(c_node) is not NULL:
 *             return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":964
 *             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);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":965
 *         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);

    /* "src/lxml/apihelpers.pxi":966
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":967
 *         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;

      /* "src/lxml/apihelpers.pxi":966
 *     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:
 */
    }

    /* "src/lxml/apihelpers.pxi":969
 *             return c_href[0] == c'\0'
 *         else:
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
 */
    /*else*/ {
      __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
      goto __pyx_L0;
    }

    /* "src/lxml/apihelpers.pxi":964
 *             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:
 */
  }

  /* "src/lxml/apihelpers.pxi":971
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:
 */
  /*else*/ {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":931
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":973
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:             # <<<<<<<<<<<<<<
 *     """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;

  /* "src/lxml/apihelpers.pxi":991
 *     * 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;

  /* "src/lxml/apihelpers.pxi":973
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname) noexcept:             # <<<<<<<<<<<<<<
 *     """Tests if the node matches namespace URI and tag name.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":993
 *     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) noexcept:
 */

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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1014
 *     """
 *     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_2 = (__pyx_v_c_qname->c_name != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_qname->c_name != __pyx_v_c_node_name);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1015
 *     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;

    /* "src/lxml/apihelpers.pxi":1014
 *     """
 *     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:
 */
  }

  /* "src/lxml/apihelpers.pxi":1016
 *     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_1 = (__pyx_v_c_qname->href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1017
 *         return 0
 *     if c_qname.href is NULL:
 *         return 1             # <<<<<<<<<<<<<<
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1016
 *     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)
 */
  }

  /* "src/lxml/apihelpers.pxi":1018
 *     if c_qname.href is NULL:
 *         return 1
 *     c_href = python.__cstr(c_qname.href)             # <<<<<<<<<<<<<<
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 */
  __pyx_v_c_href = PyBytes_AS_STRING(__pyx_v_c_qname->href);

  /* "src/lxml/apihelpers.pxi":1019
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_href[0]) == '\x00');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1020
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'             # <<<<<<<<<<<<<<
 *     elif c_node_href is NULL:
 *         return 0
 */
    __pyx_t_2 = (__pyx_v_c_node_href == NULL);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c_node_href[0]) == '\x00');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1019
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == b'\0':             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:
 */
  }

  /* "src/lxml/apihelpers.pxi":1021
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node_href == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1022
 *         return c_node_href is NULL or c_node_href[0] == b'\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;

    /* "src/lxml/apihelpers.pxi":1021
 *     if c_href[0] == b'\0':
 *         return c_node_href is NULL or c_node_href[0] == b'\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
 */
  }

  /* "src/lxml/apihelpers.pxi":1024
 *         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,
 */
  /*else*/ {
    __pyx_r = (xmlStrcmp(((const xmlChar *)__pyx_v_c_href), __pyx_v_c_node_href) == 0);
    goto __pyx_L0;
  }

  /* "src/lxml/apihelpers.pxi":993
 *     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) noexcept:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1026
 *         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:
 *     """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;
  Py_ssize_t __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", 1);

  /* "src/lxml/apihelpers.pxi":1034
 *     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;

  /* "src/lxml/apihelpers.pxi":1036
 *     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_ERR(7, 1036, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_ns_tags; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1036, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(7, 1036, __pyx_L1_error)
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(7, 1036, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(7, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1036, __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_ERR(7, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
      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_ERR(7, 1036, __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_ERR(7, 1036, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(7, 1036, __pyx_L1_error)
    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_5))) __PYX_ERR(7, 1036, __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;

    /* "src/lxml/apihelpers.pxi":1037
 *     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));
    if (__pyx_t_8) {

      /* "src/lxml/apihelpers.pxi":1038
 *     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);

      /* "src/lxml/apihelpers.pxi":1037
 *     cdef bytes ns, tag
 *     for ns, tag in ns_tags:
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             c_tag = <const_xmlChar*>NULL
 *         elif force_into_dict:
 */
      goto __pyx_L7;
    }

    /* "src/lxml/apihelpers.pxi":1039
 *         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:
 */
    if (__pyx_v_force_into_dict) {

      /* "src/lxml/apihelpers.pxi":1040
 *             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_ERR(7, 1040, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyBytes_GET_SIZE(__pyx_v_tag); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1040, __pyx_L1_error)
      __pyx_v_c_tag = xmlDictLookup(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_t_9);

      /* "src/lxml/apihelpers.pxi":1041
 *         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_8 = (__pyx_v_c_tag == NULL);
      if (__pyx_t_8) {

        /* "src/lxml/apihelpers.pxi":1043
 *             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_9 = __pyx_v_count;
        __pyx_t_10 = __pyx_t_9;
        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
          __pyx_v_i = __pyx_t_11;

          /* "src/lxml/apihelpers.pxi":1044
 *                 # 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);
        }

        /* "src/lxml/apihelpers.pxi":1045
 *                 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_ERR(7, 1045, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1041
 *         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):
 */
      }

      /* "src/lxml/apihelpers.pxi":1039
 *         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:
 */
      goto __pyx_L7;
    }

    /* "src/lxml/apihelpers.pxi":1047
 *                 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
 */
    /*else*/ {
      if (unlikely(__pyx_v_tag == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(7, 1047, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyBytes_GET_SIZE(__pyx_v_tag); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1047, __pyx_L1_error)
      __pyx_v_c_tag = xmlDictExists(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_t_9);

      /* "src/lxml/apihelpers.pxi":1048
 *         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_8 = (__pyx_v_c_tag == NULL);
      if (__pyx_t_8) {

        /* "src/lxml/apihelpers.pxi":1050
 *             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;

        /* "src/lxml/apihelpers.pxi":1048
 *         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_L7:;

    /* "src/lxml/apihelpers.pxi":1051
 *                 # 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;

    /* "src/lxml/apihelpers.pxi":1052
 *                 continue
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = NULL
 *         else:
 */
    __pyx_t_8 = (__pyx_v_ns == ((PyObject*)Py_None));
    if (__pyx_t_8) {

      /* "src/lxml/apihelpers.pxi":1053
 *         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;

      /* "src/lxml/apihelpers.pxi":1052
 *                 continue
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = NULL
 *         else:
 */
      goto __pyx_L12;
    }

    /* "src/lxml/apihelpers.pxi":1055
 *             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
 */
    /*else*/ {
      Py_INCREF(__pyx_v_ns);

      /* "src/lxml/apihelpers.pxi":1056
 *         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:;

    /* "src/lxml/apihelpers.pxi":1057
 *             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);

    /* "src/lxml/apihelpers.pxi":1036
 *     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
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1058
 *             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;

  /* "src/lxml/apihelpers.pxi":1026
 *         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:
 *     """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 = -1L;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1060
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """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;
  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;

  /* "src/lxml/apihelpers.pxi":1065
 *     """
 *     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;

  /* "src/lxml/apihelpers.pxi":1066
 *     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);

  /* "src/lxml/apihelpers.pxi":1067
 *     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);

  /* "src/lxml/apihelpers.pxi":1068
 *     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));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1070
 *     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 == ((int)-1))) __PYX_ERR(7, 1070, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1068
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 */
  }

  /* "src/lxml/apihelpers.pxi":1071
 *         # 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;

  /* "src/lxml/apihelpers.pxi":1060
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1073
 *     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;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1076
 *     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;

  /* "src/lxml/apihelpers.pxi":1077
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1078
 *     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);

    /* "src/lxml/apihelpers.pxi":1079
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1080
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      if (__pyx_v_with_tail) {

        /* "src/lxml/apihelpers.pxi":1081
 *         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);

        /* "src/lxml/apihelpers.pxi":1080
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      }

      /* "src/lxml/apihelpers.pxi":1082
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":1083
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     c_node = c_element.prev
 */
      (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1079
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    }

    /* "src/lxml/apihelpers.pxi":1084
 *             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;
  }

  /* "src/lxml/apihelpers.pxi":1085
 *             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;

  /* "src/lxml/apihelpers.pxi":1086
 *         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);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1087
 *     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);

    /* "src/lxml/apihelpers.pxi":1088
 *     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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1089
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      if (__pyx_v_with_tail) {

        /* "src/lxml/apihelpers.pxi":1090
 *         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);

        /* "src/lxml/apihelpers.pxi":1089
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      }

      /* "src/lxml/apihelpers.pxi":1091
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "src/lxml/apihelpers.pxi":1092
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
      (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1088
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    }

    /* "src/lxml/apihelpers.pxi":1093
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1094
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1073
 *     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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1096
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1100
 *     # 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);

  /* "src/lxml/apihelpers.pxi":1101
 *     # 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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1102
 *     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);

    /* "src/lxml/apihelpers.pxi":1103
 *     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);

    /* "src/lxml/apihelpers.pxi":1104
 *         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;
  }

  /* "src/lxml/apihelpers.pxi":1096
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
 */

  /* function exit code */
}

/* "src/lxml/apihelpers.pxi":1106
 *         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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1110
 *     # 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);

  /* "src/lxml/apihelpers.pxi":1111
 *     # 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);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1112
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1113
 *     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);

      /* "src/lxml/apihelpers.pxi":1112
 *     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:
 */
      goto __pyx_L5;
    }

    /* "src/lxml/apihelpers.pxi":1115
 *             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()
 */
    /*else*/ {
      __pyx_v_c_new_tail = xmlCopyNode(__pyx_v_c_tail, 0);
    }
    __pyx_L5:;

    /* "src/lxml/apihelpers.pxi":1116
 *         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);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1117
 *             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_ERR(7, 1117, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1116
 *         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)
 */
    }

    /* "src/lxml/apihelpers.pxi":1118
 *         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);

    /* "src/lxml/apihelpers.pxi":1119
 *             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);
  }

  /* "src/lxml/apihelpers.pxi":1120
 *         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;

  /* "src/lxml/apihelpers.pxi":1106
 *         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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1122
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  xmlDtd *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1124
 * 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;

  /* "src/lxml/apihelpers.pxi":1125
 *     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 or
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling->prev != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/apihelpers.pxi":1126
 *     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 or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 */
    switch (__pyx_v_c_sibling->prev->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:

      /* "src/lxml/apihelpers.pxi":1127
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev
 */
      case XML_DTD_NODE:

      /* "src/lxml/apihelpers.pxi":1126
 *     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 or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 */
      __pyx_t_2 = 1;
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1129
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE or
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:
 */
    __pyx_t_3 = __pyx_v_c_sibling->prev;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":1130
 *              c_sibling.prev.type == tree.XML_DTD_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:             # <<<<<<<<<<<<<<
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1131
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:             # <<<<<<<<<<<<<<
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 */
    __pyx_t_1 = (__pyx_v_c_sibling->type == XML_DTD_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1132
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)             # <<<<<<<<<<<<<<
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__copyDtd(((xmlDtd *)__pyx_v_c_sibling)); if (unlikely(__pyx_t_4 == ((xmlDtd *)NULL))) __PYX_ERR(7, 1132, __pyx_L1_error)
      __pyx_v_c_copy = ((xmlNode *)__pyx_t_4);

      /* "src/lxml/apihelpers.pxi":1133
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:             # <<<<<<<<<<<<<<
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
 */
      __pyx_t_1 = (__pyx_v_c_sibling == ((xmlNode *)__pyx_v_c_node->doc->intSubset));
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1134
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy             # <<<<<<<<<<<<<<
 *             else: # c_sibling == c_node.doc.extSubset
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy
 */
        __pyx_v_c_target->doc->intSubset = ((xmlDtd *)__pyx_v_c_copy);

        /* "src/lxml/apihelpers.pxi":1133
 *         if c_sibling.type == tree.XML_DTD_NODE:
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:             # <<<<<<<<<<<<<<
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
 */
        goto __pyx_L10;
      }

      /* "src/lxml/apihelpers.pxi":1136
 *                 c_target.doc.intSubset = <tree.xmlDtd*>c_copy
 *             else: # c_sibling == c_node.doc.extSubset
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy             # <<<<<<<<<<<<<<
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 */
      /*else*/ {
        __pyx_v_c_target->doc->extSubset = ((xmlDtd *)__pyx_v_c_copy);
      }
      __pyx_L10:;

      /* "src/lxml/apihelpers.pxi":1131
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         if c_sibling.type == tree.XML_DTD_NODE:             # <<<<<<<<<<<<<<
 *             c_copy = <xmlNode*>_copyDtd(<tree.xmlDtd*>c_sibling)
 *             if c_sibling == <xmlNode*>c_node.doc.intSubset:
 */
      goto __pyx_L9;
    }

    /* "src/lxml/apihelpers.pxi":1138
 *                 c_target.doc.extSubset = <tree.xmlDtd*>c_copy
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *             if c_copy is NULL:
 *                 raise MemoryError()
 */
    /*else*/ {
      __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

      /* "src/lxml/apihelpers.pxi":1139
 *         else:
 *             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_1 = (__pyx_v_c_copy == NULL);
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/apihelpers.pxi":1140
 *             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_ERR(7, 1140, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1139
 *         else:
 *             c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *             if c_copy is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 */
      }
    }
    __pyx_L9:;

    /* "src/lxml/apihelpers.pxi":1141
 *             if c_copy is NULL:
 *                 raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 */
    (void)(xmlAddPrevSibling(__pyx_v_c_target, __pyx_v_c_copy));

    /* "src/lxml/apihelpers.pxi":1142
 *                 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_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "src/lxml/apihelpers.pxi":1143
 *         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_2 = (__pyx_v_c_sibling->next != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }

    /* "src/lxml/apihelpers.pxi":1144
 *         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:
      case XML_COMMENT_NODE:

      /* "src/lxml/apihelpers.pxi":1145
 *     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)
 */
      __pyx_t_2 = 1;

      /* "src/lxml/apihelpers.pxi":1144
 *         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
 */
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1146
 *             (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_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;

    /* "src/lxml/apihelpers.pxi":1147
 *              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);

    /* "src/lxml/apihelpers.pxi":1148
 *         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_1 = (__pyx_v_c_copy == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1149
 *         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_ERR(7, 1149, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1148
 *         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)
 */
    }

    /* "src/lxml/apihelpers.pxi":1150
 *         if c_copy is NULL:
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,
 */
    (void)(xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_copy));
  }

  /* "src/lxml/apihelpers.pxi":1122
 *     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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1152
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     """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;
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1160
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1161
 *     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;

    /* "src/lxml/apihelpers.pxi":1160
 *     cdef Py_ssize_t c, i
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if step > 0:
 */
  }

  /* "src/lxml/apihelpers.pxi":1162
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  __pyx_t_1 = (__pyx_v_step > 0);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1163
 *         return 0
 *     if step > 0:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         step = -step
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

    /* "src/lxml/apihelpers.pxi":1162
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":1165
 *         next_element = _nextElement
 *     else:
 *         step = -step             # <<<<<<<<<<<<<<
 *         next_element = _previousElement
 *     # now start deleting nodes
 */
  /*else*/ {
    __pyx_v_step = (-__pyx_v_step);

    /* "src/lxml/apihelpers.pxi":1166
 *     else:
 *         step = -step
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 *     # now start deleting nodes
 *     c = 0
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":1168
 *         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;

  /* "src/lxml/apihelpers.pxi":1169
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1170
 *     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_2 = (__pyx_v_c_node != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c < __pyx_v_count);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L7_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1171
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 */
    __pyx_t_3 = __pyx_v_step;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "src/lxml/apihelpers.pxi":1172
 *     while c_node is not NULL and c < count:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *             if c_next is NULL:
 *                 break
 */
      __pyx_t_6 = __pyx_v_next_element(__pyx_v_c_next); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 1172, __pyx_L1_error)
      __pyx_v_c_next = __pyx_t_6;

      /* "src/lxml/apihelpers.pxi":1173
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(doc, c_node)
 */
      __pyx_t_1 = (__pyx_v_c_next == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1174
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 *                 break             # <<<<<<<<<<<<<<
 *         _removeNode(doc, c_node)
 *         c += 1
 */
        goto __pyx_L10_break;

        /* "src/lxml/apihelpers.pxi":1173
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(doc, c_node)
 */
      }
    }
    __pyx_L10_break:;

    /* "src/lxml/apihelpers.pxi":1175
 *             if c_next is NULL:
 *                 break
 *         _removeNode(doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 1175, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1176
 *                 break
 *         _removeNode(doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "src/lxml/apihelpers.pxi":1177
 *         _removeNode(doc, c_node)
 *         c += 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/apihelpers.pxi":1178
 *         c += 1
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1152
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     """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:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1180
 *     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;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  Py_ssize_t __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);

  /* "src/lxml/apihelpers.pxi":1195
 *     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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_step > 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(7, 1195, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 1195, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":1196
 *     cdef _node_to_node_function next_element
 *     assert step > 0
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1197
 *     assert step > 0
 *     if left_to_right:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         next_element = _previousElement
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

    /* "src/lxml/apihelpers.pxi":1196
 *     cdef _node_to_node_function next_element
 *     assert step > 0
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1199
 *         next_element = _nextElement
 *     else:
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 * 
 *     if not isinstance(elements, (list, tuple)):
 */
  /*else*/ {
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1201
 *         next_element = _previousElement
 * 
 *     if not isinstance(elements, (list, tuple)):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
 */
  __pyx_t_2 = PyList_Check(__pyx_v_elements); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = PyTuple_Check(__pyx_v_elements); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1202
 * 
 *     if not isinstance(elements, (list, tuple)):
 *         elements = list(elements)             # <<<<<<<<<<<<<<
 * 
 *     if step != 1 or not left_to_right:
 */
    __pyx_t_3 = PySequence_List(__pyx_v_elements); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1201
 *         next_element = _previousElement
 * 
 *     if not isinstance(elements, (list, tuple)):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":1204
 *         elements = list(elements)
 * 
 *     if step != 1 or not left_to_right:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 */
  __pyx_t_1 = (__pyx_v_step != 1);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = (!__pyx_v_left_to_right);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1206
 *     if step != 1 or not left_to_right:
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)             # <<<<<<<<<<<<<<
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1206, __pyx_L1_error)
    __pyx_v_seqlength = __pyx_t_4;

    /* "src/lxml/apihelpers.pxi":1207
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"
 */
    __pyx_t_2 = (__pyx_v_seqlength != __pyx_v_slicelength);
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/apihelpers.pxi":1208
 *         seqlength = len(elements)
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \             # <<<<<<<<<<<<<<
 *                 f"to extended slice of size {slicelength}"
 * 
 */
      __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_attempt_to_assign_sequence_of_si);
      __pyx_t_4 += 35;
      __Pyx_GIVEREF(__pyx_kp_u_attempt_to_assign_sequence_of_si);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_attempt_to_assign_sequence_of_si);
      __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_seqlength, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u_to_extended_slice_of_size);
      __pyx_t_4 += 27;
      __Pyx_GIVEREF(__pyx_kp_u_to_extended_slice_of_size);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_to_extended_slice_of_size);

      /* "src/lxml/apihelpers.pxi":1209
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
      __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_slicelength, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/apihelpers.pxi":1208
 *         seqlength = len(elements)
 *         if seqlength != slicelength:
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \             # <<<<<<<<<<<<<<
 *                 f"to extended slice of size {slicelength}"
 * 
 */
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(7, 1208, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1207
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, f"attempt to assign sequence of size {seqlength} " \
 *                 f"to extended slice of size {slicelength}"
 */
    }

    /* "src/lxml/apihelpers.pxi":1204
 *         elements = list(elements)
 * 
 *     if step != 1 or not left_to_right:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 */
  }

  /* "src/lxml/apihelpers.pxi":1211
 *                 f"to extended slice of size {slicelength}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1213
 *     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, "Node must not be None"
 */
    if (__pyx_v_left_to_right) {

      /* "src/lxml/apihelpers.pxi":1214
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)
 */
      if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_4 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1214, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1214, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1214, __pyx_L1_error)
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1214, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1214, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1214, __pyx_L1_error)
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1214, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_7(__pyx_t_6);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(7, 1214, __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__Element))))) __PYX_ERR(7, 1214, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":1215
 *         if left_to_right:
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *                 _appendChild(parent, element)
 *         else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!__pyx_t_2)) {
            __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
            __PYX_ERR(7, 1215, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(7, 1215, __pyx_L1_error)
        #endif

        /* "src/lxml/apihelpers.pxi":1216
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *         else:
 *             for element in elements:
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1216, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1214
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _appendChild(parent, element)
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/apihelpers.pxi":1213
 *     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, "Node must not be None"
 */
      goto __pyx_L12;
    }

    /* "src/lxml/apihelpers.pxi":1218
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)
 */
    /*else*/ {
      if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_4 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1218, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1218, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1218, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1218, __pyx_L1_error)
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1218, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1218, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1218, __pyx_L1_error)
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1218, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_7(__pyx_t_6);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(7, 1218, __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__Element))))) __PYX_ERR(7, 1218, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "src/lxml/apihelpers.pxi":1219
 *         else:
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *                 _prependChild(parent, element)
 *         return 0
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!__pyx_t_2)) {
            __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
            __PYX_ERR(7, 1219, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(7, 1219, __pyx_L1_error)
        #endif

        /* "src/lxml/apihelpers.pxi":1220
 *             for element in elements:
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1220, __pyx_L1_error)

        /* "src/lxml/apihelpers.pxi":1218
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, "Node must not be None"
 *                 _prependChild(parent, element)
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L12:;

    /* "src/lxml/apihelpers.pxi":1221
 *                 assert element is not None, "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;

    /* "src/lxml/apihelpers.pxi":1211
 *                 f"to extended slice of size {slicelength}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 */
  }

  /* "src/lxml/apihelpers.pxi":1224
 * 
 *     # 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)
 */
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1226
 *     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);

    /* "src/lxml/apihelpers.pxi":1224
 * 
 *     # 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)
 */
    goto __pyx_L19;
  }

  /* "src/lxml/apihelpers.pxi":1229
 *     else:
 *         # R->L, remember right neighbour
 *         c_orig_neighbour = _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 *     # We remove the original slice elements one by one. Since we hold
 */
  /*else*/ {
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  }
  __pyx_L19:;

  /* "src/lxml/apihelpers.pxi":1235
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1236
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1237
 *     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);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L22_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L22_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1238
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 */
    __pyx_t_4 = __pyx_v_step;
    __pyx_t_9 = __pyx_t_4;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "src/lxml/apihelpers.pxi":1239
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *             if c_next is NULL:
 *                 break
 */
      __pyx_t_11 = __pyx_v_next_element(__pyx_v_c_next); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 1239, __pyx_L1_error)
      __pyx_v_c_next = __pyx_t_11;

      /* "src/lxml/apihelpers.pxi":1240
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(parent._doc, c_node)
 */
      __pyx_t_2 = (__pyx_v_c_next == NULL);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1241
 *             c_next = next_element(c_next)
 *             if c_next is NULL:
 *                 break             # <<<<<<<<<<<<<<
 *         _removeNode(parent._doc, c_node)
 *         c += 1
 */
        goto __pyx_L25_break;

        /* "src/lxml/apihelpers.pxi":1240
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *             if c_next is NULL:             # <<<<<<<<<<<<<<
 *                 break
 *         _removeNode(parent._doc, c_node)
 */
      }
    }
    __pyx_L25_break:;

    /* "src/lxml/apihelpers.pxi":1242
 *             if c_next is NULL:
 *                 break
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_parent->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_8 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1242, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/apihelpers.pxi":1243
 *                 break
 *         _removeNode(parent._doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "src/lxml/apihelpers.pxi":1244
 *         _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;
  }

  /* "src/lxml/apihelpers.pxi":1247
 * 
 *     # make sure each element is inserted only once
 *     elements = iter(elements)             # <<<<<<<<<<<<<<
 * 
 *     # find the first node right of the new insertion point
 */
  __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "src/lxml/apihelpers.pxi":1250
 * 
 *     # 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)
 */
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1251
 *     # 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);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1252
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)             # <<<<<<<<<<<<<<
 *         else:
 *             # before the first element
 */
      __pyx_t_11 = __pyx_v_next_element(__pyx_v_c_orig_neighbour); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 1252, __pyx_L1_error)
      __pyx_v_c_node = __pyx_t_11;

      /* "src/lxml/apihelpers.pxi":1251
 *     # 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:
 */
      goto __pyx_L28;
    }

    /* "src/lxml/apihelpers.pxi":1255
 *         else:
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     elif c_orig_neighbour is NULL:
 *         # at the end, but reversed stepping
 */
    /*else*/ {
      __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);
    }
    __pyx_L28:;

    /* "src/lxml/apihelpers.pxi":1250
 * 
 *     # 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)
 */
    goto __pyx_L27;
  }

  /* "src/lxml/apihelpers.pxi":1256
 *             # 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);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1259
 *         # 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, "Node must not be None"
 *             _appendChild(parent, element)
 */
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1259, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1259, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1259, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1259, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1259, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 1259, __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__Element))))) __PYX_ERR(7, 1259, __pyx_L1_error)
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":1260
 *         # append one element and go to the next insertion point
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(7, 1260, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(7, 1260, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1261
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *             c_node = element._c_node
 *             if slicelength > 0:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1261, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1262
 *             assert element is not None, "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;

      /* "src/lxml/apihelpers.pxi":1263
 *             _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);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1264
 *             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);

        /* "src/lxml/apihelpers.pxi":1265
 *             if slicelength > 0:
 *                 slicelength -= 1
 *                 for i in range(1, step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 */
        __pyx_t_9 = __pyx_v_step;
        __pyx_t_10 = __pyx_t_9;
        for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_10; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

          /* "src/lxml/apihelpers.pxi":1266
 *                 slicelength -= 1
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
 */
          __pyx_t_11 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 1266, __pyx_L1_error)
          __pyx_v_c_node = __pyx_t_11;

          /* "src/lxml/apihelpers.pxi":1267
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             break
 */
          __pyx_t_2 = (__pyx_v_c_node == NULL);
          if (__pyx_t_2) {

            /* "src/lxml/apihelpers.pxi":1268
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *             break
 *     else:
 */
            goto __pyx_L33_break;

            /* "src/lxml/apihelpers.pxi":1267
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             break
 */
          }
        }
        __pyx_L33_break:;

        /* "src/lxml/apihelpers.pxi":1263
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(1, step):
 */
      }

      /* "src/lxml/apihelpers.pxi":1269
 *                     if c_node is NULL:
 *                         break
 *             break             # <<<<<<<<<<<<<<
 *     else:
 *         c_node = c_orig_neighbour
 */
      goto __pyx_L30_break;

      /* "src/lxml/apihelpers.pxi":1259
 *         # 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, "Node must not be None"
 *             _appendChild(parent, element)
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L35_for_end;
    __pyx_L30_break:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L35_for_end;
    __pyx_L35_for_end:;

    /* "src/lxml/apihelpers.pxi":1256
 *             # 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
 */
    goto __pyx_L27;
  }

  /* "src/lxml/apihelpers.pxi":1271
 *             break
 *     else:
 *         c_node = c_orig_neighbour             # <<<<<<<<<<<<<<
 * 
 *     if left_to_right:
 */
  /*else*/ {
    __pyx_v_c_node = __pyx_v_c_orig_neighbour;
  }
  __pyx_L27:;

  /* "src/lxml/apihelpers.pxi":1273
 *         c_node = c_orig_neighbour
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 */
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1276
 *         # 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);

    /* "src/lxml/apihelpers.pxi":1273
 *         c_node = c_orig_neighbour
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 */
  }

  /* "src/lxml/apihelpers.pxi":1279
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1280
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1280, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1280, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1280, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1280, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1280, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1280, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1280, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 1280, __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__Element))))) __PYX_ERR(7, 1280, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":1281
 *     if c_node is not NULL:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             # move element and tail over
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(7, 1281, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(7, 1281, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1282
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1282, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1284
 *             _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;

      /* "src/lxml/apihelpers.pxi":1285
 *             # 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;

      /* "src/lxml/apihelpers.pxi":1286
 *             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)
 * 
 */
      (void)(xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node));

      /* "src/lxml/apihelpers.pxi":1287
 *             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);

      /* "src/lxml/apihelpers.pxi":1290
 * 
 *             # integrate element into new document
 *             moveNodeToDocument(parent._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # stop at the end of the slice
 */
      __pyx_t_3 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_8 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":1293
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(step):
 */
      __pyx_t_2 = (__pyx_v_slicelength > 0);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1294
 *             # stop at the end of the slice
 *             if slicelength > 0:
 *                 slicelength -= 1             # <<<<<<<<<<<<<<
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 */
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "src/lxml/apihelpers.pxi":1295
 *             if slicelength > 0:
 *                 slicelength -= 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 */
        __pyx_t_9 = __pyx_v_step;
        __pyx_t_10 = __pyx_t_9;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_10; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

          /* "src/lxml/apihelpers.pxi":1296
 *                 slicelength -= 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
 */
          __pyx_t_11 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 1296, __pyx_L1_error)
          __pyx_v_c_node = __pyx_t_11;

          /* "src/lxml/apihelpers.pxi":1297
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *                 if c_node is NULL:
 */
          __pyx_t_2 = (__pyx_v_c_node == NULL);
          if (__pyx_t_2) {

            /* "src/lxml/apihelpers.pxi":1298
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *                 if c_node is NULL:
 *                     break
 */
            goto __pyx_L42_break;

            /* "src/lxml/apihelpers.pxi":1297
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *                 if c_node is NULL:
 */
          }
        }
        __pyx_L42_break:;

        /* "src/lxml/apihelpers.pxi":1299
 *                     if c_node is NULL:
 *                         break
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
 */
        __pyx_t_2 = (__pyx_v_c_node == NULL);
        if (__pyx_t_2) {

          /* "src/lxml/apihelpers.pxi":1300
 *                         break
 *                 if c_node is NULL:
 *                     break             # <<<<<<<<<<<<<<
 *         else:
 *             # everything inserted
 */
          goto __pyx_L39_break;

          /* "src/lxml/apihelpers.pxi":1299
 *                     if c_node is NULL:
 *                         break
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
 */
        }

        /* "src/lxml/apihelpers.pxi":1293
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(step):
 */
      }

      /* "src/lxml/apihelpers.pxi":1280
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L45_for_else;
    __pyx_L39_break:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L46_for_end;
    /*else*/ {
      __pyx_L45_for_else:;

      /* "src/lxml/apihelpers.pxi":1303
 *         else:
 *             # everything inserted
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     # append the remaining elements at the respective end
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }
    __pyx_L46_for_end:;

    /* "src/lxml/apihelpers.pxi":1279
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 */
  }

  /* "src/lxml/apihelpers.pxi":1306
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 */
  if (__pyx_v_left_to_right) {

    /* "src/lxml/apihelpers.pxi":1307
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1307, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1307, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1307, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1307, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1307, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1307, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1307, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 1307, __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__Element))))) __PYX_ERR(7, 1307, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":1308
 *     if left_to_right:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(7, 1308, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(7, 1308, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1309
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *     else:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1309, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1310
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *     else:
 *         for element in elements:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1310, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1307
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/apihelpers.pxi":1306
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 */
    goto __pyx_L47;
  }

  /* "src/lxml/apihelpers.pxi":1312
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 1312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1312, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1312, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1312, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(7, 1312, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(7, 1312, __pyx_L1_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(7, 1312, __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__Element))))) __PYX_ERR(7, 1312, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "src/lxml/apihelpers.pxi":1313
 *     else:
 *         for element in elements:
 *             assert element is not None, "Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _prependChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_2)) {
          __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
          __PYX_ERR(7, 1313, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(7, 1313, __pyx_L1_error)
      #endif

      /* "src/lxml/apihelpers.pxi":1314
 *         for element in elements:
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _prependChild(parent, element)
 * 
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1314, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1315
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 *             _prependChild(parent, element)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 1315, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1312
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, "Node must not be None"
 *             _assertValidNode(element)
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L47:;

  /* "src/lxml/apihelpers.pxi":1317
 *             _prependChild(parent, element)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1180
 *     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_3);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/apihelpers.pxi":1320
 * 
 * 
 * cdef int _linkChild(xmlNode* c_parent, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
 */

static int __pyx_f_4lxml_5etree__linkChild(xmlNode *__pyx_v_c_parent, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1323
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
 *     assert _isElement(c_node)             # <<<<<<<<<<<<<<
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(7, 1323, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(7, 1323, __pyx_L1_error)
  #endif

  /* "src/lxml/apihelpers.pxi":1324
 *     """
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent             # <<<<<<<<<<<<<<
 *     if c_parent.children is NULL:
 *         c_parent.children = c_parent.last = c_node
 */
  __pyx_v_c_node->parent = __pyx_v_c_parent;

  /* "src/lxml/apihelpers.pxi":1325
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_parent.last = c_node
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_parent->children == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1326
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:
 *         c_parent.children = c_parent.last = c_node             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.prev = c_parent.last
 */
    __pyx_v_c_parent->children = __pyx_v_c_node;
    __pyx_v_c_parent->last = __pyx_v_c_node;

    /* "src/lxml/apihelpers.pxi":1325
 *     assert _isElement(c_node)
 *     c_node.parent = c_parent
 *     if c_parent.children is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_parent.last = c_node
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1328
 *         c_parent.children = c_parent.last = c_node
 *     else:
 *         c_node.prev = c_parent.last             # <<<<<<<<<<<<<<
 *         c_parent.last.next = c_node
 *         c_parent.last = c_node
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_c_parent->last;
    __pyx_v_c_node->prev = __pyx_t_2;

    /* "src/lxml/apihelpers.pxi":1329
 *     else:
 *         c_node.prev = c_parent.last
 *         c_parent.last.next = c_node             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node
 * 
 */
    __pyx_v_c_parent->last->next = __pyx_v_c_node;

    /* "src/lxml/apihelpers.pxi":1330
 *         c_node.prev = c_parent.last
 *         c_parent.last.next = c_node
 *         c_parent.last = c_node             # <<<<<<<<<<<<<<
 * 
 *     _setTreeDoc(c_node, c_parent.doc)
 */
    __pyx_v_c_parent->last = __pyx_v_c_node;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1332
 *         c_parent.last = c_node
 * 
 *     _setTreeDoc(c_node, c_parent.doc)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_f_4lxml_5etree__setTreeDoc(__pyx_v_c_node, __pyx_v_c_parent->doc);

  /* "src/lxml/apihelpers.pxi":1333
 * 
 *     _setTreeDoc(c_node, c_parent.doc)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1320
 * 
 * 
 * cdef int _linkChild(xmlNode* c_parent, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     """Adaptation of 'xmlAddChild()' that deep-fix the document links iteratively.
 *     """
 */

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

/* "src/lxml/apihelpers.pxi":1336
 * 
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """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_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", 1);

  /* "src/lxml/apihelpers.pxi":1339
 *     """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;

  /* "src/lxml/apihelpers.pxi":1340
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1342
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_parent->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/apihelpers.pxi":1343
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 *         raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1343, __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_ERR(7, 1343, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1342
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 */
  }

  /* "src/lxml/apihelpers.pxi":1345
 *         raise ValueError("cannot append parent to itself")
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1347
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(parent._c_node, c_node)
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "src/lxml/apihelpers.pxi":1349
 *     tree.xmlUnlinkNode(c_node)
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__linkChild(__pyx_v_parent->_c_node, __pyx_v_c_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 1349, __pyx_L1_error)

  /* "src/lxml/apihelpers.pxi":1350
 *     # do not call xmlAddChild() here since it would deep-traverse the tree
 *     _linkChild(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);

  /* "src/lxml/apihelpers.pxi":1353
 *     # 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 == ((int)-1))) __PYX_ERR(7, 1353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1354
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1336
 * 
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1356
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """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_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", 1);

  /* "src/lxml/apihelpers.pxi":1359
 *     """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;

  /* "src/lxml/apihelpers.pxi":1360
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1362
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_parent->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/apihelpers.pxi":1363
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 *         raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1363, __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_ERR(7, 1363, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1362
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot append parent to itself")
 *     # store possible text node
 */
  }

  /* "src/lxml/apihelpers.pxi":1365
 *         raise ValueError("cannot append parent to itself")
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1367
 *     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);

  /* "src/lxml/apihelpers.pxi":1368
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 */
  __pyx_t_3 = (__pyx_v_c_child == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":1369
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 *         _linkChild(parent._c_node, c_node)
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "src/lxml/apihelpers.pxi":1371
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 *         _linkChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__linkChild(__pyx_v_parent->_c_node, __pyx_v_c_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 1371, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1368
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         # do not call xmlAddChild() here since it would deep-traverse the tree
 */
    goto __pyx_L4;
  }

  /* "src/lxml/apihelpers.pxi":1373
 *         _linkChild(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
 */
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_c_child, __pyx_v_c_node));
  }
  __pyx_L4:;

  /* "src/lxml/apihelpers.pxi":1374
 *     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);

  /* "src/lxml/apihelpers.pxi":1377
 *     # 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 == ((int)-1))) __PYX_ERR(7, 1377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1378
 *     # 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;

  /* "src/lxml/apihelpers.pxi":1356
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1380
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling behind an element.
 *     """
 */

static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1383
 *     """Add a new sibling behind an element.
 *     """
 *     return _addSibling(element, sibling, as_next=True)             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__addSibling(__pyx_v_element, __pyx_v_sibling, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 1383, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1380
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling behind an element.
 *     """
 */

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

/* "src/lxml/apihelpers.pxi":1385
 *     return _addSibling(element, sibling, as_next=True)
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling before an element.
 *     """
 */

static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1388
 *     """Add a new sibling before an element.
 *     """
 *     return _addSibling(element, sibling, as_next=False)             # <<<<<<<<<<<<<<
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__addSibling(__pyx_v_element, __pyx_v_sibling, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 1388, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1385
 *     return _addSibling(element, sibling, as_next=True)
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     """Add a new sibling before an element.
 *     """
 */

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

/* "src/lxml/apihelpers.pxi":1390
 *     return _addSibling(element, sibling, as_next=False)
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:             # <<<<<<<<<<<<<<
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc
 */

static int __pyx_f_4lxml_5etree__addSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling, int __pyx_v_as_next) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_next_node;
  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("_addSibling", 1);

  /* "src/lxml/apihelpers.pxi":1391
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
 *     c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 */
  __pyx_t_1 = __pyx_v_sibling->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1392
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1394
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):             # <<<<<<<<<<<<<<
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_node, __pyx_v_element->_c_node);
  if (__pyx_t_3) {

    /* "src/lxml/apihelpers.pxi":1395
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 */
    __pyx_t_3 = (__pyx_v_element->_c_node == __pyx_v_c_node);
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":1396
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:
 *             return 0  # nothing to do             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 *     # store possible text node
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1395
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):
 *         if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 */
    }

    /* "src/lxml/apihelpers.pxi":1397
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1397, __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_ERR(7, 1397, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1394
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, element._c_node):             # <<<<<<<<<<<<<<
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
 */
  }

  /* "src/lxml/apihelpers.pxi":1399
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     if as_next:
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1401
 *     c_next = c_node.next
 *     # move node itself
 *     if as_next:             # <<<<<<<<<<<<<<
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 */
  if (__pyx_v_as_next) {

    /* "src/lxml/apihelpers.pxi":1403
 *     if as_next:
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)             # <<<<<<<<<<<<<<
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node
 */
    __pyx_v_c_next_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_element->_c_node);

    /* "src/lxml/apihelpers.pxi":1404
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:             # <<<<<<<<<<<<<<
 *             c_next_node = element._c_node
 *             while c_next_node.next:
 */
    __pyx_t_3 = (__pyx_v_c_next_node == NULL);
    if (__pyx_t_3) {

      /* "src/lxml/apihelpers.pxi":1405
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node             # <<<<<<<<<<<<<<
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next
 */
      __pyx_t_1 = __pyx_v_element->_c_node;
      __pyx_v_c_next_node = __pyx_t_1;

      /* "src/lxml/apihelpers.pxi":1406
 *         if c_next_node is NULL:
 *             c_next_node = element._c_node
 *             while c_next_node.next:             # <<<<<<<<<<<<<<
 *                 c_next_node = c_next_node.next
 *             tree.xmlAddNextSibling(c_next_node, c_node)
 */
      while (1) {
        __pyx_t_3 = (__pyx_v_c_next_node->next != 0);
        if (!__pyx_t_3) break;

        /* "src/lxml/apihelpers.pxi":1407
 *             c_next_node = element._c_node
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next             # <<<<<<<<<<<<<<
 *             tree.xmlAddNextSibling(c_next_node, c_node)
 *         else:
 */
        __pyx_t_1 = __pyx_v_c_next_node->next;
        __pyx_v_c_next_node = __pyx_t_1;
      }

      /* "src/lxml/apihelpers.pxi":1408
 *             while c_next_node.next:
 *                 c_next_node = c_next_node.next
 *             tree.xmlAddNextSibling(c_next_node, c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlAddPrevSibling(c_next_node, c_node)
 */
      (void)(xmlAddNextSibling(__pyx_v_c_next_node, __pyx_v_c_node));

      /* "src/lxml/apihelpers.pxi":1404
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 *         if c_next_node is NULL:             # <<<<<<<<<<<<<<
 *             c_next_node = element._c_node
 *             while c_next_node.next:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/apihelpers.pxi":1410
 *             tree.xmlAddNextSibling(c_next_node, c_node)
 *         else:
 *             tree.xmlAddPrevSibling(c_next_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(element._c_node, c_node)
 */
    /*else*/ {
      (void)(xmlAddPrevSibling(__pyx_v_c_next_node, __pyx_v_c_node));
    }
    __pyx_L6:;

    /* "src/lxml/apihelpers.pxi":1401
 *     c_next = c_node.next
 *     # move node itself
 *     if as_next:             # <<<<<<<<<<<<<<
 *         # must insert after any tail text
 *         c_next_node = _nextElement(element._c_node)
 */
    goto __pyx_L5;
  }

  /* "src/lxml/apihelpers.pxi":1412
 *             tree.xmlAddPrevSibling(c_next_node, c_node)
 *     else:
 *         tree.xmlAddPrevSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  /*else*/ {
    (void)(xmlAddPrevSibling(__pyx_v_element->_c_node, __pyx_v_c_node));
  }
  __pyx_L5:;

  /* "src/lxml/apihelpers.pxi":1413
 *     else:
 *         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);

  /* "src/lxml/apihelpers.pxi":1416
 *     # 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 == ((int)-1))) __PYX_ERR(7, 1416, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/apihelpers.pxi":1417
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1390
 *     return _addSibling(element, sibling, as_next=False)
 * 
 * cdef int _addSibling(_Element element, _Element sibling, bint as_next) except -1:             # <<<<<<<<<<<<<<
 *     c_node = sibling._c_node
 *     c_source_doc = c_node.doc
 */

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

/* "src/lxml/apihelpers.pxi":1419
 *     return 0
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/apihelpers.pxi":1420
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
 *     cdef xmlChar c = s[0]             # <<<<<<<<<<<<<<
 *     while c != c'\0':
 *         if c & 0x80:
 */
  __pyx_v_c = (__pyx_v_s[0]);

  /* "src/lxml/apihelpers.pxi":1421
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':             # <<<<<<<<<<<<<<
 *         if c & 0x80:
 *             return True
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c != '\x00');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1422
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
 */
    __pyx_t_1 = ((__pyx_v_c & 0x80) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1423
 *     while c != c'\0':
 *         if c & 0x80:
 *             return True             # <<<<<<<<<<<<<<
 *         s += 1
 *         c = s[0]
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1422
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
 */
    }

    /* "src/lxml/apihelpers.pxi":1424
 *         if c & 0x80:
 *             return True
 *         s += 1             # <<<<<<<<<<<<<<
 *         c = s[0]
 *     return False
 */
    __pyx_v_s = (__pyx_v_s + 1);

    /* "src/lxml/apihelpers.pxi":1425
 *             return True
 *         s += 1
 *         c = s[0]             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __pyx_v_c = (__pyx_v_s[0]);
  }

  /* "src/lxml/apihelpers.pxi":1426
 *         s += 1
 *         c = s[0]
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1419
 *     return 0
 * 
 * cdef inline bint isutf8(const_xmlChar* s) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1428
 *     return False
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Search for non-ASCII characters in the string, knowing its length in advance.
 */

static int __pyx_f_4lxml_5etree_isutf8l(const xmlChar *__pyx_v_s, size_t __pyx_v_length) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  unsigned long __pyx_v_non_ascii_mask;
  unsigned long const *__pyx_v_lptr;
  unsigned long const *__pyx_v_end;
  int __pyx_r;
  size_t __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  unsigned int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1434
 *     cdef unsigned int i
 *     cdef unsigned long non_ascii_mask
 *     cdef const unsigned long *lptr = <const unsigned long*> s             # <<<<<<<<<<<<<<
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
 */
  __pyx_v_lptr = ((unsigned long const *)__pyx_v_s);

  /* "src/lxml/apihelpers.pxi":1436
 *     cdef const unsigned long *lptr = <const unsigned long*> s
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)             # <<<<<<<<<<<<<<
 *     if length >= sizeof(non_ascii_mask):
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 */
  __pyx_t_1 = (sizeof(unsigned long));
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(7, 1436, __pyx_L1_error)
  }
  __pyx_v_end = (__pyx_v_lptr + (__pyx_v_length / __pyx_t_1));

  /* "src/lxml/apihelpers.pxi":1437
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
 *     if length >= sizeof(non_ascii_mask):             # <<<<<<<<<<<<<<
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
 */
  __pyx_t_2 = (__pyx_v_length >= (sizeof(__pyx_v_non_ascii_mask)));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1439
 *     if length >= sizeof(non_ascii_mask):
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0             # <<<<<<<<<<<<<<
 *         for i in range(sizeof(non_ascii_mask) // 2):
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080
 */
    __pyx_v_non_ascii_mask = 0;

    /* "src/lxml/apihelpers.pxi":1440
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
 *         for i in range(sizeof(non_ascii_mask) // 2):             # <<<<<<<<<<<<<<
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080
 * 
 */
    __pyx_t_1 = ((sizeof(__pyx_v_non_ascii_mask)) / 2);
    __pyx_t_3 = __pyx_t_1;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "src/lxml/apihelpers.pxi":1441
 *         non_ascii_mask = 0
 *         for i in range(sizeof(non_ascii_mask) // 2):
 *             non_ascii_mask = (non_ascii_mask << 16) | 0x8080             # <<<<<<<<<<<<<<
 * 
 *         # Advance to long-aligned character before we start reading longs.
 */
      __pyx_v_non_ascii_mask = ((__pyx_v_non_ascii_mask << 16) | 0x8080);
    }

    /* "src/lxml/apihelpers.pxi":1444
 * 
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:             # <<<<<<<<<<<<<<
 *             if s[0] & 0x80:
 *                 return True
 */
    while (1) {
      __pyx_t_1 = (sizeof(unsigned long));
      if (unlikely(__pyx_t_1 == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(7, 1444, __pyx_L1_error)
      }
      __pyx_t_5 = ((((size_t)__pyx_v_s) % __pyx_t_1) != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_2 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = (__pyx_v_s < ((const xmlChar *)__pyx_v_end));
      __pyx_t_2 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":1445
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 return True
 *             s += 1
 */
      __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1446
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:
 *                 return True             # <<<<<<<<<<<<<<
 *             s += 1
 * 
 */
        __pyx_r = 1;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1445
 *         # Advance to long-aligned character before we start reading longs.
 *         while (<size_t>s) % sizeof(unsigned long) and s < <const_xmlChar *>end:
 *             if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 return True
 *             s += 1
 */
      }

      /* "src/lxml/apihelpers.pxi":1447
 *             if s[0] & 0x80:
 *                 return True
 *             s += 1             # <<<<<<<<<<<<<<
 * 
 *         # Read one long at a time
 */
      __pyx_v_s = (__pyx_v_s + 1);
    }

    /* "src/lxml/apihelpers.pxi":1450
 * 
 *         # Read one long at a time
 *         lptr = <const unsigned long*> s             # <<<<<<<<<<<<<<
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:
 */
    __pyx_v_lptr = ((unsigned long const *)__pyx_v_s);

    /* "src/lxml/apihelpers.pxi":1451
 *         # Read one long at a time
 *         lptr = <const unsigned long*> s
 *         while lptr < end:             # <<<<<<<<<<<<<<
 *             if lptr[0] & non_ascii_mask:
 *                 return True
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_lptr < __pyx_v_end);
      if (!__pyx_t_2) break;

      /* "src/lxml/apihelpers.pxi":1452
 *         lptr = <const unsigned long*> s
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:             # <<<<<<<<<<<<<<
 *                 return True
 *             lptr += 1
 */
      __pyx_t_2 = (((__pyx_v_lptr[0]) & __pyx_v_non_ascii_mask) != 0);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1453
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:
 *                 return True             # <<<<<<<<<<<<<<
 *             lptr += 1
 *         s = <const_xmlChar *>lptr
 */
        __pyx_r = 1;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1452
 *         lptr = <const unsigned long*> s
 *         while lptr < end:
 *             if lptr[0] & non_ascii_mask:             # <<<<<<<<<<<<<<
 *                 return True
 *             lptr += 1
 */
      }

      /* "src/lxml/apihelpers.pxi":1454
 *             if lptr[0] & non_ascii_mask:
 *                 return True
 *             lptr += 1             # <<<<<<<<<<<<<<
 *         s = <const_xmlChar *>lptr
 * 
 */
      __pyx_v_lptr = (__pyx_v_lptr + 1);
    }

    /* "src/lxml/apihelpers.pxi":1455
 *                 return True
 *             lptr += 1
 *         s = <const_xmlChar *>lptr             # <<<<<<<<<<<<<<
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 */
    __pyx_v_s = ((const xmlChar *)__pyx_v_lptr);

    /* "src/lxml/apihelpers.pxi":1437
 * 
 *     cdef const unsigned long *end = lptr + length // sizeof(unsigned long)
 *     if length >= sizeof(non_ascii_mask):             # <<<<<<<<<<<<<<
 *         # Build constant 0x80808080... mask (and let the C compiler fold it).
 *         non_ascii_mask = 0
 */
  }

  /* "src/lxml/apihelpers.pxi":1457
 *         s = <const_xmlChar *>lptr
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             return True
 */
  while (1) {
    __pyx_t_1 = (sizeof(unsigned long));
    if (unlikely(__pyx_t_1 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(7, 1457, __pyx_L1_error)
    }
    __pyx_t_2 = (__pyx_v_s < (((const xmlChar *)__pyx_v_end) + (__pyx_v_length % __pyx_t_1)));
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1458
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
 */
    __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1459
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:
 *             return True             # <<<<<<<<<<<<<<
 *         s += 1
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1458
 * 
 *     while s < (<const_xmlChar *>end + length % sizeof(unsigned long)):
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             return True
 *         s += 1
 */
    }

    /* "src/lxml/apihelpers.pxi":1460
 *         if s[0] & 0x80:
 *             return True
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     return False
 */
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1462
 *         s += 1
 * 
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1428
 *     return False
 * 
 * cdef bint isutf8l(const_xmlChar* s, size_t length) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Search for non-ASCII characters in the string, knowing its length in advance.
 */

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

/* "src/lxml/apihelpers.pxi":1464
 *     return False
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is XML ascii content."""
 *     cdef signed char ch
 */

static int __pyx_f_4lxml_5etree__is_valid_xml_ascii(PyObject *__pyx_v_pystring) {
  signed char __pyx_v_ch;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  char *__pyx_t_3;
  char *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_valid_xml_ascii", 1);

  /* "src/lxml/apihelpers.pxi":1469
 *     # When ch is a *signed* char, non-ascii characters are negative integers
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:             # <<<<<<<<<<<<<<
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0
 */
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(7, 1469, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_pystring);
  __pyx_t_1 = __pyx_v_pystring;
  __pyx_t_3 = PyBytes_AS_STRING(__pyx_t_1);
  __pyx_t_4 = (__pyx_t_3 + PyBytes_GET_SIZE(__pyx_t_1));
  for (__pyx_t_5 = __pyx_t_3; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_2 = __pyx_t_5;
    __pyx_v_ch = (__pyx_t_2[0]);

    /* "src/lxml/apihelpers.pxi":1470
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):             # <<<<<<<<<<<<<<
 *             return 0
 *     return 1
 */
    __pyx_t_6 = (!(xmlIsChar_ch(__pyx_v_ch) != 0));
    if (__pyx_t_6) {

      /* "src/lxml/apihelpers.pxi":1471
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1470
 *     # and xmlIsChar_ch does not accept them.
 *     for ch in pystring:
 *         if not tree.xmlIsChar_ch(ch):             # <<<<<<<<<<<<<<
 *             return 0
 *     return 1
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1472
 *         if not tree.xmlIsChar_ch(ch):
 *             return 0
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1464
 *     return False
 * 
 * cdef int _is_valid_xml_ascii(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is XML ascii content."""
 *     cdef signed char ch
 */

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

/* "src/lxml/apihelpers.pxi":1474
 *     return 1
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
 */

static int __pyx_f_4lxml_5etree__is_valid_xml_utf8(PyObject *__pyx_v_pystring) {
  const xmlChar *__pyx_v_s;
  const xmlChar *__pyx_v_c_end;
  unsigned long __pyx_v_next3;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1476
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
 */
  __pyx_v_s = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_pystring);

  /* "src/lxml/apihelpers.pxi":1477
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)             # <<<<<<<<<<<<<<
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:
 */
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(7, 1477, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_pystring); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1477, __pyx_L1_error)
  __pyx_v_c_end = (__pyx_v_s + __pyx_t_1);

  /* "src/lxml/apihelpers.pxi":1478
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0             # <<<<<<<<<<<<<<
 *     if s < c_end - 2:
 *         next3 = (s[0] << 8) | (s[1])
 */
  __pyx_v_next3 = 0;

  /* "src/lxml/apihelpers.pxi":1479
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = (s[0] << 8) | (s[1])
 * 
 */
  __pyx_t_2 = (__pyx_v_s < (__pyx_v_c_end - 2));
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1480
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:
 *         next3 = (s[0] << 8) | (s[1])             # <<<<<<<<<<<<<<
 * 
 *     while s < c_end - 2:
 */
    __pyx_v_next3 = (((__pyx_v_s[0]) << 8) | (__pyx_v_s[1]));

    /* "src/lxml/apihelpers.pxi":1479
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef unsigned long next3 = 0
 *     if s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = (s[0] << 8) | (s[1])
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":1482
 *         next3 = (s[0] << 8) | (s[1])
 * 
 *     while s < c_end - 2:             # <<<<<<<<<<<<<<
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_s < (__pyx_v_c_end - 2));
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1483
 * 
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 */
    __pyx_v_next3 = (0x00ffffff & ((__pyx_v_next3 << 8) | (__pyx_v_s[2])));

    /* "src/lxml/apihelpers.pxi":1484
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 */
    __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1487
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
 */
      switch (__pyx_v_next3) {
        case 0x00efbfbe:
        case 0x00efbfbf:

        /* "src/lxml/apihelpers.pxi":1488
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:
 *                 return 0             # <<<<<<<<<<<<<<
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
 *             # \ud800 and \udfff. Anything between them (inclusive)
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1487
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 *             if next3 == 0x00efbfbe or next3 == 0x00efbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # 0xeda080 and 0xedbfbf are utf-8 encodings of
 */
        break;
        default: break;
      }

      /* "src/lxml/apihelpers.pxi":1492
 *             # \ud800 and \udfff. Anything between them (inclusive)
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
 */
      __pyx_t_2 = (0x00eda080 <= __pyx_v_next3);
      if (__pyx_t_2) {
        __pyx_t_2 = (__pyx_v_next3 <= 0x00edbfbf);
      }
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1493
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0             # <<<<<<<<<<<<<<
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "src/lxml/apihelpers.pxi":1492
 *             # \ud800 and \udfff. Anything between them (inclusive)
 *             # is forbidden, because they are surrogate blocks in utf-16.
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:             # <<<<<<<<<<<<<<
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
 */
      }

      /* "src/lxml/apihelpers.pxi":1484
 *     while s < c_end - 2:
 *         next3 = 0x00ffffff & ((next3 << 8) | s[2])
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # 0xefbfbe and 0xefbfbf are utf-8 encodings of
 *             # forbidden characters \ufffe and \uffff
 */
      goto __pyx_L6;
    }

    /* "src/lxml/apihelpers.pxi":1494
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
 */
    __pyx_t_2 = (!(xmlIsChar_ch((__pyx_v_s[0])) != 0));
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1495
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char             # <<<<<<<<<<<<<<
 *         s += 1
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1494
 *             if 0x00eda080 <= next3 <= 0x00edbfbf:
 *                 return 0
 *         elif not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
 */
    }
    __pyx_L6:;

    /* "src/lxml/apihelpers.pxi":1496
 *         elif not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     while s < c_end:
 */
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1498
 *         s += 1
 * 
 *     while s < c_end:             # <<<<<<<<<<<<<<
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_s < __pyx_v_c_end);
    if (!__pyx_t_2) break;

    /* "src/lxml/apihelpers.pxi":1499
 * 
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
 */
    __pyx_t_3 = (!(((__pyx_v_s[0]) & 0x80) != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_3 = (!(xmlIsChar_ch((__pyx_v_s[0])) != 0));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_2) {

      /* "src/lxml/apihelpers.pxi":1500
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char             # <<<<<<<<<<<<<<
 *         s += 1
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1499
 * 
 *     while s < c_end:
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return 0  # invalid ascii char
 *         s += 1
 */
    }

    /* "src/lxml/apihelpers.pxi":1501
 *         if not s[0] & 0x80 and not tree.xmlIsChar_ch(s[0]):
 *             return 0  # invalid ascii char
 *         s += 1             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "src/lxml/apihelpers.pxi":1503
 *         s += 1
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1474
 *     return 1
 * 
 * cdef bint _is_valid_xml_utf8(bytes pystring) except -1:             # <<<<<<<<<<<<<<
 *     """Check if a string is like valid UTF-8 XML content."""
 *     cdef const_xmlChar* s = _xcstr(pystring)
 */

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

/* "src/lxml/apihelpers.pxi":1505
 *     return 1
 * 
 * cdef inline unicode 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;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrNone", 1);

  /* "src/lxml/apihelpers.pxi":1506
 * 
 * cdef inline unicode funicodeOrNone(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1506, __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;
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_1))) __PYX_ERR(7, 1506, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1505
 *     return 1
 * 
 * cdef inline unicode 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_3);
  __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;
}

/* "src/lxml/apihelpers.pxi":1508
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline unicode 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;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrEmpty", 1);

  /* "src/lxml/apihelpers.pxi":1509
 * 
 * cdef inline unicode funicodeOrEmpty(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else ''             # <<<<<<<<<<<<<<
 * 
 * cdef unicode funicode(const_xmlChar* s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_t_1 = __pyx_kp_u__12;
  }
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1508
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline unicode 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_3);
  __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;
}

/* "src/lxml/apihelpers.pxi":1511
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef unicode funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return s.decode('UTF-8')
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_funicode(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicode", 1);

  /* "src/lxml/apihelpers.pxi":1512
 * 
 * cdef unicode funicode(const_xmlChar* s):
 *     return s.decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _utf8(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_ssize_strlen(((char const *)__pyx_v_s)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1512, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(((char const *)__pyx_v_s), 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1511
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef unicode funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return s.decode('UTF-8')
 * 
 */

  /* 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;
}

/* "src/lxml/apihelpers.pxi":1514
 *     return s.decode('UTF-8')
 * 
 * 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_valid;
  PyObject *__pyx_v_utf8_string = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_utf8", 1);

  /* "src/lxml/apihelpers.pxi":1521
 *     cdef int valid
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_s); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1522
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')             # <<<<<<<<<<<<<<
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):
 */
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(7, 1522, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1523
 *     if isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__is_valid_xml_utf8(__pyx_v_utf8_string); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 1523, __pyx_L1_error)
    __pyx_v_valid = __pyx_t_1;

    /* "src/lxml/apihelpers.pxi":1521
 *     cdef int valid
 *     cdef bytes utf8_string
 *     if isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1524
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):             # <<<<<<<<<<<<<<
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)
 */
  __pyx_t_3 = PyBytes_Check(__pyx_v_s); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyByteArray_Check(__pyx_v_s); 
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1525
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)             # <<<<<<<<<<<<<<
 *         valid = _is_valid_xml_ascii(utf8_string)
 *     else:
 */
    __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_s)) == ((PyObject *)(&PyBytes_Type)));
    if (__pyx_t_1) {
      if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_s))) __PYX_ERR(7, 1525, __pyx_L1_error)
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_2 = __pyx_v_s;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1526
 *     elif isinstance(s, (bytes, bytearray)):
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__is_valid_xml_ascii(__pyx_v_utf8_string); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(7, 1526, __pyx_L1_error)
    __pyx_v_valid = __pyx_t_5;

    /* "src/lxml/apihelpers.pxi":1524
 *         utf8_string = (<unicode>s).encode('utf8')
 *         valid = _is_valid_xml_utf8(utf8_string)
 *     elif isinstance(s, (bytes, bytearray)):             # <<<<<<<<<<<<<<
 *         utf8_string = s if type(s) is bytes else bytes(s)
 *         valid = _is_valid_xml_ascii(utf8_string)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1528
 *         valid = _is_valid_xml_ascii(utf8_string)
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)             # <<<<<<<<<<<<<<
 *     if not valid:
 *         raise ValueError(
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_s)), __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Argument_must_be_bytes_or_unicod, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1528, __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_ERR(7, 1528, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1529
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 */
  __pyx_t_1 = (!(__pyx_v_valid != 0));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1530
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1530, __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_ERR(7, 1530, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1529
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 */
  }

  /* "src/lxml/apihelpers.pxi":1532
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf8_string);
  __pyx_r = __pyx_v_utf8_string;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1514
 *     return s.decode('UTF-8')
 * 
 * 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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/apihelpers.pxi":1535
 * 
 * 
 * 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", 1);

  /* "src/lxml/apihelpers.pxi":1536
 * 
 * cdef bytes _utf8orNone(object s):
 *     return _utf8(s) if s is not None else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1536, __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;
  }
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(7, 1536, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1535
 * 
 * 
 * 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;
}

/* "src/lxml/apihelpers.pxi":1546
 * 
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path) noexcept:             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/apihelpers.pxi":1550
 *     cdef xmlChar c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return ABS_UNIX_FILE_PATH
 * 
 */
  __pyx_t_1 = ((__pyx_v_c_path[0]) == '/');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1551
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':
 *         return ABS_UNIX_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 *     # test if it looks like an absolute Windows path or URL
 */
    __pyx_r = __pyx_e_4lxml_5etree_ABS_UNIX_FILE_PATH;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1550
 *     cdef xmlChar c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return ABS_UNIX_FILE_PATH
 * 
 */
  }

  /* "src/lxml/apihelpers.pxi":1554
 * 
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 */
  __pyx_t_2 = ('a' <= (__pyx_v_c_path[0]));
  if (__pyx_t_2) {
    __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'z');
  }
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = ('A' <= (__pyx_v_c_path[0]));
  if (__pyx_t_2) {
    __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'Z');
  }
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1555
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
 */
    __pyx_v_c_path = (__pyx_v_c_path + 1);

    /* "src/lxml/apihelpers.pxi":1556
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':             # <<<<<<<<<<<<<<
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
 * 
 */
    __pyx_t_2 = ((__pyx_v_c_path[0]) == ':');
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    switch ((__pyx_v_c_path[1])) {
      case '\x00':
      case '\\':
      __pyx_t_2 = 1;
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1557
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return ABS_WIN_FILE_PATH  # C: or C:\...             # <<<<<<<<<<<<<<
 * 
 *         # test if it looks like a URL with scheme://
 */
      __pyx_r = __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1556
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':             # <<<<<<<<<<<<<<
 *             return ABS_WIN_FILE_PATH  # C: or C:\...
 * 
 */
    }

    /* "src/lxml/apihelpers.pxi":1560
 * 
 *         # test if it looks like a URL with scheme://
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 */
    while (1) {
      __pyx_t_3 = ('a' <= (__pyx_v_c_path[0]));
      if (__pyx_t_3) {
        __pyx_t_3 = ((__pyx_v_c_path[0]) <= 'z');
      }
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_3 = ('A' <= (__pyx_v_c_path[0]));
      if (__pyx_t_3) {
        __pyx_t_3 = ((__pyx_v_c_path[0]) <= 'Z');
      }
      __pyx_t_1 = __pyx_t_3;
      __pyx_L12_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/apihelpers.pxi":1561
 *         # test if it looks like a URL with scheme://
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return NO_FILE_PATH
 */
      __pyx_v_c_path = (__pyx_v_c_path + 1);
    }

    /* "src/lxml/apihelpers.pxi":1562
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':             # <<<<<<<<<<<<<<
 *             return NO_FILE_PATH
 * 
 */
    __pyx_t_3 = ((__pyx_v_c_path[0]) == ':');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_c_path[1]) == '/');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_c_path[2]) == '/');
    __pyx_t_1 = __pyx_t_3;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1563
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return NO_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 *     # assume it's a relative path
 */
      __pyx_r = __pyx_e_4lxml_5etree_NO_FILE_PATH;
      goto __pyx_L0;

      /* "src/lxml/apihelpers.pxi":1562
 *         while c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':             # <<<<<<<<<<<<<<
 *             return NO_FILE_PATH
 * 
 */
    }

    /* "src/lxml/apihelpers.pxi":1554
 * 
 *     # test if it looks like an absolute Windows path or URL
 *     if c'a' <= c_path[0] <= c'z' or c'A' <= c_path[0] <= c'Z':             # <<<<<<<<<<<<<<
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 */
  }

  /* "src/lxml/apihelpers.pxi":1566
 * 
 *     # assume it's a relative path
 *     return REL_FILE_PATH             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_e_4lxml_5etree_REL_FILE_PATH;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1546
 * 
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path) noexcept:             # <<<<<<<<<<<<<<
 *     "simple heuristic to see if a path is a filename"
 *     cdef xmlChar c
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1569
 * 
 * 
 * cdef object _getFSPathOrObject(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Get the __fspath__ attribute of an object if it exists.
 */

static PyObject *__pyx_f_4lxml_5etree__getFSPathOrObject(PyObject *__pyx_v_obj) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getFSPathOrObject", 1);

  /* "src/lxml/apihelpers.pxi":1574
 *     Otherwise, the original object is returned.
 *     """
 *     if _isString(obj):             # <<<<<<<<<<<<<<
 *         return obj
 *     try:
 */
  __pyx_t_1 = _isString(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1575
 *     """
 *     if _isString(obj):
 *         return obj             # <<<<<<<<<<<<<<
 *     try:
 *         return python.PyOS_FSPath(obj)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_obj);
    __pyx_r = __pyx_v_obj;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1574
 *     Otherwise, the original object is returned.
 *     """
 *     if _isString(obj):             # <<<<<<<<<<<<<<
 *         return obj
 *     try:
 */
  }

  /* "src/lxml/apihelpers.pxi":1576
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":1577
 *         return obj
 *     try:
 *         return python.PyOS_FSPath(obj)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         return obj
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyOS_FSPath(__pyx_v_obj); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1577, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/apihelpers.pxi":1576
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
 */
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1578
 *     try:
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         return obj
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._getFSPathOrObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(7, 1578, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/apihelpers.pxi":1579
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
 *         return obj             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_obj);
      __pyx_r = __pyx_v_obj;
      __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;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/apihelpers.pxi":1576
 *     if _isString(obj):
 *         return obj
 *     try:             # <<<<<<<<<<<<<<
 *         return python.PyOS_FSPath(obj)
 *     except TypeError:
 */
    __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;
  }

  /* "src/lxml/apihelpers.pxi":1569
 * 
 * 
 * cdef object _getFSPathOrObject(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Get the __fspath__ attribute of an object if it exists.
 */

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

/* "src/lxml/apihelpers.pxi":1582
 * 
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     """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;
  PyObject *__pyx_t_2 = NULL;
  unsigned char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilename", 1);

  /* "src/lxml/apihelpers.pxi":1585
 *     """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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1586
 *     """
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         return filename
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1585
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
 */
  }

  /* "src/lxml/apihelpers.pxi":1587
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif isinstance(filename, unicode):
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1588
 *         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;

    /* "src/lxml/apihelpers.pxi":1587
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif isinstance(filename, unicode):
 */
  }

  /* "src/lxml/apihelpers.pxi":1589
 *     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); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1590
 *         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 '%.30s'", "encode");
      __PYX_ERR(7, 1590, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_filename8 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/apihelpers.pxi":1591
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 */
    __pyx_t_3 = __Pyx_PyObject_AsWritableUString(__pyx_v_filename8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(7, 1591, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_4lxml_5etree__isFilePath(((unsigned char *)__pyx_t_3));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1592
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/apihelpers.pxi":1593
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:
 *                 return python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:
 */
          __Pyx_XDECREF(__pyx_r);

          /* "src/lxml/apihelpers.pxi":1594
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *             except UnicodeEncodeError:
 *                 pass
 */
          __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1593, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L9_try_return;

          /* "src/lxml/apihelpers.pxi":1592
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 */
        }
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/apihelpers.pxi":1595
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         return filename8
 */
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeEncodeError);
        if (__pyx_t_7) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L6_exception_handled;
        }
        goto __pyx_L7_except_error;

        /* "src/lxml/apihelpers.pxi":1592
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 */
        __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_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);
      }

      /* "src/lxml/apihelpers.pxi":1591
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 */
    }

    /* "src/lxml/apihelpers.pxi":1597
 *             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;

    /* "src/lxml/apihelpers.pxi":1589
 *     elif isinstance(filename, bytes):
 *         return filename
 *     elif isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 */
  }

  /* "src/lxml/apihelpers.pxi":1599
 *         return filename8
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1599, __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_ERR(7, 1599, __pyx_L1_error)
  }

  /* "src/lxml/apihelpers.pxi":1582
 * 
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     """Make sure a filename is 8-bit encoded (or None).
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/apihelpers.pxi":1601
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":1604
 *     """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_ERR(7, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1601
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1606
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":1609
 *     """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);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1610
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/apihelpers.pxi":1611
 *     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);

        /* "src/lxml/apihelpers.pxi":1612
 *         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_ERR(7, 1611, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L8_try_return;

        /* "src/lxml/apihelpers.pxi":1610
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 */
      }
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/apihelpers.pxi":1613
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 *     try:
 */
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_6) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L5_exception_handled;
      }
      goto __pyx_L6_except_error;

      /* "src/lxml/apihelpers.pxi":1610
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 */
      __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);
    }

    /* "src/lxml/apihelpers.pxi":1609
 *     """Make the filename a unicode string if we are in Py3.
 *     """
 *     if _isFilePath(c_path):             # <<<<<<<<<<<<<<
 *         try:
 *             return python.PyUnicode_Decode(
 */
  }

  /* "src/lxml/apihelpers.pxi":1615
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":1616
 *             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 const *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1616, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L14_try_return;

      /* "src/lxml/apihelpers.pxi":1615
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
 */
    }
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/apihelpers.pxi":1617
 *     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 = __Pyx_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_ERR(7, 1617, __pyx_L12_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/apihelpers.pxi":1619
 *     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 const *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, ((char const *)"replace"), PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 1619, __pyx_L12_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_L13_except_return;
    }
    goto __pyx_L12_except_error;

    /* "src/lxml/apihelpers.pxi":1615
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
 */
    __pyx_L12_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_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_L13_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;
  }

  /* "src/lxml/apihelpers.pxi":1606
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1621
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     """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;
  const xmlChar *__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;
  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_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilenameUTF8", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "src/lxml/apihelpers.pxi":1626
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1627
 *     cdef char* c_filename
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1626
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
 */
  }

  /* "src/lxml/apihelpers.pxi":1628
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 *             # plain ASCII!
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1629
 *         return None
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
 */
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(7, 1629, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_AsUString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(7, 1629, __pyx_L1_error)
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(7, 1629, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1629, __pyx_L1_error)
    __pyx_t_1 = (!__pyx_f_4lxml_5etree_isutf8l(__pyx_t_2, __pyx_t_3));
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1631
 *         if not isutf8l(<bytes>filename, len(<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;

      /* "src/lxml/apihelpers.pxi":1629
 *         return None
 *     elif isinstance(filename, bytes):
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
 */
    }

    /* "src/lxml/apihelpers.pxi":1632
 *             # 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);

    /* "src/lxml/apihelpers.pxi":1633
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/apihelpers.pxi":1636
 *             # 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_ERR(7, 1636, __pyx_L5_error)
        }
        __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(7, 1636, __pyx_L5_error)

        /* "src/lxml/apihelpers.pxi":1635
 *         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_3, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 1635, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/apihelpers.pxi":1633
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 */
      }
      __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_L5_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/apihelpers.pxi":1638
 *                 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 = __Pyx_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_ERR(7, 1638, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_v_decode_exc = __pyx_t_9;
        /*try:*/ {

          /* "src/lxml/apihelpers.pxi":1639
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 */
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __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:*/ {

              /* "src/lxml/apihelpers.pxi":1641
 *             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 '%.30s'", "decode");
                __PYX_ERR(7, 1641, __pyx_L18_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_ERR(7, 1641, __pyx_L18_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

              /* "src/lxml/apihelpers.pxi":1642
 *                 # 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_L22_try_return;

              /* "src/lxml/apihelpers.pxi":1639
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 */
            }
            __pyx_L18_error:;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "src/lxml/apihelpers.pxi":1643
 *                 (<bytes>filename).decode('utf8')
 *                 return filename
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):
 */
            __pyx_t_8 = __Pyx_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_ERR(7, 1643, __pyx_L20_except_error)
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_15);
              __Pyx_XGOTREF(__pyx_t_16);

              /* "src/lxml/apihelpers.pxi":1644
 *                 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_ERR(7, 1644, __pyx_L20_except_error)
            }
            goto __pyx_L20_except_error;

            /* "src/lxml/apihelpers.pxi":1639
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 */
            __pyx_L20_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_error;
            __pyx_L22_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_L15_return;
          }
        }

        /* "src/lxml/apihelpers.pxi":1638
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:             # <<<<<<<<<<<<<<
 *             try:
 *                 # try if it's proper UTF-8
 */
        /*finally:*/ {
          __pyx_L16_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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_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_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            __pyx_t_8 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_decode_exc); __pyx_v_decode_exc = 0;
            }
            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_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_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
            __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
            goto __pyx_L7_except_error;
          }
          __pyx_L15_return: {
            __pyx_t_21 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_decode_exc); __pyx_v_decode_exc = 0;
            __pyx_r = __pyx_t_21;
            __pyx_t_21 = 0;
            goto __pyx_L8_except_return;
          }
        }
      }
      goto __pyx_L7_except_error;

      /* "src/lxml/apihelpers.pxi":1633
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 */
      __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_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_L10_try_end:;
    }

    /* "src/lxml/apihelpers.pxi":1628
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         if not isutf8l(<bytes>filename, len(<bytes>filename)):
 *             # plain ASCII!
 */
  }

  /* "src/lxml/apihelpers.pxi":1645
 *             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); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1646
 *                 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 '%.30s'", "encode");
      __PYX_ERR(7, 1646, __pyx_L1_error)
    }
    __pyx_t_10 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 1646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1645
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         return (<unicode>filename).encode('utf8')
 *     else:
 */
  }

  /* "src/lxml/apihelpers.pxi":1648
 *         return (<unicode>filename).encode('utf8')
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTag(tag):
 */
  /*else*/ {
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 1648, __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_ERR(7, 1648, __pyx_L1_error)
  }

  /* "src/lxml/apihelpers.pxi":1621
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1650
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":1654
 *     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_ERR(7, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1650
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1656
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     """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", 1);

  /* "src/lxml/apihelpers.pxi":1661
 *     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_ERR(7, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1656
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/apihelpers.pxi":1663
 *     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;
  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("__getNsTag", 0);
  __Pyx_INCREF(__pyx_v_tag);

  /* "src/lxml/apihelpers.pxi":1668
 *     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);

  /* "src/lxml/apihelpers.pxi":1670
 *     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_2 = (!_isString(__pyx_v_tag));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tag, __pyx_ptype_4lxml_5etree_QName); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1671
 *     # _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_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_tag)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1670
 *     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)
 */
  }

  /* "src/lxml/apihelpers.pxi":1672
 *     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_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/apihelpers.pxi":1673
 *         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);

  /* "src/lxml/apihelpers.pxi":1674
 *     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_1 = ((__pyx_v_c_tag[0]) == '{');
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1675
 *     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);

      /* "src/lxml/apihelpers.pxi":1676
 *     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, "Invalid tag name"
 */
    __pyx_v_c_ns_end = strchr(__pyx_v_c_tag, '}');

    /* "src/lxml/apihelpers.pxi":1677
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 */
    __pyx_t_1 = (__pyx_v_c_ns_end == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1678
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 *             raise ValueError, "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_ERR(7, 1678, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1677
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 */
    }

    /* "src/lxml/apihelpers.pxi":1679
 *         if c_ns_end is NULL:
 *             raise ValueError, "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);

    /* "src/lxml/apihelpers.pxi":1680
 *             raise ValueError, "Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2             # <<<<<<<<<<<<<<
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
 */
    __pyx_v_taglen = ((PyBytes_GET_SIZE(__pyx_v_tag) - __pyx_v_nslen) - 2);

    /* "src/lxml/apihelpers.pxi":1681
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
 */
    __pyx_t_1 = (__pyx_v_taglen == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/apihelpers.pxi":1682
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 *             raise ValueError, "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_ERR(7, 1682, __pyx_L1_error)

      /* "src/lxml/apihelpers.pxi":1681
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
 */
    }

    /* "src/lxml/apihelpers.pxi":1683
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 */
    __pyx_t_1 = (__pyx_v_nslen > 0);
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1684
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]             # <<<<<<<<<<<<<<
 *         elif empty_ns:
 *             ns = b''
 */
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_tag + 0, __pyx_v_nslen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_t_3;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1683
 *         if taglen == 0:
 *             raise ValueError, "Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 */
      goto __pyx_L9;
    }

    /* "src/lxml/apihelpers.pxi":1685
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 */
    if (__pyx_v_empty_ns) {

      /* "src/lxml/apihelpers.pxi":1686
 *             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__12);
      __Pyx_DECREF_SET(__pyx_v_ns, __pyx_kp_b__12);

      /* "src/lxml/apihelpers.pxi":1685
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 */
    }
    __pyx_L9:;

    /* "src/lxml/apihelpers.pxi":1687
 *         elif empty_ns:
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"
 */
    __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_ns_end + 1, (__pyx_v_taglen + 1) - 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/apihelpers.pxi":1674
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':             # <<<<<<<<<<<<<<
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 */
    goto __pyx_L6;
  }

  /* "src/lxml/apihelpers.pxi":1688
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, "Empty tag name"
 *     return ns, tag
 */
  __pyx_t_1 = (PyBytes_GET_SIZE(__pyx_v_tag) == 0);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1689
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"             # <<<<<<<<<<<<<<
 *     return ns, tag
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Empty_tag_name, 0, 0);
    __PYX_ERR(7, 1689, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1688
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, "Empty tag name"
 *     return ns, tag
 */
  }
  __pyx_L6:;

  /* "src/lxml/apihelpers.pxi":1690
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, "Empty tag name"
 *     return ns, tag             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns)) __PYX_ERR(7, 1690, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag)) __PYX_ERR(7, 1690, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1663
 *     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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/apihelpers.pxi":1692
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/apihelpers.pxi":1693
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__xmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__17, __pyx_v_name_utf8, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 1693, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1692
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
 */

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

/* "src/lxml/apihelpers.pxi":1695
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in 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;

  /* "src/lxml/apihelpers.pxi":1696
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 *     return _htmlNameIsValid(_xcstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:
 */
  __pyx_r = __pyx_f_4lxml_5etree__htmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1695
 *     return _xmlNameIsValid(_xcstr(name_utf8)) and b':' not in name_utf8
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1698
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNameValue(c_name)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_r;

  /* "src/lxml/apihelpers.pxi":1699
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     return tree.xmlValidateNameValue(c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 */
  __pyx_r = xmlValidateNameValue(__pyx_v_c_name);
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1698
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNameValue(c_name)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1701
 *     return tree.xmlValidateNameValue(c_name)
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1702
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  __pyx_t_2 = (__pyx_v_c_name == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '\x00');
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1703
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     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;

    /* "src/lxml/apihelpers.pxi":1702
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  }

  /* "src/lxml/apihelpers.pxi":1704
 *     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_1 = ((__pyx_v_c_name[0]) != '\x00');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1705
 *         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 '>':

      /* "src/lxml/apihelpers.pxi":1706
 *     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;

      /* "src/lxml/apihelpers.pxi":1705
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':             # <<<<<<<<<<<<<<
 *             return 0
 *         c_name += 1
 */
      break;
      default: break;
    }

    /* "src/lxml/apihelpers.pxi":1707
 *         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);
  }

  /* "src/lxml/apihelpers.pxi":1708
 *             return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1701
 *     return tree.xmlValidateNameValue(c_name)
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1710
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/apihelpers.pxi":1712
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
 *     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');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1713
 *     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);

    /* "src/lxml/apihelpers.pxi":1714
 *     if c_name[0] == c'x':
 *         c_name += 1
 *         is_hex = 1             # <<<<<<<<<<<<<<
 *     else:
 *         is_hex = 0
 */
    __pyx_v_is_hex = 1;

    /* "src/lxml/apihelpers.pxi":1712
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:
 *     cdef bint is_hex
 *     if c_name[0] == c'x':             # <<<<<<<<<<<<<<
 *         c_name += 1
 *         is_hex = 1
 */
    goto __pyx_L3;
  }

  /* "src/lxml/apihelpers.pxi":1716
 *         is_hex = 1
 *     else:
 *         is_hex = 0             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'\0':
 *         return 0
 */
  /*else*/ {
    __pyx_v_is_hex = 0;
  }
  __pyx_L3:;

  /* "src/lxml/apihelpers.pxi":1717
 *     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');
  if (__pyx_t_1) {

    /* "src/lxml/apihelpers.pxi":1718
 *         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;

    /* "src/lxml/apihelpers.pxi":1717
 *     else:
 *         is_hex = 0
 *     if c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  }

  /* "src/lxml/apihelpers.pxi":1719
 *     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');
    if (!__pyx_t_1) break;

    /* "src/lxml/apihelpers.pxi":1720
 *         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_2 = ((__pyx_v_c_name[0]) < '0');
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c_name[0]) > '9');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/apihelpers.pxi":1721
 *     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_1 = (!__pyx_v_is_hex);
      if (__pyx_t_1) {

        /* "src/lxml/apihelpers.pxi":1722
 *         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;

        /* "src/lxml/apihelpers.pxi":1721
 *     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'):
 */
      }

      /* "src/lxml/apihelpers.pxi":1723
 *             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_1 = ('a' <= (__pyx_v_c_name[0]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_c_name[0]) <= 'f');
      }
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {

        /* "src/lxml/apihelpers.pxi":1724
 *                 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_2 = ('A' <= (__pyx_v_c_name[0]));
        if (__pyx_t_2) {
          __pyx_t_2 = ((__pyx_v_c_name[0]) <= 'F');
        }
        __pyx_t_1 = (!__pyx_t_2);
        if (__pyx_t_1) {

          /* "src/lxml/apihelpers.pxi":1725
 *             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;

          /* "src/lxml/apihelpers.pxi":1724
 *                 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
 */
        }

        /* "src/lxml/apihelpers.pxi":1723
 *             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
 */
      }

      /* "src/lxml/apihelpers.pxi":1720
 *         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
 */
    }

    /* "src/lxml/apihelpers.pxi":1726
 *                 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);
  }

  /* "src/lxml/apihelpers.pxi":1727
 *                     return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1710
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1729
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 */

static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  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("_tagValidOrRaise", 1);

  /* "src/lxml/apihelpers.pxi":1730
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(7, 1730, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1731
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(7, 1731, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_tag_name_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1731, __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_ERR(7, 1731, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1730
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":1732
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1729
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid tag name {(<bytes>tag_utf).decode('utf8')!r}")
 */

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

/* "src/lxml/apihelpers.pxi":1734
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 */

static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  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("_htmlTagValidOrRaise", 1);

  /* "src/lxml/apihelpers.pxi":1735
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyHtmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(7, 1735, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1736
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(7, 1736, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_HTML_tag_name, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1736, __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_ERR(7, 1736, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1735
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":1737
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1734
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid HTML tag name {(<bytes>tag_utf).decode('utf8')!r}")
 */

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

/* "src/lxml/apihelpers.pxi":1739
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 */

static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *__pyx_v_name_utf) {
  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("_attributeValidOrRaise", 1);

  /* "src/lxml/apihelpers.pxi":1740
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(7, 1740, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1741
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_name_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(7, 1741, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_name_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_attribute_name, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1741, __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_ERR(7, 1741, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1740
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":1742
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1739
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(f"Invalid attribute name {(<bytes>name_utf).decode('utf8')!r}")
 */

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

/* "src/lxml/apihelpers.pxi":1744
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 */

static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *__pyx_v_tag_utf) {
  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("_prefixValidOrRaise", 1);

  /* "src/lxml/apihelpers.pxi":1745
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(7, 1745, __pyx_L1_error)
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/apihelpers.pxi":1746
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(7, 1746, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_namespace_prefix, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1746, __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_ERR(7, 1746, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1745
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0
 */
  }

  /* "src/lxml/apihelpers.pxi":1747
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1744
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(f"Invalid namespace prefix {(<bytes>tag_utf).decode('utf8')!r}")
 */

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

/* "src/lxml/apihelpers.pxi":1749
 *     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", 1);

  /* "src/lxml/apihelpers.pxi":1750
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 */
  __pyx_v_c_uri = xmlParseURI(PyBytes_AS_STRING(__pyx_v_uri_utf));

  /* "src/lxml/apihelpers.pxi":1751
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
 */
  __pyx_t_1 = (__pyx_v_c_uri == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/apihelpers.pxi":1752
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")             # <<<<<<<<<<<<<<
 *     uri.xmlFreeURI(c_uri)
 *     return 0
 */
    if (unlikely(__pyx_v_uri_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(7, 1752, __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_ERR(7, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_namespace_URI, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 1752, __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_ERR(7, 1752, __pyx_L1_error)

    /* "src/lxml/apihelpers.pxi":1751
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
 */
  }

  /* "src/lxml/apihelpers.pxi":1753
 *     if c_uri is NULL:
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlFreeURI(__pyx_v_c_uri);

  /* "src/lxml/apihelpers.pxi":1754
 *         raise ValueError(f"Invalid namespace URI {(<bytes>uri_utf).decode('utf8')!r}")
 *     uri.xmlFreeURI(c_uri)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1749
 *     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;
}

/* "src/lxml/apihelpers.pxi":1756
 *     return 0
 * 
 * cdef inline unicode _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", 1);

  /* "src/lxml/apihelpers.pxi":1757
 * 
 * cdef inline unicode _namespacedName(xmlNode* c_node):
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.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_ERR(7, 1757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1756
 *     return 0
 * 
 * cdef inline unicode _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;
}

/* "src/lxml/apihelpers.pxi":1760
 * 
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     name = funicode(c_name)
 *     if c_href is NULL:
 */

static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_namespacedNameFromNsName", 1);

  /* "src/lxml/apihelpers.pxi":1761
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)             # <<<<<<<<<<<<<<
 *     if c_href is NULL:
 *         return name
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1762
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)
 *     if c_href is NULL:             # <<<<<<<<<<<<<<
 *         return name
 *     href = funicode(c_href)
 */
  __pyx_t_2 = (__pyx_v_c_href == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/apihelpers.pxi":1763
 *     name = funicode(c_name)
 *     if c_href is NULL:
 *         return name             # <<<<<<<<<<<<<<
 *     href = funicode(c_href)
 *     return f"{{{href}}}{name}"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_name);
    __pyx_r = __pyx_v_name;
    goto __pyx_L0;

    /* "src/lxml/apihelpers.pxi":1762
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):
 *     name = funicode(c_name)
 *     if c_href is NULL:             # <<<<<<<<<<<<<<
 *         return name
 *     href = funicode(c_href)
 */
  }

  /* "src/lxml/apihelpers.pxi":1764
 *     if c_href is NULL:
 *         return name
 *     href = funicode(c_href)             # <<<<<<<<<<<<<<
 *     return f"{{{href}}}{name}"
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_href = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/apihelpers.pxi":1765
 *         return name
 *     href = funicode(c_href)
 *     return f"{{{href}}}{name}"             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_4 = 127;
  __Pyx_INCREF(__pyx_kp_u__18);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__18);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__18);
  __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_href); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__19);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__19);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__19);
  __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1760
 * 
 * 
 * cdef unicode _namespacedNameFromNsName(const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     name = funicode(c_name)
 *     if c_href is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._namespacedNameFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/apihelpers.pxi":1768
 * 
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     """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;
  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("_getFilenameForFile", 1);

  /* "src/lxml/apihelpers.pxi":1774
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":1775
 *     # urllib2 provides a geturl() method
 *     try:
 *         return source.geturl()             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_geturl); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 1775, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1775, __pyx_L3_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_L7_try_return;

      /* "src/lxml/apihelpers.pxi":1774
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
 */
    }
    __pyx_L3_error:;
    __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;

    /* "src/lxml/apihelpers.pxi":1776
 *     try:
 *         return source.geturl()
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # file instances have a name attribute
 */
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1774
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
 */
    __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);
  }

  /* "src/lxml/apihelpers.pxi":1779
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":1780
 *     # file instances have a name attribute
 *     try:
 *         filename = source.name             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1780, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_filename = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1781
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_8 = _isString(__pyx_v_filename);
      if (__pyx_t_8) {

        /* "src/lxml/apihelpers.pxi":1782
 *         filename = source.name
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_4lxml_5etree_os_path_abspath);
        __pyx_t_5 = __pyx_v_4lxml_5etree_os_path_abspath; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_filename};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1782, __pyx_L9_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_L13_try_return;

        /* "src/lxml/apihelpers.pxi":1781
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      }

      /* "src/lxml/apihelpers.pxi":1779
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
 */
    }
    __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_L14_try_end;
    __pyx_L9_error:;
    __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;

    /* "src/lxml/apihelpers.pxi":1783
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 */
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L10_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1779
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
 */
    __pyx_L13_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_L10_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_L14_try_end:;
  }

  /* "src/lxml/apihelpers.pxi":1786
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/apihelpers.pxi":1787
 *     # 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_ERR(7, 1787, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/apihelpers.pxi":1788
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_8 = _isString(__pyx_v_filename);
      if (__pyx_t_8) {

        /* "src/lxml/apihelpers.pxi":1789
 *         filename = source.filename
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_4lxml_5etree_os_path_abspath);
        __pyx_t_5 = __pyx_v_4lxml_5etree_os_path_abspath; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_filename};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 1789, __pyx_L16_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_L20_try_return;

        /* "src/lxml/apihelpers.pxi":1788
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      }

      /* "src/lxml/apihelpers.pxi":1786
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
 */
    }
    __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_L21_try_end;
    __pyx_L16_error:;
    __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;

    /* "src/lxml/apihelpers.pxi":1790
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # can't determine filename
 */
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L17_exception_handled;
    }

    /* "src/lxml/apihelpers.pxi":1786
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
 */
    __pyx_L20_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_L17_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_L21_try_end:;
  }

  /* "src/lxml/apihelpers.pxi":1793
 *         pass
 *     # can't determine filename
 *     return None             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/apihelpers.pxi":1768
 * 
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__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 = {"clear_error_log", (PyCFunction)__pyx_pw_4lxml_5etree_3clear_error_log, METH_NOARGS, __pyx_doc_4lxml_5etree_2clear_error_log};
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_error_log (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_error_log", 1);

  /* "src/lxml/xmlerror.pxi":21
 *     current thread.
 *     """
 *     _getThreadErrorLog(GLOBAL_ERROR_LOG).clear()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __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;

  /* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging() noexcept:             # <<<<<<<<<<<<<<
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)
 */

static void __pyx_f_4lxml_5etree__initThreadLogging(void) {

  /* "src/lxml/xmlerror.pxi":28
 * cdef void _initThreadLogging() noexcept:
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 * 
 *     # Divert XSLT error messages to the global XSLT error log instead of stderr.
 */
  __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

  /* "src/lxml/xmlerror.pxi":31
 * 
 *     # Divert XSLT error messages to the global XSLT error log instead of stderr.
 *     xslt.xsltSetGenericErrorFunc(NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xsltSetGenericErrorFunc(NULL, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging() noexcept:             # <<<<<<<<<<<<<<
 *     # Disable generic error lines from libxml2.
 *     _connectGenericErrorLog(None)
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_path
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "src/lxml/xmlerror.pxi":64
 * 
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_filename)
 *         tree.xmlFree(self._c_path)
 */
  xmlFree(__pyx_v_self->_c_message);

  /* "src/lxml/xmlerror.pxi":65
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_path)
 * 
 */
  xmlFree(__pyx_v_self->_c_filename);

  /* "src/lxml/xmlerror.pxi":66
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
 *         tree.xmlFree(self._c_path)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  xmlFree(__pyx_v_self->_c_path);

  /* "src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_path
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":69
 * 
 *     @cython.final
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:             # <<<<<<<<<<<<<<
 *         self.domain   = error.domain
 *         self.type     = error.code
 */

static int __pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError const *__pyx_v_error) {
  long __pyx_v_c_line;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __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("_setError", 1);

  /* "src/lxml/xmlerror.pxi":70
 *     @cython.final
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         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;

  /* "src/lxml/xmlerror.pxi":71
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:
 *         self.domain   = error.domain
 *         self.type     = error.code             # <<<<<<<<<<<<<<
 *         self.level    = <int>error.level
 *         self.line     = <long>error.line
 */
  __pyx_t_1 = __pyx_v_error->code;
  __pyx_v_self->type = __pyx_t_1;

  /* "src/lxml/xmlerror.pxi":72
 *         self.domain   = error.domain
 *         self.type     = error.code
 *         self.level    = <int>error.level             # <<<<<<<<<<<<<<
 *         self.line     = <long>error.line
 *         self.column   = error.int2
 */
  __pyx_v_self->level = ((int)__pyx_v_error->level);

  /* "src/lxml/xmlerror.pxi":73
 *         self.type     = error.code
 *         self.level    = <int>error.level
 *         self.line     = <long>error.line             # <<<<<<<<<<<<<<
 *         self.column   = error.int2
 *         self._c_message = NULL
 */
  __pyx_v_self->line = ((long)__pyx_v_error->line);

  /* "src/lxml/xmlerror.pxi":74
 *         self.level    = <int>error.level
 *         self.line     = <long>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;

  /* "src/lxml/xmlerror.pxi":75
 *         self.line     = <long>error.line
 *         self.column   = error.int2
 *         self._c_message = NULL             # <<<<<<<<<<<<<<
 *         self._c_filename = NULL
 *         self._c_path = NULL
 */
  __pyx_v_self->_c_message = NULL;

  /* "src/lxml/xmlerror.pxi":76
 *         self.column   = error.int2
 *         self._c_message = NULL
 *         self._c_filename = NULL             # <<<<<<<<<<<<<<
 *         self._c_path = NULL
 *         if (error.message is NULL or
 */
  __pyx_v_self->_c_filename = NULL;

  /* "src/lxml/xmlerror.pxi":77
 *         self._c_message = NULL
 *         self._c_filename = NULL
 *         self._c_path = NULL             # <<<<<<<<<<<<<<
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or
 */
  __pyx_v_self->_c_path = NULL;

  /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 */
  __pyx_t_3 = (__pyx_v_error->message == NULL);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xmlerror.pxi":79
 *         self._c_path = NULL
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 *             self._message = "unknown error"
 */
  __pyx_t_3 = ((__pyx_v_error->message[0]) == '\x00');
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xmlerror.pxi":80
 *         if (error.message is NULL or
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):             # <<<<<<<<<<<<<<
 *             self._message = "unknown error"
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_error->message[0]) == '\n');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_error->message[1]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 */
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":81
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 *             self._message = "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 = ((PyObject*)__pyx_kp_u_unknown_error);

    /* "src/lxml/xmlerror.pxi":78
 *         self._c_filename = NULL
 *         self._c_path = NULL
 *         if (error.message is NULL or             # <<<<<<<<<<<<<<
 *                 error.message[0] == b'\0' or
 *                 error.message[0] == b'\n' and error.message[1] == b'\0'):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":83
 *             self._message = "unknown error"
 *         else:
 *             self._message = None             # <<<<<<<<<<<<<<
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_message);
    __Pyx_DECREF(__pyx_v_self->_message);
    __pyx_v_self->_message = ((PyObject*)Py_None);

    /* "src/lxml/xmlerror.pxi":84
 *         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)));

    /* "src/lxml/xmlerror.pxi":86
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.file is NULL:
 */
    __pyx_t_2 = (!(__pyx_v_self->_c_message != 0));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/xmlerror.pxi":87
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if error.file is NULL:
 *             self._filename = '<string>'
 */
      PyErr_NoMemory(); __PYX_ERR(1, 87, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":86
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.file is NULL:
 */
    }
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":88
 *             if not self._c_message:
 *                 raise MemoryError()
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self._filename = '<string>'
 *         else:
 */
  __pyx_t_2 = (__pyx_v_error->file == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":89
 *                 raise MemoryError()
 *         if error.file is NULL:
 *             self._filename = '<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 = ((PyObject*)__pyx_kp_u_string);

    /* "src/lxml/xmlerror.pxi":88
 *             if not self._c_message:
 *                 raise MemoryError()
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self._filename = '<string>'
 *         else:
 */
    goto __pyx_L9;
  }

  /* "src/lxml/xmlerror.pxi":91
 *             self._filename = '<string>'
 *         else:
 *             self._filename = None             # <<<<<<<<<<<<<<
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = ((PyObject*)Py_None);

    /* "src/lxml/xmlerror.pxi":92
 *         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));

    /* "src/lxml/xmlerror.pxi":93
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.node is not NULL:
 */
    __pyx_t_2 = (!(__pyx_v_self->_c_filename != 0));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/xmlerror.pxi":94
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 */
      PyErr_NoMemory(); __PYX_ERR(1, 94, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":93
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.node is not NULL:
 */
    }
  }
  __pyx_L9:;

  /* "src/lxml/xmlerror.pxi":95
 *             if not self._c_filename:
 *                 raise MemoryError()
 *         if error.node is not NULL:             # <<<<<<<<<<<<<<
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 */
  __pyx_t_2 = (__pyx_v_error->node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":96
 *                 raise MemoryError()
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)             # <<<<<<<<<<<<<<
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:
 */
    __pyx_v_self->_c_path = xmlGetNodePath(((xmlNode *)__pyx_v_error->node));

    /* "src/lxml/xmlerror.pxi":97
 *         if error.node is not NULL:
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)             # <<<<<<<<<<<<<<
 *             if c_line > limits.INT_MAX:
 *                 self.line = c_line
 */
    __pyx_v_c_line = xmlGetLineNo(((xmlNode *)__pyx_v_error->node));

    /* "src/lxml/xmlerror.pxi":98
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 self.line = c_line
 * 
 */
    __pyx_t_2 = (__pyx_v_c_line > INT_MAX);
    if (__pyx_t_2) {

      /* "src/lxml/xmlerror.pxi":99
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:
 *                 self.line = c_line             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
      __pyx_v_self->line = __pyx_v_c_line;

      /* "src/lxml/xmlerror.pxi":98
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 *             if c_line > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                 self.line = c_line
 * 
 */
    }

    /* "src/lxml/xmlerror.pxi":95
 *             if not self._c_filename:
 *                 raise MemoryError()
 *         if error.node is not NULL:             # <<<<<<<<<<<<<<
 *             self._c_path = tree.xmlGetNodePath(<xmlNode*> error.node)
 *             c_line = tree.xmlGetLineNo(<xmlNode*> error.node)
 */
  }

  /* "src/lxml/xmlerror.pxi":69
 * 
 *     @cython.final
 *     cdef int _setError(self, const xmlerror.xmlError* error) except -1:             # <<<<<<<<<<<<<<
 *         self.domain   = error.domain
 *         self.type     = error.code
 */

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

/* "src/lxml/xmlerror.pxi":102
 * 
 *     @cython.final
 *     cdef _setGeneric(self, int domain, int type, int level, long 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, long __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("_setGeneric", 1);

  /* "src/lxml/xmlerror.pxi":104
 *     cdef _setGeneric(self, int domain, int type, int level, long line,
 *                      message, filename):
 *         self.domain  = domain             # <<<<<<<<<<<<<<
 *         self.type    = type
 *         self.level   = level
 */
  __pyx_v_self->domain = __pyx_v_domain;

  /* "src/lxml/xmlerror.pxi":105
 *                      message, filename):
 *         self.domain  = domain
 *         self.type    = type             # <<<<<<<<<<<<<<
 *         self.level   = level
 *         self.line    = line
 */
  __pyx_v_self->type = __pyx_v_type;

  /* "src/lxml/xmlerror.pxi":106
 *         self.domain  = domain
 *         self.type    = type
 *         self.level   = level             # <<<<<<<<<<<<<<
 *         self.line    = line
 *         self.column  = 0
 */
  __pyx_v_self->level = __pyx_v_level;

  /* "src/lxml/xmlerror.pxi":107
 *         self.type    = type
 *         self.level   = level
 *         self.line    = line             # <<<<<<<<<<<<<<
 *         self.column  = 0
 *         self._message = message
 */
  __pyx_v_self->line = __pyx_v_line;

  /* "src/lxml/xmlerror.pxi":108
 *         self.level   = level
 *         self.line    = line
 *         self.column  = 0             # <<<<<<<<<<<<<<
 *         self._message = message
 *         self._filename = filename
 */
  __pyx_v_self->column = 0;

  /* "src/lxml/xmlerror.pxi":109
 *         self.line    = line
 *         self.column  = 0
 *         self._message = message             # <<<<<<<<<<<<<<
 *         self._filename = filename
 *         self._c_path = NULL
 */
  if (!(likely(__Pyx_PyBaseString_CheckExact(__pyx_v_message))||((__pyx_v_message) == Py_None) || __Pyx_RaiseUnexpectedTypeError((PY_MAJOR_VERSION < 3 ? "basestring" : "str"), __pyx_v_message))) __PYX_ERR(1, 109, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_message;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_message);
  __Pyx_DECREF(__pyx_v_self->_message);
  __pyx_v_self->_message = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":110
 *         self.column  = 0
 *         self._message = message
 *         self._filename = filename             # <<<<<<<<<<<<<<
 *         self._c_path = NULL
 * 
 */
  if (!(likely(__Pyx_PyBaseString_CheckExact(__pyx_v_filename))||((__pyx_v_filename) == Py_None) || __Pyx_RaiseUnexpectedTypeError((PY_MAJOR_VERSION < 3 ? "basestring" : "str"), __pyx_v_filename))) __PYX_ERR(1, 110, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_1);
  __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;

  /* "src/lxml/xmlerror.pxi":111
 *         self._message = message
 *         self._filename = filename
 *         self._c_path = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_v_self->_c_path = NULL;

  /* "src/lxml/xmlerror.pxi":102
 * 
 *     @cython.final
 *     cdef _setGeneric(self, int domain, int type, int level, long line,             # <<<<<<<<<<<<<<
 *                      message, filename):
 *         self.domain  = domain
 */

  /* 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._LogEntry._setGeneric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":113
 *         self._c_path = NULL
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "%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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "src/lxml/xmlerror.pxi":114
 * 
 *     def __repr__(self):
 *         return "%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);
  __pyx_t_1 = PyTuple_New(13); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;

  /* "src/lxml/xmlerror.pxi":115
 *     def __repr__(self):
 *         return "%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_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__17);
  __pyx_t_5 = __Pyx_PyUnicode_From_long(__pyx_v_self->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__17);
  __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_self->column, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_kp_u__17);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_level_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_kp_u__17);

  /* "src/lxml/xmlerror.pxi":116
 *         return "%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
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_domain_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_kp_u__17);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__20);
  __pyx_t_2 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__20);
  PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_kp_u__20);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":114
 * 
 *     def __repr__(self):
 *         return "%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_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 13, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":113
 *         self._c_path = NULL
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "%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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/xmlerror.pxi":118
 *             self.domain_name, self.type_name, self.message)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def domain_name(self):
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/xmlerror.pxi":122
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 *         """
 *         return ErrorDomains._getName(self.domain, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 122, __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_ERR(1, 122, __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_self->domain); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_u_unknown};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 122, __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;

  /* "src/lxml/xmlerror.pxi":118
 *             self.domain_name, self.type_name, self.message)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def domain_name(self):
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 */

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

/* "src/lxml/xmlerror.pxi":124
 *         return ErrorDomains._getName(self.domain, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type_name(self):
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/xmlerror.pxi":128
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         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_ERR(1, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 128, __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_ERR(1, 128, __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_ERR(1, 128, __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_ERR(1, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "src/lxml/xmlerror.pxi":129
 *         """
 *         if self.domain == ErrorDomains.RELAXNGV:
 *             getName = RelaxNGErrorTypes._getName             # <<<<<<<<<<<<<<
 *         else:
 *             getName = ErrorTypes._getName
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RelaxNGErrorTypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 129, __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_ERR(1, 129, __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;

    /* "src/lxml/xmlerror.pxi":128
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         if self.domain == ErrorDomains.RELAXNGV:             # <<<<<<<<<<<<<<
 *             getName = RelaxNGErrorTypes._getName
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":131
 *             getName = RelaxNGErrorTypes._getName
 *         else:
 *             getName = ErrorTypes._getName             # <<<<<<<<<<<<<<
 *         return getName(self.type, "unknown")
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 131, __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_ERR(1, 131, __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:;

  /* "src/lxml/xmlerror.pxi":132
 *         else:
 *             getName = ErrorTypes._getName
 *         return getName(self.type, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_getName);
  __pyx_t_1 = __pyx_v_getName; __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_3, __pyx_n_u_unknown};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __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;

  /* "src/lxml/xmlerror.pxi":124
 *         return ErrorDomains._getName(self.domain, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type_name(self):
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("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;
}

/* "src/lxml/xmlerror.pxi":134
 *         return getName(self.type, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def level_name(self):
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/xmlerror.pxi":138
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 *         """
 *         return ErrorLevels._getName(self.level, "unknown")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 138, __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_ERR(1, 138, __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_self->level); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_u_unknown};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 138, __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;

  /* "src/lxml/xmlerror.pxi":134
 *         return getName(self.type, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def level_name(self):
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 */

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

/* "src/lxml/xmlerror.pxi":140
 *         return ErrorLevels._getName(self.level, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def message(self):
 *         """The log message string.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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;
  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("__get__", 1);

  /* "src/lxml/xmlerror.pxi":145
 *         """
 *         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 != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":146
 *         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;

    /* "src/lxml/xmlerror.pxi":145
 *         """
 *         cdef size_t size
 *         if self._message is not None:             # <<<<<<<<<<<<<<
 *             return self._message
 *         if self._c_message is NULL:
 */
  }

  /* "src/lxml/xmlerror.pxi":147
 *         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_1 = (__pyx_v_self->_c_message == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":148
 *             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] == b'\n':
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":147
 *         if self._message is not None:
 *             return self._message
 *         if self._c_message is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         size = cstring_h.strlen(self._c_message)
 */
  }

  /* "src/lxml/xmlerror.pxi":149
 *         if self._c_message is NULL:
 *             return None
 *         size = cstring_h.strlen(self._c_message)             # <<<<<<<<<<<<<<
 *         if size > 0 and self._c_message[size-1] == b'\n':
 *             size -= 1  # strip EOL
 */
  __pyx_v_size = strlen(__pyx_v_self->_c_message);

  /* "src/lxml/xmlerror.pxi":150
 *             return None
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':             # <<<<<<<<<<<<<<
 *             size -= 1  # strip EOL
 *         # cannot use funicode() here because the message may contain
 */
  __pyx_t_2 = (__pyx_v_size > 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->_c_message[(__pyx_v_size - 1)]) == '\n');
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":151
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\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);

    /* "src/lxml/xmlerror.pxi":150
 *             return None
 *         size = cstring_h.strlen(self._c_message)
 *         if size > 0 and self._c_message[size-1] == b'\n':             # <<<<<<<<<<<<<<
 *             size -= 1  # strip EOL
 *         # cannot use funicode() here because the message may contain
 */
  }

  /* "src/lxml/xmlerror.pxi":154
 *         # 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_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/xmlerror.pxi":155
 *         # byte encoded file paths etc.
 *         try:
 *             self._message = self._c_message[:size].decode('utf8')             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             try:
 */
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 155, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(__Pyx_PyBaseString_CheckExact(__pyx_t_6)) || __Pyx_RaiseUnexpectedTypeError((PY_MAJOR_VERSION < 3 ? "basestring" : "str"), __pyx_t_6))) __PYX_ERR(1, 155, __pyx_L8_error)
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_v_self->_message);
      __Pyx_DECREF(__pyx_v_self->_message);
      __pyx_v_self->_message = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/xmlerror.pxi":154
 *         # 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_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_L8_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/xmlerror.pxi":156
 *         try:
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             try:
 *                 self._message = self._c_message[:size].decode(
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(1, 156, __pyx_L10_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/xmlerror.pxi":158
 *         except UnicodeDecodeError:
 *             try:
 *                 self._message = self._c_message[:size].decode(             # <<<<<<<<<<<<<<
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:
 */
          __pyx_t_13 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, ((char const *)"backslashreplace"), PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 158, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (!(likely(__Pyx_PyBaseString_CheckExact(__pyx_t_13)) || __Pyx_RaiseUnexpectedTypeError((PY_MAJOR_VERSION < 3 ? "basestring" : "str"), __pyx_t_13))) __PYX_ERR(1, 158, __pyx_L16_error)
          __Pyx_GIVEREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_v_self->_message);
          __Pyx_DECREF(__pyx_v_self->_message);
          __pyx_v_self->_message = ((PyObject*)__pyx_t_13);
          __pyx_t_13 = 0;

          /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
 */
        }
        __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_L23_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;

        /* "src/lxml/xmlerror.pxi":160
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:
 */
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_7) {
          __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 160, __pyx_L18_except_error)
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);

          /* "src/lxml/xmlerror.pxi":161
 *                     'ascii', 'backslashreplace')
 *             except UnicodeDecodeError:
 *                 self._message = '<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 = ((PyObject*)__pyx_kp_u_undecodable_error_message);
          __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_L17_exception_handled;
        }
        goto __pyx_L18_except_error;

        /* "src/lxml/xmlerror.pxi":157
 *             self._message = self._c_message[:size].decode('utf8')
 *         except UnicodeDecodeError:
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode(
 *                     'ascii', 'backslashreplace')
 */
        __pyx_L18_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_L10_except_error;
        __pyx_L17_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_L23_try_end:;
      }
      __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;
      goto __pyx_L9_exception_handled;
    }
    goto __pyx_L10_except_error;

    /* "src/lxml/xmlerror.pxi":154
 *         # 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_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_L1_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_L13_try_end:;
  }

  /* "src/lxml/xmlerror.pxi":162
 *             except UnicodeDecodeError:
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:             # <<<<<<<<<<<<<<
 *             # clean up early
 *             tree.xmlFree(self._c_message)
 */
  __pyx_t_1 = (__pyx_v_self->_c_message != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":164
 *         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);

    /* "src/lxml/xmlerror.pxi":165
 *             # clean up early
 *             tree.xmlFree(self._c_message)
 *             self._c_message = NULL             # <<<<<<<<<<<<<<
 *         return self._message
 * 
 */
    __pyx_v_self->_c_message = NULL;

    /* "src/lxml/xmlerror.pxi":162
 *             except UnicodeDecodeError:
 *                 self._message = '<undecodable error message>'
 *         if self._c_message:             # <<<<<<<<<<<<<<
 *             # clean up early
 *             tree.xmlFree(self._c_message)
 */
  }

  /* "src/lxml/xmlerror.pxi":166
 *             tree.xmlFree(self._c_message)
 *             self._c_message = NULL
 *         return self._message             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_message);
  __pyx_r = __pyx_v_self->_message;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":140
 *         return ErrorLevels._getName(self.level, "unknown")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def message(self):
 *         """The log message string.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __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_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;
}

/* "src/lxml/xmlerror.pxi":168
 *         return self._message
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filename(self):
 *         """The file path where the report originated, if any.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/xmlerror.pxi":172
 *         """The file path where the report originated, if any.
 *         """
 *         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 == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":173
 *         """
 *         if self._filename is None:
 *             if self._c_filename is not NULL:             # <<<<<<<<<<<<<<
 *                 self._filename = _decodeFilename(self._c_filename)
 *                 # clean up early
 */
    __pyx_t_1 = (__pyx_v_self->_c_filename != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":174
 *         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_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_c_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(__Pyx_PyBaseString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError((PY_MAJOR_VERSION < 3 ? "basestring" : "str"), __pyx_t_2))) __PYX_ERR(1, 174, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->_filename);
      __Pyx_DECREF(__pyx_v_self->_filename);
      __pyx_v_self->_filename = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":176
 *                 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);

      /* "src/lxml/xmlerror.pxi":177
 *                 # clean up early
 *                 tree.xmlFree(self._c_filename)
 *                 self._c_filename = NULL             # <<<<<<<<<<<<<<
 *         return self._filename
 * 
 */
      __pyx_v_self->_c_filename = NULL;

      /* "src/lxml/xmlerror.pxi":173
 *         """
 *         if self._filename is None:
 *             if self._c_filename is not NULL:             # <<<<<<<<<<<<<<
 *                 self._filename = _decodeFilename(self._c_filename)
 *                 # clean up early
 */
    }

    /* "src/lxml/xmlerror.pxi":172
 *         """The file path where the report originated, if any.
 *         """
 *         if self._filename is None:             # <<<<<<<<<<<<<<
 *             if self._c_filename is not NULL:
 *                 self._filename = _decodeFilename(self._c_filename)
 */
  }

  /* "src/lxml/xmlerror.pxi":178
 *                 tree.xmlFree(self._c_filename)
 *                 self._c_filename = NULL
 *         return self._filename             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":168
 *         return self._message
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filename(self):
 *         """The file path where the report originated, if any.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/xmlerror.pxi":180
 *         return self._filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The XPath for the node where the error was detected.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4path_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4path___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_4path___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__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("__get__", 1);

  /* "src/lxml/xmlerror.pxi":184
 *         """The XPath for the node where the error was detected.
 *         """
 *         return funicode(self._c_path) if self._c_path is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_self->_c_path != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 184, __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 = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":180
 *         return self._filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The XPath for the node where the error was detected.
 */

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

/* "src/lxml/xmlerror.pxi":52
 *     - path: the location in which the error was found (if available)
 *     """
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __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;
}

/* "src/lxml/xmlerror.pxi":53
 *     """
 *     cdef readonly int domain
 *     cdef readonly int type             # <<<<<<<<<<<<<<
 *     cdef readonly int level
 *     cdef readonly long 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __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;
}

/* "src/lxml/xmlerror.pxi":54
 *     cdef readonly int domain
 *     cdef readonly int type
 *     cdef readonly int level             # <<<<<<<<<<<<<<
 *     cdef readonly long 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->level); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __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;
}

/* "src/lxml/xmlerror.pxi":55
 *     cdef readonly int type
 *     cdef readonly int level
 *     cdef readonly long line             # <<<<<<<<<<<<<<
 *     cdef readonly int column
 *     cdef basestring _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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->line); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 55, __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;
}

/* "src/lxml/xmlerror.pxi":56
 *     cdef readonly int level
 *     cdef readonly long line
 *     cdef readonly int column             # <<<<<<<<<<<<<<
 *     cdef basestring _message
 *     cdef basestring _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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->column); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __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;
}

/* "src/lxml/xmlerror.pxi":190
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_first_error,&__pyx_n_s_last_error,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_first_error)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 190, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_last_error)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 190, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 190, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 190, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
    }
    __pyx_v_first_error = values[0];
    __pyx_v_last_error = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 190, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":191
 *     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_ERR(1, 191, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_first_error;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/xmlerror.pxi":192
 *     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;

  /* "src/lxml/xmlerror.pxi":190
 *     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;
}

/* "src/lxml/xmlerror.pxi":194
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("copy", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 194, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":195
 * 
 *     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_ERR(1, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_first_error);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_first_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_first_error))) __PYX_ERR(1, 195, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->last_error);
  __Pyx_GIVEREF(__pyx_v_self->last_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->last_error)) __PYX_ERR(1, 195, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __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;

  /* "src/lxml/xmlerror.pxi":194
 *         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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13_BaseErrorLog_3copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 194, __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;
}

/* "src/lxml/xmlerror.pxi":197
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return ''
 * 
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":198
 * 
 *     def __repr__(self):
 *         return ''             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_u__12);
  __pyx_r = __pyx_kp_u__12;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":197
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return ''
 * 
 */

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

/* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":201
 * 
 *     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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13_BaseErrorLog_7receive = {"receive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entry,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 200, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "receive") < 0)) __PYX_ERR(1, 200, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 200, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 200, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __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;
}

/* "src/lxml/xmlerror.pxi":204
 * 
 *     @cython.final
 *     cdef int _receive(self, const xmlerror.xmlError* error) except -1:             # <<<<<<<<<<<<<<
 *         cdef bint is_error
 *         cdef _LogEntry entry
 */

static int __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError const *__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;
  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("_receive", 1);

  /* "src/lxml/xmlerror.pxi":208
 *         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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)__pyx_ptype_4lxml_5etree__LogEntry), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":209
 *         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_2 = __pyx_f_4lxml_5etree_9_LogEntry__setError(__pyx_v_entry, __pyx_v_error); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 209, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":210
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 */
  switch (__pyx_v_error->level) {
    case XML_ERR_ERROR:
    case XML_ERR_FATAL:

    /* "src/lxml/xmlerror.pxi":211
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
 */
    __pyx_t_3 = 1;

    /* "src/lxml/xmlerror.pxi":210
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 */
    break;
    default:
    __pyx_t_3 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_3;

  /* "src/lxml/xmlerror.pxi":212
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __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;

  /* "src/lxml/xmlerror.pxi":213
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_3 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_3) {

    /* "src/lxml/xmlerror.pxi":214
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         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_ERR(1, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":215
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    if (__pyx_v_is_error) {

      /* "src/lxml/xmlerror.pxi":216
 *             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);

      /* "src/lxml/xmlerror.pxi":215
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    }

    /* "src/lxml/xmlerror.pxi":213
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  }

  /* "src/lxml/xmlerror.pxi":217
 *             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_ERR(1, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":218
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  if (__pyx_v_is_error) {

    /* "src/lxml/xmlerror.pxi":219
 *         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);

    /* "src/lxml/xmlerror.pxi":218
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  }

  /* "src/lxml/xmlerror.pxi":204
 * 
 *     @cython.final
 *     cdef int _receive(self, const xmlerror.xmlError* error) except -1:             # <<<<<<<<<<<<<<
 *         cdef bint is_error
 *         cdef _LogEntry entry
 */

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

/* "src/lxml/xmlerror.pxi":222
 * 
 *     @cython.final
 *     cdef int _receiveGeneric(self, int domain, int type, int level, long line,             # <<<<<<<<<<<<<<
 *                              message, filename) except -1:
 *         cdef bint is_error
 */

static int __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, long __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;
  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("_receiveGeneric", 1);

  /* "src/lxml/xmlerror.pxi":227
 *         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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)__pyx_ptype_4lxml_5etree__LogEntry), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 227, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":228
 *         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_ERR(1, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":229
 *         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 = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 */
  switch (__pyx_v_level) {
    case XML_ERR_ERROR:
    case XML_ERR_FATAL:

    /* "src/lxml/xmlerror.pxi":230
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:
 */
    __pyx_t_2 = 1;

    /* "src/lxml/xmlerror.pxi":229
 *         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 = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 */
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_2;

  /* "src/lxml/xmlerror.pxi":231
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 231, __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;

  /* "src/lxml/xmlerror.pxi":232
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_2) {

    /* "src/lxml/xmlerror.pxi":233
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         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_ERR(1, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":234
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    if (__pyx_v_is_error) {

      /* "src/lxml/xmlerror.pxi":235
 *             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);

      /* "src/lxml/xmlerror.pxi":234
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    }

    /* "src/lxml/xmlerror.pxi":232
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  }

  /* "src/lxml/xmlerror.pxi":236
 *             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_ERR(1, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":237
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  if (__pyx_v_is_error) {

    /* "src/lxml/xmlerror.pxi":238
 *         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);

    /* "src/lxml/xmlerror.pxi":237
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  }

  /* "src/lxml/xmlerror.pxi":222
 * 
 *     @cython.final
 *     cdef int _receiveGeneric(self, int domain, int type, int level, long line,             # <<<<<<<<<<<<<<
 *                              message, filename) except -1:
 *         cdef bint is_error
 */

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

/* "src/lxml/xmlerror.pxi":241
 * 
 *     @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;
  long __pyx_v_line;
  int __pyx_v_column;
  PyObject *__pyx_v_filename = 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;
  long __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_UCS4 __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseException", 1);

  /* "src/lxml/xmlerror.pxi":242
 *     @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;

  /* "src/lxml/xmlerror.pxi":243
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":244
 *         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_ERR(1, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_exctype);
    __pyx_t_4 = __pyx_v_exctype; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_default_message, __pyx_t_3, __pyx_int_0, __pyx_int_0};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":243
 *     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
 */
  }

  /* "src/lxml/xmlerror.pxi":245
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":246
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 *         if message:             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_message); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 246, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":247
 *         message = self._first_error.message
 *         if message:
 *             code = self._first_error.type             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
 */
    __pyx_t_6 = __pyx_v_self->_first_error->type;
    __pyx_v_code = __pyx_t_6;

    /* "src/lxml/xmlerror.pxi":246
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 *         if message:             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/xmlerror.pxi":249
 *             code = self._first_error.type
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         line = self._first_error.line
 *         column = self._first_error.column
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_default_message);
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_v_default_message);
  }
  __pyx_L4:;

  /* "src/lxml/xmlerror.pxi":250
 *         else:
 *             message = default_message
 *         line = self._first_error.line             # <<<<<<<<<<<<<<
 *         column = self._first_error.column
 *         filename = self._first_error.filename
 */
  __pyx_t_7 = __pyx_v_self->_first_error->line;
  __pyx_v_line = __pyx_t_7;

  /* "src/lxml/xmlerror.pxi":251
 *             message = default_message
 *         line = self._first_error.line
 *         column = self._first_error.column             # <<<<<<<<<<<<<<
 *         filename = self._first_error.filename
 *         if line > 0:
 */
  __pyx_t_6 = __pyx_v_self->_first_error->column;
  __pyx_v_column = __pyx_t_6;

  /* "src/lxml/xmlerror.pxi":252
 *         line = self._first_error.line
 *         column = self._first_error.column
 *         filename = self._first_error.filename             # <<<<<<<<<<<<<<
 *         if line > 0:
 *             if column > 0:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_filename = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":253
 *         column = self._first_error.column
 *         filename = self._first_error.filename
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"
 */
  __pyx_t_1 = (__pyx_v_line > 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":254
 *         filename = self._first_error.filename
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
 */
    __pyx_t_1 = (__pyx_v_column > 0);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":255
 *         if line > 0:
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"             # <<<<<<<<<<<<<<
 *             else:
 *                 message = f"{message}, line {line}"
 */
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_line);
      __pyx_t_8 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_line);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_line);
      __pyx_t_4 = __Pyx_PyUnicode_From_long(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_column);
      __pyx_t_8 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_column);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u_column);
      __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_column, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 255, __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;

      /* "src/lxml/xmlerror.pxi":254
 *         filename = self._first_error.filename
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":257
 *                 message = f"{message}, line {line}, column {column}"
 *             else:
 *                 message = f"{message}, line {line}"             # <<<<<<<<<<<<<<
 *         return exctype(message, code, line, column, filename)
 * 
 */
    /*else*/ {
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_line);
      __pyx_t_8 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_line);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_line);
      __pyx_t_2 = __Pyx_PyUnicode_From_long(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/xmlerror.pxi":253
 *         column = self._first_error.column
 *         filename = self._first_error.filename
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = f"{message}, line {line}, column {column}"
 */
  }

  /* "src/lxml/xmlerror.pxi":258
 *             else:
 *                 message = f"{message}, line {line}"
 *         return exctype(message, code, line, column, filename)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_column); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_exctype);
  __pyx_t_10 = __pyx_v_exctype; __pyx_t_11 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_11, __pyx_v_message, __pyx_t_4, __pyx_t_3, __pyx_t_5, __pyx_v_filename};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_6, 5+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __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;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":241
 * 
 *     @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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildParseException", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":261
 * 
 *     @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;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildExceptionMessage", 1);

  /* "src/lxml/xmlerror.pxi":262
 *     @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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":263
 *     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;

    /* "src/lxml/xmlerror.pxi":262
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return default_message
 *         if self._first_error.message:
 */
  }

  /* "src/lxml/xmlerror.pxi":264
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 264, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":265
 *             return default_message
 *         if self._first_error.message:
 *             message = self._first_error.message             # <<<<<<<<<<<<<<
 *         elif default_message is None:
 *             return None
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_message = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":264
 *         if self._first_error is None:
 *             return default_message
 *         if self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = self._first_error.message
 *         elif default_message is None:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/xmlerror.pxi":266
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_default_message == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":267
 *             message = self._first_error.message
 *         elif default_message is None:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":266
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  }

  /* "src/lxml/xmlerror.pxi":269
 *             return None
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_v_message = __pyx_v_default_message;
  }
  __pyx_L4:;

  /* "src/lxml/xmlerror.pxi":270
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 */
  __pyx_t_1 = (__pyx_v_self->_first_error->line > 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":271
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->_first_error->column > 0);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":272
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"             # <<<<<<<<<<<<<<
 *             else:
 *                 message = f"{message}, line {self._first_error.line}"
 */
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = 0;
      __pyx_t_4 = 127;
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_kp_u_line);
      __pyx_t_3 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_line);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_line);
      __pyx_t_5 = __Pyx_PyUnicode_From_long(__pyx_v_self->_first_error->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_kp_u_column);
      __pyx_t_3 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_column);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u_column);
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_self->_first_error->column, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/xmlerror.pxi":271
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":274
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 *             else:
 *                 message = f"{message}, line {self._first_error.line}"             # <<<<<<<<<<<<<<
 *         return message
 * 
 */
    /*else*/ {
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_4 = 127;
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_line);
      __pyx_t_3 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_line);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u_line);
      __pyx_t_2 = __Pyx_PyUnicode_From_long(__pyx_v_self->_first_error->line, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L6:;

    /* "src/lxml/xmlerror.pxi":270
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = f"{message}, line {self._first_error.line}, column {self._first_error.column}"
 */
  }

  /* "src/lxml/xmlerror.pxi":275
 *             else:
 *                 message = f"{message}, line {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;

  /* "src/lxml/xmlerror.pxi":261
 * 
 *     @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_2);
  __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;
}

/* "src/lxml/xmlerror.pxi":189
 * 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/xmlerror.pxi":281
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entries,&__pyx_n_s_first_error,&__pyx_n_s_last_error,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entries)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_first_error)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(1, 281, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_last_error)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(1, 281, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
    }
    __pyx_v_entries = values[0];
    __pyx_v_first_error = values[1];
    __pyx_v_last_error = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 281, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  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);
  __Pyx_INCREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);

  /* "src/lxml/xmlerror.pxi":282
 *     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_ERR(1, 282, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":283
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":284
 *         if entries:
 *             if first_error is None:
 *                 first_error = entries[0]             # <<<<<<<<<<<<<<
 *             if last_error is None:
 *                 last_error = entries[-1]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_entries, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_first_error, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":283
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:
 *             if first_error is None:             # <<<<<<<<<<<<<<
 *                 first_error = entries[0]
 *             if last_error is None:
 */
    }

    /* "src/lxml/xmlerror.pxi":285
 *             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_1 = (__pyx_v_last_error == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":286
 *                 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_2 = __Pyx_GetItemInt(__pyx_v_entries, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_last_error, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":285
 *             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)
 */
    }

    /* "src/lxml/xmlerror.pxi":282
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:             # <<<<<<<<<<<<<<
 *             if first_error is None:
 *                 first_error = entries[0]
 */
  }

  /* "src/lxml/xmlerror.pxi":287
 *             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 *)__pyx_ptype_4lxml_5etree__BaseErrorLog), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_first_error, __pyx_v_last_error};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 3+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":288
 *                 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) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_entries))) __PYX_ERR(1, 288, __pyx_L1_error)
  __pyx_t_2 = __pyx_v_entries;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":281
 *     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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("copy", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_13_ListErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 290, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":294
 *         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_ERR(1, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_entries);
  __Pyx_GIVEREF(__pyx_v_self->_entries);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_entries)) __PYX_ERR(1, 294, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._first_error);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._first_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._first_error))) __PYX_ERR(1, 294, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.last_error);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.last_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->__pyx_base.last_error)) __PYX_ERR(1, 294, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 294, __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;

  /* "src/lxml/xmlerror.pxi":296
 *         cdef _ListErrorLog log = _ListErrorLog(
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
  __pyx_t_5 = __pyx_v_self->_offset;
  __pyx_v_log->_offset = __pyx_t_5;

  /* "src/lxml/xmlerror.pxi":297
 *             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;

  /* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_13_ListErrorLog_2copy, "Creates a shallow copy of this error log.  Reuses the list of\n        entries.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_3copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_2copy};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_ListErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 290, __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;
}

/* "src/lxml/xmlerror.pxi":299
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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("__iter__", 1);

  /* "src/lxml/xmlerror.pxi":300
 * 
 *     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;

  /* "src/lxml/xmlerror.pxi":301
 *     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) {

    /* "src/lxml/xmlerror.pxi":302
 *         entries = self._entries
 *         if self._offset:
 *             entries = islice(entries, self._offset)             # <<<<<<<<<<<<<<
 *         return iter(entries)
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_islice);
    __pyx_t_4 = __pyx_v_4lxml_5etree_islice; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_entries, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_entries, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlerror.pxi":301
 *     def __iter__(self):
 *         entries = self._entries
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             entries = islice(entries, self._offset)
 *         return iter(entries)
 */
  }

  /* "src/lxml/xmlerror.pxi":303
 *         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_ERR(1, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":299
 *         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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/xmlerror.pxi":305
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '\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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_8genexpr2__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__", 1);

  /* "src/lxml/xmlerror.pxi":306
 * 
 *     def __repr__(self):
 *         return '\n'.join([repr(entry) for entry in self])             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(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_ERR(1, 306, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 306, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 306, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(1, 306, __pyx_L5_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 306, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(1, 306, __pyx_L5_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 306, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_entry, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Repr(__pyx_8genexpr2__pyx_v_entry); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 306, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_entry); __pyx_8genexpr2__pyx_v_entry = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_entry); __pyx_8genexpr2__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__21, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 306, __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;

  /* "src/lxml/xmlerror.pxi":305
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '\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_8genexpr2__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":308
 *         return '\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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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);

  /* "src/lxml/xmlerror.pxi":309
 * 
 *     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) {

    /* "src/lxml/xmlerror.pxi":310
 *     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_ERR(1, 310, __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_ERR(1, 310, __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;

    /* "src/lxml/xmlerror.pxi":309
 * 
 *     def __getitem__(self, index):
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             index += self._offset
 *         return self._entries[index]
 */
  }

  /* "src/lxml/xmlerror.pxi":311
 *         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_ERR(1, 311, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_self->_entries, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":308
 *         return '\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;
}

/* "src/lxml/xmlerror.pxi":313
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":314
 * 
 *     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_ERR(1, 314, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 - __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":313
 *         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;
}

/* "src/lxml/xmlerror.pxi":316
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":318
 *     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 (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 318, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(1, 318, __pyx_L1_error)
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #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);

    /* "src/lxml/xmlerror.pxi":319
 *         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);
    if (__pyx_t_5) {

      /* "src/lxml/xmlerror.pxi":320
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:
 *                 continue             # <<<<<<<<<<<<<<
 *             if entry.type == error_type:
 *                 return True
 */
      goto __pyx_L3_continue;

      /* "src/lxml/xmlerror.pxi":319
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:             # <<<<<<<<<<<<<<
 *                 continue
 *             if entry.type == error_type:
 */
    }

    /* "src/lxml/xmlerror.pxi":321
 *             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_ERR(1, 321, __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_ERR(1, 321, __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_ERR(1, 321, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "src/lxml/xmlerror.pxi":322
 *                 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;

      /* "src/lxml/xmlerror.pxi":321
 *             if i < self._offset:
 *                 continue
 *             if entry.type == error_type:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    }

    /* "src/lxml/xmlerror.pxi":318
 *     def __contains__(self, error_type):
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):             # <<<<<<<<<<<<<<
 *             if i < self._offset:
 *                 continue
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":323
 *             if entry.type == error_type:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":316
 *         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;
}

/* "src/lxml/xmlerror.pxi":325
 *         return False
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_14__bool__(((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__bool__(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("__bool__", 1);

  /* "src/lxml/xmlerror.pxi":326
 * 
 *     def __bool__(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_ERR(1, 326, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 > __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":325
 *         return False
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
 */

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

/* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_17filter_domains = {"filter_domains", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_domains = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_domains (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domains,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_domains)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filter_domains") < 0)) __PYX_ERR(1, 328, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_domains = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_domains", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 328, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_domains);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr3__pyx_v_entry = 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)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_domains", 0);
  __Pyx_INCREF(__pyx_v_domains);

  /* "src/lxml/xmlerror.pxi":333
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):             # <<<<<<<<<<<<<<
 *             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) {

    /* "src/lxml/xmlerror.pxi":334
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):
 *             domains = (domains,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.domain in domains]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_domains);
    __Pyx_GIVEREF(__pyx_v_domains);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_domains)) __PYX_ERR(1, 334, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_domains, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":333
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(domains, int):             # <<<<<<<<<<<<<<
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
 */
  }

  /* "src/lxml/xmlerror.pxi":335
 *         if isinstance(domains, int):
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 335, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 335, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 335, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 335, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 335, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_8genexpr3__pyx_v_entry->domain); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_domains, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 335, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr3__pyx_v_entry))) __PYX_ERR(1, 335, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_entry); __pyx_8genexpr3__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_entry); __pyx_8genexpr3__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":336
 *             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_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filtered)) __PYX_ERR(1, 336, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(1, 336, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None)) __PYX_ERR(1, 336, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 336, __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;

  /* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_domains);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_19filter_types = {"filter_types", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_types = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_types (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_types,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_types)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 338, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filter_types") < 0)) __PYX_ERR(1, 338, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_types = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_types", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 338, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_types);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr4__pyx_v_entry = 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)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_types", 0);
  __Pyx_INCREF(__pyx_v_types);

  /* "src/lxml/xmlerror.pxi":345
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(types, int):             # <<<<<<<<<<<<<<
 *             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) {

    /* "src/lxml/xmlerror.pxi":346
 *         cdef _LogEntry entry
 *         if isinstance(types, int):
 *             types = (types,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.type in types]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_types);
    __Pyx_GIVEREF(__pyx_v_types);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_types)) __PYX_ERR(1, 346, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_types, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":345
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(types, int):             # <<<<<<<<<<<<<<
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
 */
  }

  /* "src/lxml/xmlerror.pxi":347
 *         if isinstance(types, int):
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 347, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 347, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 347, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 347, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_8genexpr4__pyx_v_entry->type); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_types, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 347, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr4__pyx_v_entry))) __PYX_ERR(1, 347, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry); __pyx_8genexpr4__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry); __pyx_8genexpr4__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":348
 *             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_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filtered)) __PYX_ERR(1, 348, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(1, 348, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None)) __PYX_ERR(1, 348, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 348, __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;

  /* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_21filter_levels = {"filter_levels", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_levels = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_levels (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_levels,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_levels)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 350, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filter_levels") < 0)) __PYX_ERR(1, 350, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_levels = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_levels", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 350, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_levels);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr5__pyx_v_entry = 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)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_levels", 0);
  __Pyx_INCREF(__pyx_v_levels);

  /* "src/lxml/xmlerror.pxi":357
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):             # <<<<<<<<<<<<<<
 *             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) {

    /* "src/lxml/xmlerror.pxi":358
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):
 *             levels = (levels,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.level in levels]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_levels);
    __Pyx_GIVEREF(__pyx_v_levels);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_levels)) __PYX_ERR(1, 358, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_levels, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":357
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(levels, int):             # <<<<<<<<<<<<<<
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
 */
  }

  /* "src/lxml/xmlerror.pxi":359
 *         if isinstance(levels, int):
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 359, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
      __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 359, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 359, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 359, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 359, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__LogEntry))))) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_8genexpr5__pyx_v_entry->level); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_levels, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 359, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr5__pyx_v_entry))) __PYX_ERR(1, 359, __pyx_L6_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry); __pyx_8genexpr5__pyx_v_entry = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry); __pyx_8genexpr5__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":360
 *             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_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filtered)) __PYX_ERR(1, 360, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(1, 360, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None)) __PYX_ERR(1, 360, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 360, __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;

  /* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr5__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_levels);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_23filter_from_level = {"filter_from_level", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_level = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_level (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_level)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 362, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filter_from_level") < 0)) __PYX_ERR(1, 362, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_level = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_from_level", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 362, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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) {
  PyObject *__pyx_v_filtered = NULL;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_8genexpr6__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;
  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", 1);

  /* "src/lxml/xmlerror.pxi":368
 *         """
 *         cdef _LogEntry entry
 *         filtered = [entry for entry in self if entry.level >= level]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 368, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(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_ERR(1, 368, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 368, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 368, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(1, 368, __pyx_L5_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 368, __pyx_L5_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(1, 368, __pyx_L5_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 368, __pyx_L5_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_ERR(1, 368, __pyx_L5_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr6__pyx_v_entry->level); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L5_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_ERR(1, 368, __pyx_L5_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_ERR(1, 368, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr6__pyx_v_entry))) __PYX_ERR(1, 368, __pyx_L5_error)
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry); __pyx_8genexpr6__pyx_v_entry = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry); __pyx_8genexpr6__pyx_v_entry = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_v_filtered = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":369
 *         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_ERR(1, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filtered)) __PYX_ERR(1, 369, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None)) __PYX_ERR(1, 369, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 369, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 369, __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;

  /* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """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(__pyx_v_filtered);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr6__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_25filter_from_fatals = {"filter_from_fatals", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_fatals (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("filter_from_fatals", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "filter_from_fatals", 0))) return NULL;
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_fatals", 1);

  /* "src/lxml/xmlerror.pxi":376
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_FATAL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 376, __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;

  /* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_27filter_from_errors = {"filter_from_errors", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_errors (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("filter_from_errors", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "filter_from_errors", 0))) return NULL;
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_errors", 1);

  /* "src/lxml/xmlerror.pxi":383
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 383, __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;

  /* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13_ListErrorLog_29filter_from_warnings = {"filter_from_warnings", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings};
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_warnings (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("filter_from_warnings", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "filter_from_warnings", 0))) return NULL;
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_warnings", 1);

  /* "src/lxml/xmlerror.pxi":390
 *         Convenience method to get all warnings or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.WARNING)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 390, __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;

  /* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":407
 *     cdef _BaseErrorLog old_xslt_error_log
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:             # <<<<<<<<<<<<<<
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 */

static int __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log) {
  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("push_error_log", 1);

  /* "src/lxml/xmlerror.pxi":408
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:
 *         self.old_error_func = xmlerror.xmlStructuredError             # <<<<<<<<<<<<<<
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 *         xmlerror.xmlSetStructuredErrorFunc(
 */
  __pyx_v_self->old_error_func = xmlStructuredError;

  /* "src/lxml/xmlerror.pxi":409
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             <void*>log, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 */
  __pyx_v_self->old_error_context = xmlStructuredErrorContext;

  /* "src/lxml/xmlerror.pxi":410
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             <void*>log, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 * 
 */
  xmlSetStructuredErrorFunc(((void *)__pyx_v_log), ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError));

  /* "src/lxml/xmlerror.pxi":414
 * 
 *         # xslt.xsltSetGenericErrorFunc() is not thread-local => keep error log in TLS
 *         self.old_xslt_error_func = xslt.xsltGenericError             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 */
  __pyx_v_self->old_xslt_error_func = xsltGenericError;

  /* "src/lxml/xmlerror.pxi":415
 *         # xslt.xsltSetGenericErrorFunc() is not thread-local => keep error log in TLS
 *         self.old_xslt_error_func = xslt.xsltGenericError
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
 */
  __pyx_v_self->old_xslt_error_context = xsltGenericErrorContext;

  /* "src/lxml/xmlerror.pxi":416
 *         self.old_xslt_error_func = xslt.xsltGenericError
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)             # <<<<<<<<<<<<<<
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
 *         xslt.xsltSetGenericErrorFunc(
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_XSLTErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __pyx_v_self->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":417
 *         self.old_xslt_error_context = xslt.xsltGenericErrorContext
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)             # <<<<<<<<<<<<<<
 *         xslt.xsltSetGenericErrorFunc(
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_n_u_XSLTErrorLog, __pyx_v_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":418
 *         self.old_xslt_error_log = _getThreadErrorLog(XSLT_ERROR_LOG)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, log)
 *         xslt.xsltSetGenericErrorFunc(             # <<<<<<<<<<<<<<
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         return 0
 */
  xsltSetGenericErrorFunc(NULL, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "src/lxml/xmlerror.pxi":420
 *         xslt.xsltSetGenericErrorFunc(
 *             NULL, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int pop_error_log(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":407
 *     cdef _BaseErrorLog old_xslt_error_log
 * 
 *     cdef int push_error_log(self, _BaseErrorLog log) except -1:             # <<<<<<<<<<<<<<
 *         self.old_error_func = xmlerror.xmlStructuredError
 *         self.old_error_context = xmlerror.xmlStructuredErrorContext
 */

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

/* "src/lxml/xmlerror.pxi":422
 *         return 0
 * 
 *     cdef int pop_error_log(self) except -1:             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
 */

static int __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(struct __pyx_obj_4lxml_5etree__ErrorLogContext *__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("pop_error_log", 1);

  /* "src/lxml/xmlerror.pxi":423
 * 
 *     cdef int pop_error_log(self) except -1:
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             self.old_error_context, self.old_error_func)
 *         xslt.xsltSetGenericErrorFunc(
 */
  xmlSetStructuredErrorFunc(__pyx_v_self->old_error_context, __pyx_v_self->old_error_func);

  /* "src/lxml/xmlerror.pxi":425
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
 *         xslt.xsltSetGenericErrorFunc(             # <<<<<<<<<<<<<<
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
 */
  xsltSetGenericErrorFunc(__pyx_v_self->old_xslt_error_context, __pyx_v_self->old_xslt_error_func);

  /* "src/lxml/xmlerror.pxi":427
 *         xslt.xsltSetGenericErrorFunc(
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)             # <<<<<<<<<<<<<<
 *         self.old_xslt_error_log= None
 *         return 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_n_u_XSLTErrorLog, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __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;

  /* "src/lxml/xmlerror.pxi":428
 *             self.old_xslt_error_context, self.old_xslt_error_func)
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
 *         self.old_xslt_error_log= None             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __Pyx_DECREF((PyObject *)__pyx_v_self->old_xslt_error_log);
  __pyx_v_self->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None);

  /* "src/lxml/xmlerror.pxi":429
 *         _setThreadErrorLog(XSLT_ERROR_LOG, self.old_xslt_error_log)
 *         self.old_xslt_error_log= None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":422
 *         return 0
 * 
 *     cdef int pop_error_log(self) except -1:             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             self.old_error_context, self.old_error_func)
 */

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

/* "src/lxml/xmlerror.pxi":434
 * 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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/xmlerror.pxi":435
 *     cdef list _logContexts
 *     def __cinit__(self):
 *         self._logContexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 435, __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;

  /* "src/lxml/xmlerror.pxi":434
 * 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;
}

/* "src/lxml/xmlerror.pxi":437
 *         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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;
  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__", 1);

  /* "src/lxml/xmlerror.pxi":438
 * 
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_t_3, Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 4+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 438, __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;

  /* "src/lxml/xmlerror.pxi":437
 *         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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":441
 * 
 *     @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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xmlerror.pxi":442
 *     @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 == ((int)-1))) __PYX_ERR(1, 442, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":441
 * 
 *     @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:;
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":444
 *         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 PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_5__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__, METH_VARARGS|METH_KEYWORDS, 0};
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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_DECREF(__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__", 1);

  /* "src/lxml/xmlerror.pxi":446
 *     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 == ((int)-1))) __PYX_ERR(1, 446, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":444
 *         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;
}

/* "src/lxml/xmlerror.pxi":449
 * 
 *     @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_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 1);

  /* "src/lxml/xmlerror.pxi":450
 *     @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((PyObject *)__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);

  /* "src/lxml/xmlerror.pxi":451
 *     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_ERR(1, 451, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(1, 451, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":453
 *         del self._entries[:]
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)             # <<<<<<<<<<<<<<
 *         context.push_error_log(self)
 *         self._logContexts.append(context)
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ErrorLogContext(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ErrorLogContext), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 453, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":454
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.push_error_log(self)             # <<<<<<<<<<<<<<
 *         self._logContexts.append(context)
 *         return 0
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 454, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":455
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.push_error_log(self)
 *         self._logContexts.append(context)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(1, 455, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_logContexts, ((PyObject *)__pyx_v_context)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 455, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":456
 *         context.push_error_log(self)
 *         self._logContexts.append(context)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":449
 * 
 *     @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;
}

/* "src/lxml/xmlerror.pxi":459
 * 
 *     @cython.final
 *     cdef int disconnect(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()
 */

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_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("disconnect", 1);

  /* "src/lxml/xmlerror.pxi":460
 *     @cython.final
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()             # <<<<<<<<<<<<<<
 *         context.pop_error_log()
 *         return 0
 */
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(1, 460, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_logContexts); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __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_ERR(1, 460, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":461
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log(__pyx_v_context); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 461, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":462
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef clear(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlerror.pxi":459
 * 
 *     @cython.final
 *     cdef int disconnect(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         context.pop_error_log()
 */

  /* 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;
}

/* "src/lxml/xmlerror.pxi":464
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("clear", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_9_ErrorLog_7clear)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 464, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":465
 * 
 *     cpdef clear(self):
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         self.last_error = None
 *         self._offset = 0
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__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);

  /* "src/lxml/xmlerror.pxi":466
 *     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;

  /* "src/lxml/xmlerror.pxi":467
 *         self._first_error = None
 *         self.last_error = None
 *         self._offset = 0             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
 */
  __pyx_v_self->__pyx_base._offset = 0;

  /* "src/lxml/xmlerror.pxi":468
 *         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_ERR(1, 468, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(1, 468, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":464
 *         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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_7clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_7clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_clear(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 464, __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;
}

/* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("copy", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_9_ErrorLog_9copy)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 470, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":473
 *         """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);

  /* "src/lxml/xmlerror.pxi":474
 *         """
 *         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_ERR(1, 474, __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_ERR(1, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/xmlerror.pxi":473
 *         """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_ERR(1, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error))) __PYX_ERR(1, 473, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->__pyx_base.__pyx_base.last_error)) __PYX_ERR(1, 473, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __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;

  /* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_9_ErrorLog_8copy, "Creates a shallow copy of this error log and the list of entries.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_9copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_ErrorLog_8copy};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 470, __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;
}

/* "src/lxml/xmlerror.pxi":477
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":478
 * 
 *     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_ERR(1, 478, __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_ERR(1, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 478, __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;

  /* "src/lxml/xmlerror.pxi":477
 *             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;
}

/* "src/lxml/xmlerror.pxi":480
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  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("receive", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_9_ErrorLog_13receive)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":481
 * 
 *     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_7 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error) == Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_entry->level >= XML_ERR_ERROR);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":482
 *     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((PyObject *)__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;

    /* "src/lxml/xmlerror.pxi":481
 * 
 *     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)
 */
  }

  /* "src/lxml/xmlerror.pxi":483
 *         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 '%.30s'", "append");
    __PYX_ERR(1, 483, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 483, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":480
 *         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_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9_ErrorLog_13receive = {"receive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_13receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entry,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 480, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "receive") < 0)) __PYX_ERR(1, 480, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 480, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 480, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_12receive(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 480, __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;
}

/* "src/lxml/xmlerror.pxi":486
 * 
 * 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domains,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_domains)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 486, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 486, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_domains = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 486, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/xmlerror.pxi":487
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._accepted_domains = tuple(domains)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __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;

  /* "src/lxml/xmlerror.pxi":488
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_domains); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accepted_domains, __pyx_t_1) < 0) __PYX_ERR(1, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":486
 * 
 * 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;
}

/* "src/lxml/xmlerror.pxi":490
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("receive", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 490, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":491
 * 
 *     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_ERR(1, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accepted_domains); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 491, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":492
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_ErrorLog_receive(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlerror.pxi":491
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:             # <<<<<<<<<<<<<<
 *             _ErrorLog.receive(self, entry)
 * 
 */
  }

  /* "src/lxml/xmlerror.pxi":490
 *         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_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DomainErrorLog_3receive = {"receive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entry,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 490, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "receive") < 0)) __PYX_ERR(1, 490, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 490, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 490, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_15_DomainErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __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;
}

/* "src/lxml/xmlerror.pxi":496
 * 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_len,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_len)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 496, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 496, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_max_len = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 496, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/xmlerror.pxi":497
 *     cdef int _max_len
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._max_len = max_len
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __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;

  /* "src/lxml/xmlerror.pxi":498
 *     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_ERR(1, 498, __pyx_L1_error)
  __pyx_v_self->_max_len = __pyx_t_4;

  /* "src/lxml/xmlerror.pxi":496
 * 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;
}

/* "src/lxml/xmlerror.pxi":500
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 500, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":501
 * 
 *     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_7 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error) == Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_entry->level >= XML_ERR_ERROR);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":502
 *     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((PyObject *)__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;

    /* "src/lxml/xmlerror.pxi":501
 * 
 *     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)
 */
  }

  /* "src/lxml/xmlerror.pxi":503
 *         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 '%.30s'", "append");
    __PYX_ERR(1, 503, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base.__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 503, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":505
 *         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_ERR(1, 505, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_9 > __pyx_v_self->_max_len);
  if (__pyx_t_6) {

    /* "src/lxml/xmlerror.pxi":506
 * 
 *         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);

    /* "src/lxml/xmlerror.pxi":507
 *         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));
    if (__pyx_t_6) {

      /* "src/lxml/xmlerror.pxi":508
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset             # <<<<<<<<<<<<<<
 *                 self._offset = 0
 *                 del self._entries[:offset]
 */
      __pyx_t_5 = __pyx_v_self->__pyx_base.__pyx_base._offset;
      __pyx_v_offset = __pyx_t_5;

      /* "src/lxml/xmlerror.pxi":509
 *             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;

      /* "src/lxml/xmlerror.pxi":510
 *                 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_ERR(1, 510, __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_ERR(1, 510, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":507
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:             # <<<<<<<<<<<<<<
 *                 offset = self._offset
 *                 self._offset = 0
 */
    }

    /* "src/lxml/xmlerror.pxi":505
 *         self._entries.append(entry)
 * 
 *         if len(self._entries) > self._max_len:             # <<<<<<<<<<<<<<
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
 */
  }

  /* "src/lxml/xmlerror.pxi":500
 *         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_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_RotatingErrorLog_3receive = {"receive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entry,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 500, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "receive") < 0)) __PYX_ERR(1, 500, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 500, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) __PYX_ERR(1, 500, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self), __pyx_v_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_17_RotatingErrorLog_receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __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;
}

/* "src/lxml/xmlerror.pxi":535
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_logger_name,&__pyx_n_s_logger,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_logger_name);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 535, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_logger);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 535, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 535, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_logger_name = values[0];
    __pyx_v_logger = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, __pyx_nargs); __PYX_ERR(1, 535, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/xmlerror.pxi":536
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)             # <<<<<<<<<<<<<<
 *         import logging
 *         self.level_map = {
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, ((PyObject *)__pyx_v_self), Py_None, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 536, __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;

  /* "src/lxml/xmlerror.pxi":537
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging             # <<<<<<<<<<<<<<
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 */
  __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_logging, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_logging = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":539
 *         import logging
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,             # <<<<<<<<<<<<<<
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 539, __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_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_ERR(1, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":540
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,             # <<<<<<<<<<<<<<
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 540, __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_ERR(1, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_ERR(1, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":541
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL             # <<<<<<<<<<<<<<
 *             }
 *         self._map_level = self.level_map.get
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 541, __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_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(1, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlerror.pxi":538
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->level_map);
  __Pyx_DECREF(__pyx_v_self->level_map);
  __pyx_v_self->level_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":543
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 *         self._map_level = self.level_map.get             # <<<<<<<<<<<<<<
 *         if logger is None:
 *             if logger_name:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->level_map, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_map_level);
  __Pyx_DECREF(__pyx_v_self->_map_level);
  __pyx_v_self->_map_level = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":544
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
 */
  __pyx_t_5 = (__pyx_v_logger == Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/xmlerror.pxi":545
 *         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_ERR(1, 545, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/xmlerror.pxi":546
 *         if logger is None:
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)             # <<<<<<<<<<<<<<
 *             else:
 *                 logger = logging.getLogger()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 546, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_logger_name};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xmlerror.pxi":545
 *         self._map_level = self.level_map.get
 *         if logger is None:
 *             if logger_name:             # <<<<<<<<<<<<<<
 *                 logger = logging.getLogger(logger_name)
 *             else:
 */
      goto __pyx_L4;
    }

    /* "src/lxml/xmlerror.pxi":548
 *                 logger = logging.getLogger(logger_name)
 *             else:
 *                 logger = logging.getLogger()             # <<<<<<<<<<<<<<
 *         self._log = logger.log
 * 
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L4:;

    /* "src/lxml/xmlerror.pxi":544
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
 */
  }

  /* "src/lxml/xmlerror.pxi":549
 *             else:
 *                 logger = logging.getLogger()
 *         self._log = logger.log             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_logger, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_log);
  __Pyx_DECREF(__pyx_v_self->_log);
  __pyx_v_self->_log = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":535
 *     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;
}

/* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("copy", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_10PyErrorLog_3copy)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":554
 *         """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_ERR(1, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(1, 554, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None)) __PYX_ERR(1, 554, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __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;

  /* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_10PyErrorLog_2copy, "Dummy method that returns an empty error log.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_3copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_2copy};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10PyErrorLog_copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __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;
}

/* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_5log = {"log", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_5log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_4log};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_log_entry = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_args = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 2, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log_entry,&__pyx_n_s_message,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_log_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 556, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 556, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, 1); __PYX_ERR(1, 556, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 2) ? kwd_pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "log") < 0)) __PYX_ERR(1, 556, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_log_entry = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, __pyx_nargs); __PYX_ERR(1, 556, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_args);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log", 1);

  /* "src/lxml/xmlerror.pxi":569
 *         """
 *         self._log(
 *             self._map_level(log_entry.level, 0),             # <<<<<<<<<<<<<<
 *             message, *args
 *             )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_log_entry, __pyx_n_s_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->_map_level);
  __pyx_t_3 = __pyx_v_self->_map_level; __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_int_0};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "src/lxml/xmlerror.pxi":568
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 568, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_message)) __PYX_ERR(1, 568, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":570
 *         self._log(
 *             self._map_level(log_entry.level, 0),
 *             message, *args             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlerror.pxi":568
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->_log, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_10PyErrorLog_7receive)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_log_entry)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/xmlerror.pxi":584
 *         format.
 *         """
 *         self.log(log_entry, repr(log_entry))             # <<<<<<<<<<<<<<
 * 
 * # thread-local, global list log to collect error output messages from
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_log_entry)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)__pyx_v_log_entry), __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 584, __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;

  /* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_10PyErrorLog_7receive = {"receive", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_7receive, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_6receive};
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log_entry,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_log_entry)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 573, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "receive") < 0)) __PYX_ERR(1, 573, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_log_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("receive", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 573, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "log_entry", 0))) __PYX_ERR(1, 573, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_6receive(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_log_entry);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10PyErrorLog_receive(__pyx_v_self, __pyx_v_log_entry, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 573, __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;
}

/* "src/lxml/xmlerror.pxi":532
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/xmlerror.pxi":592
 * 
 * 
 * cdef _BaseErrorLog _getThreadErrorLog(name):             # <<<<<<<<<<<<<<
 *     """Retrieve the current error log with name 'name' of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getThreadErrorLog(PyObject *__pyx_v_name) {
  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("_getThreadErrorLog", 1);

  /* "src/lxml/xmlerror.pxi":595
 *     """Retrieve the current error log with name 'name' 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();

  /* "src/lxml/xmlerror.pxi":596
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":597
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG             # <<<<<<<<<<<<<<
 *     try:
 *         return (<object>thread_dict)[name]
 */
    __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;

    /* "src/lxml/xmlerror.pxi":596
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         return __GLOBAL_ERROR_LOG
 *     try:
 */
  }

  /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/xmlerror.pxi":599
 *         return __GLOBAL_ERROR_LOG
 *     try:
 *         return (<object>thread_dict)[name]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \
 */
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 599, __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_ERR(1, 599, __pyx_L4_error)
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
 */
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":600
 *     try:
 *         return (<object>thread_dict)[name]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._getThreadErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 600, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/xmlerror.pxi":602
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__RotatingErrorLog), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 602, __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);

      /* "src/lxml/xmlerror.pxi":601
 *         return (<object>thread_dict)[name]
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \             # <<<<<<<<<<<<<<
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log
 */
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name, __pyx_t_9) < 0))) __PYX_ERR(1, 601, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/xmlerror.pxi":603
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return 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;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/xmlerror.pxi":598
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[name]
 *     except KeyError:
 */
    __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;
  }

  /* "src/lxml/xmlerror.pxi":592
 * 
 * 
 * cdef _BaseErrorLog _getThreadErrorLog(name):             # <<<<<<<<<<<<<<
 *     """Retrieve the current error log with name 'name' 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._getThreadErrorLog", __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;
}

/* "src/lxml/xmlerror.pxi":606
 * 
 * 
 * cdef _setThreadErrorLog(name, _BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     """Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static PyObject *__pyx_f_4lxml_5etree__setThreadErrorLog(PyObject *__pyx_v_name, 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("_setThreadErrorLog", 1);

  /* "src/lxml/xmlerror.pxi":609
 *     """Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/xmlerror.pxi":610
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
 */
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":611
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:             # <<<<<<<<<<<<<<
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_GlobalErrorLog, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 611, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":613
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log             # <<<<<<<<<<<<<<
 *     else:
 *         (<object>thread_dict)[name] = 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);

      /* "src/lxml/xmlerror.pxi":611
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         if name == GLOBAL_ERROR_LOG:             # <<<<<<<<<<<<<<
 *             global __GLOBAL_ERROR_LOG
 *             __GLOBAL_ERROR_LOG = log
 */
    }

    /* "src/lxml/xmlerror.pxi":610
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         if name == GLOBAL_ERROR_LOG:
 *             global __GLOBAL_ERROR_LOG
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":615
 *             __GLOBAL_ERROR_LOG = log
 *     else:
 *         (<object>thread_dict)[name] = log             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_v_name, ((PyObject *)__pyx_v_log)) < 0))) __PYX_ERR(1, 615, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/xmlerror.pxi":606
 * 
 * 
 * cdef _setThreadErrorLog(name, _BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     """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._setThreadErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlerror.pxi":618
 * 
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).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", 1);

  /* "src/lxml/xmlerror.pxi":620
 * cdef __copyGlobalErrorLog():
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).copy()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 620, __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_ERR(1, 620, __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;

  /* "src/lxml/xmlerror.pxi":618
 * 
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     "Helper function for properties in exceptions."
 *     return _getThreadErrorLog(GLOBAL_ERROR_LOG).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;
}

/* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"use_global_python_log", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_5use_global_python_log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4use_global_python_log};
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("use_global_python_log (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_log)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 623, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "use_global_python_log") < 0)) __PYX_ERR(1, 623, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_log = ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("use_global_python_log", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 623, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.use_global_python_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_4lxml_5etree_PyErrorLog, 0, "log", 0))) __PYX_ERR(1, 623, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_4use_global_python_log(__pyx_self, __pyx_v_log);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/xmlerror.pxi":636
 *     function will only set the global error log of the current thread.
 *     """
 *     _setThreadErrorLog(GLOBAL_ERROR_LOG, log)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setThreadErrorLog(__pyx_n_u_GlobalErrorLog, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/xmlerror.pxi":640
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept 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 const *__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_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardError", 0);

  /* "src/lxml/xmlerror.pxi":642
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 */
  __pyx_t_1 = (__pyx_v_c_log_handler != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":643
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler             # <<<<<<<<<<<<<<
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 */
    __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;

    /* "src/lxml/xmlerror.pxi":642
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":644
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_error->domain == XML_FROM_XSLT);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":645
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)             # <<<<<<<<<<<<<<
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_XSLTErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 645, __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;

    /* "src/lxml/xmlerror.pxi":644
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     elif error.domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlerror.pxi":647
 *         log_handler = _getThreadErrorLog(XSLT_ERROR_LOG)
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)             # <<<<<<<<<<<<<<
 *     log_handler._receive(error)
 * 
 */
  /*else*/ {
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getThreadErrorLog(__pyx_n_u_GlobalErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __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:;

  /* "src/lxml/xmlerror.pxi":648
 *     else:
 *         log_handler = _getThreadErrorLog(GLOBAL_ERROR_LOG)
 *     log_handler._receive(error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(__pyx_v_log_handler, __pyx_v_error); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 648, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":640
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) noexcept 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, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log_handler);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/xmlerror.pxi":651
 * 
 * 
 * cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) noexcept 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 const *__pyx_v_error) {

  /* "src/lxml/xmlerror.pxi":654
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 *         _forwardError(c_log_handler, error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, __pyx_v_error);

  /* "src/lxml/xmlerror.pxi":651
 * 
 * 
 * cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":657
 * 
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

static void __pyx_f_4lxml_5etree__receiveXSLTError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":660
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)
 *     cvarargs.va_end(args)
 */
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":661
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
 */
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_XSLT, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":662
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:
 */
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":657
 * 
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":664
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

static void __pyx_f_4lxml_5etree__receiveRelaxNGParseError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":667
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)
 *     cvarargs.va_end(args)
 */
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":668
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
 */
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_RELAXNGP, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":669
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:
 */
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":664
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":671
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

static void __pyx_f_4lxml_5etree__receiveRelaxNGValidationError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  va_list __pyx_v_args;

  /* "src/lxml/xmlerror.pxi":674
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)
 *     cvarargs.va_end(args)
 */
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "src/lxml/xmlerror.pxi":675
 *     cdef cvarargs.va_list args
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
 */
  __pyx_f_4lxml_5etree__receiveGenericError(__pyx_v_c_log_handler, XML_FROM_RELAXNGV, __pyx_v_msg, __pyx_v_args);

  /* "src/lxml/xmlerror.pxi":676
 *     cvarargs.va_start(args, msg)
 *     _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGV, msg, args)
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 * # dummy function: no log output at all
 */
  va_end(__pyx_v_args);

  /* "src/lxml/xmlerror.pxi":671
 *     cvarargs.va_end(args)
 * 
 * cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef cvarargs.va_list args
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":679
 * 
 * # dummy function: no log output at all
 * cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) noexcept nogil:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(CYTHON_UNUSED void *__pyx_v_ctxt, CYTHON_UNUSED char *__pyx_v_msg, ...) {

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 */

static void __pyx_f_4lxml_5etree__connectGenericErrorLog(PyObject *__pyx_v_log, struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog *__pyx_optional_args) {
  int __pyx_v_c_domain = ((int)-1);
  xmlGenericErrorFunc __pyx_v_error_func;
  void *__pyx_v_c_log;
  int __pyx_t_1;
  int __pyx_t_2;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_c_domain = __pyx_optional_args->c_domain;
    }
  }

  /* "src/lxml/xmlerror.pxi":684
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL             # <<<<<<<<<<<<<<
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 */
  __pyx_v_error_func = NULL;

  /* "src/lxml/xmlerror.pxi":685
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log             # <<<<<<<<<<<<<<
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 */
  __pyx_v_c_log = ((void *)__pyx_v_log);

  /* "src/lxml/xmlerror.pxi":686
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 */
  switch (__pyx_v_c_domain) {
    case XML_FROM_XSLT:

    /* "src/lxml/xmlerror.pxi":687
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError             # <<<<<<<<<<<<<<
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 */
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError);

    /* "src/lxml/xmlerror.pxi":686
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 *     if c_domain == xmlerror.XML_FROM_XSLT:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 */
    break;
    case XML_FROM_RELAXNGP:

    /* "src/lxml/xmlerror.pxi":689
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError             # <<<<<<<<<<<<<<
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 */
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveRelaxNGParseError);

    /* "src/lxml/xmlerror.pxi":688
 *     if c_domain == xmlerror.XML_FROM_XSLT:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveXSLTError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
 */
    break;
    case XML_FROM_RELAXNGV:

    /* "src/lxml/xmlerror.pxi":691
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError             # <<<<<<<<<<<<<<
 * 
 *     if log is None or error_func is NULL:
 */
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveRelaxNGValidationError);

    /* "src/lxml/xmlerror.pxi":690
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGP:
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGParseError
 *     elif c_domain == xmlerror.XML_FROM_RELAXNGV:             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
 */
    break;
    default: break;
  }

  /* "src/lxml/xmlerror.pxi":693
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
 *     if log is None or error_func is NULL:             # <<<<<<<<<<<<<<
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 */
  __pyx_t_2 = (__pyx_v_log == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_error_func == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":694
 * 
 *     if log is None or error_func is NULL:
 *         c_log = NULL             # <<<<<<<<<<<<<<
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)
 */
    __pyx_v_c_log = NULL;

    /* "src/lxml/xmlerror.pxi":695
 *     if log is None or error_func is NULL:
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc             # <<<<<<<<<<<<<<
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)
 * 
 */
    __pyx_v_error_func = ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__nullGenericErrorFunc);

    /* "src/lxml/xmlerror.pxi":693
 *         error_func = <xmlerror.xmlGenericErrorFunc>_receiveRelaxNGValidationError
 * 
 *     if log is None or error_func is NULL:             # <<<<<<<<<<<<<<
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 */
  }

  /* "src/lxml/xmlerror.pxi":696
 *         c_log = NULL
 *         error_func = <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc
 *     xmlerror.xmlSetGenericErrorFunc(c_log, error_func)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xmlSetGenericErrorFunc(__pyx_v_c_log, __pyx_v_error_func);

  /* "src/lxml/xmlerror.pxi":683
 * 
 * 
 * cdef void _connectGenericErrorLog(log, int c_domain=-1) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlGenericErrorFunc error_func = NULL
 *     c_log = <void*>log
 */

  /* function exit code */
}

/* "src/lxml/xmlerror.pxi":699
 * 
 * 
 * cdef void _receiveGenericError(void* c_log_handler, int c_domain,             # <<<<<<<<<<<<<<
 *                                char* msg, cvarargs.va_list args) noexcept nogil:
 *     # no Python objects here, may be called without thread context !
 */

static void __pyx_f_4lxml_5etree__receiveGenericError(void *__pyx_v_c_log_handler, int __pyx_v_c_domain, char *__pyx_v_msg, va_list __pyx_v_args) {
  xmlError __pyx_v_c_error;
  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;

  /* "src/lxml/xmlerror.pxi":710
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":711
 *     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;

    /* "src/lxml/xmlerror.pxi":710
 *     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':
 */
  }

  /* "src/lxml/xmlerror.pxi":712
 *     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':

    /* "src/lxml/xmlerror.pxi":713
 *         return
 *     if msg[0] in b'\n\0':
 *         return             # <<<<<<<<<<<<<<
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL
 */
    goto __pyx_L0;

    /* "src/lxml/xmlerror.pxi":712
 *     if not __DEBUG or msg is NULL:
 *         return
 *     if msg[0] in b'\n\0':             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    break;
    default: break;
  }

  /* "src/lxml/xmlerror.pxi":715
 *         return
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL             # <<<<<<<<<<<<<<
 *     c_error.line = 0
 * 
 */
  __pyx_v_c_text = NULL;
  __pyx_v_c_element = NULL;
  __pyx_v_c_error.file = NULL;
  __pyx_v_c_error.node = NULL;

  /* "src/lxml/xmlerror.pxi":716
 * 
 *     c_text = c_element = c_error.file = c_error.node = NULL
 *     c_error.line = 0             # <<<<<<<<<<<<<<
 * 
 *     # parse "NAME %s" chunks from the format string
 */
  __pyx_v_c_error.line = 0;

  /* "src/lxml/xmlerror.pxi":719
 * 
 *     # parse "NAME %s" chunks from the format string
 *     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;

  /* "src/lxml/xmlerror.pxi":720
 *     # parse "NAME %s" chunks from the format string
 *     c_name_pos = c_pos = msg
 *     format_count = 0             # <<<<<<<<<<<<<<
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':
 */
  __pyx_v_format_count = 0;

  /* "src/lxml/xmlerror.pxi":721
 *     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;

    /* "src/lxml/xmlerror.pxi":722
 *     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]) == '%');
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":723
 *     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);

      /* "src/lxml/xmlerror.pxi":724
 *         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');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":725
 *             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);

        /* "src/lxml/xmlerror.pxi":726
 *             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);

        /* "src/lxml/xmlerror.pxi":727
 *                 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));
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":728
 *                 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) == 0:
 */
          __pyx_v_c_text = __pyx_v_c_str;

          /* "src/lxml/xmlerror.pxi":727
 *                 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':
 */
          goto __pyx_L8;
        }

        /* "src/lxml/xmlerror.pxi":729
 *                 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) == 0:
 *                         c_element = c_str
 */
        __pyx_t_1 = ((__pyx_v_c_name_pos[0]) == 'e');
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":730
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:             # <<<<<<<<<<<<<<
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 */
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, ((char const *)"element %s"), 10) == 0);
          if (__pyx_t_1) {

            /* "src/lxml/xmlerror.pxi":731
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str             # <<<<<<<<<<<<<<
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 */
            __pyx_v_c_element = __pyx_v_c_str;

            /* "src/lxml/xmlerror.pxi":730
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:             # <<<<<<<<<<<<<<
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 */
          }

          /* "src/lxml/xmlerror.pxi":729
 *                 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) == 0:
 *                         c_element = c_str
 */
          goto __pyx_L8;
        }

        /* "src/lxml/xmlerror.pxi":732
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 */
        __pyx_t_1 = ((__pyx_v_c_name_pos[0]) == 'f');
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":733
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:             # <<<<<<<<<<<<<<
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:
 */
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, ((char const *)"file %s"), 7) == 0);
          if (__pyx_t_1) {

            /* "src/lxml/xmlerror.pxi":735
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:             # <<<<<<<<<<<<<<
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 */
            __pyx_t_1 = (strncmp(((char const *)"string://__STRING__XSLT"), __pyx_v_c_str, 23) == 0);

            /* "src/lxml/xmlerror.pxi":734
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',             # <<<<<<<<<<<<<<
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'
 */
            if (__pyx_t_1) {

              /* "src/lxml/xmlerror.pxi":736
 *                         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 = ((char *)"<xslt>");

              /* "src/lxml/xmlerror.pxi":734
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',             # <<<<<<<<<<<<<<
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'
 */
            }

            /* "src/lxml/xmlerror.pxi":737
 *                                              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;

            /* "src/lxml/xmlerror.pxi":733
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:             # <<<<<<<<<<<<<<
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:
 */
          }

          /* "src/lxml/xmlerror.pxi":732
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0:
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0:
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 */
        }
        __pyx_L8:;

        /* "src/lxml/xmlerror.pxi":724
 *         if c_pos[0] == b'%':
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)
 */
        goto __pyx_L7;
      }

      /* "src/lxml/xmlerror.pxi":738
 *                             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');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":739
 *                         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) == 0:
 */
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "src/lxml/xmlerror.pxi":740
 *             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) == 0:
 *                     c_error.line = c_int
 */
        __pyx_v_c_int = va_int(__pyx_v_args);

        /* "src/lxml/xmlerror.pxi":741
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:             # <<<<<<<<<<<<<<
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 */
        __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, ((char const *)"line %d"), 7) == 0);
        if (__pyx_t_1) {

          /* "src/lxml/xmlerror.pxi":742
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:
 *                     c_error.line = c_int             # <<<<<<<<<<<<<<
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1
 */
          __pyx_v_c_error.line = __pyx_v_c_int;

          /* "src/lxml/xmlerror.pxi":741
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:             # <<<<<<<<<<<<<<
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 */
        }

        /* "src/lxml/xmlerror.pxi":738
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
 */
        goto __pyx_L7;
      }

      /* "src/lxml/xmlerror.pxi":743
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:
 *                     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]) != '%');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":744
 *                     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);

        /* "src/lxml/xmlerror.pxi":745
 *             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;

        /* "src/lxml/xmlerror.pxi":743
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0:
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
 */
      }
      __pyx_L7:;

      /* "src/lxml/xmlerror.pxi":722
 *     format_count = 0
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':             # <<<<<<<<<<<<<<
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
 */
      goto __pyx_L6;
    }

    /* "src/lxml/xmlerror.pxi":746
 *                 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]) == ' ');
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":747
 *                 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]) != '%');
      if (__pyx_t_1) {

        /* "src/lxml/xmlerror.pxi":748
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1             # <<<<<<<<<<<<<<
 *         c_pos += 1
 * 
 */
        __pyx_v_c_name_pos = (__pyx_v_c_pos + 1);

        /* "src/lxml/xmlerror.pxi":747
 *                 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
 */
      }

      /* "src/lxml/xmlerror.pxi":746
 *                 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_L6:;

    /* "src/lxml/xmlerror.pxi":749
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1             # <<<<<<<<<<<<<<
 * 
 *     c_message = NULL
 */
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);
  }
  __pyx_L5_break:;

  /* "src/lxml/xmlerror.pxi":751
 *         c_pos += 1
 * 
 *     c_message = NULL             # <<<<<<<<<<<<<<
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:
 */
  __pyx_v_c_message = NULL;

  /* "src/lxml/xmlerror.pxi":752
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":753
 *     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_2 = (__pyx_v_c_element != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_format_count == 1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":755
 *         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);

      /* "src/lxml/xmlerror.pxi":756
 *             # 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);

      /* "src/lxml/xmlerror.pxi":757
 *             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)))));

      /* "src/lxml/xmlerror.pxi":759
 *             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:
 */
      (void)(sprintf(__pyx_v_c_message, __pyx_v_msg, __pyx_v_c_element));

      /* "src/lxml/xmlerror.pxi":760
 *                 (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;

      /* "src/lxml/xmlerror.pxi":753
 *     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)
 */
      goto __pyx_L15;
    }

    /* "src/lxml/xmlerror.pxi":762
 *             c_error.message = c_message
 *         else:
 *             c_error.message = ''             # <<<<<<<<<<<<<<
 *     elif c_element is NULL:
 *         c_error.message = c_text
 */
    /*else*/ {
      __pyx_v_c_error.message = ((char *)"");
    }
    __pyx_L15:;

    /* "src/lxml/xmlerror.pxi":752
 * 
 *     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'
 */
    goto __pyx_L14;
  }

  /* "src/lxml/xmlerror.pxi":763
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_element == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":764
 *             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;

    /* "src/lxml/xmlerror.pxi":763
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
 */
    goto __pyx_L14;
  }

  /* "src/lxml/xmlerror.pxi":766
 *         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(
 */
  /*else*/ {
    __pyx_v_text_size = strlen(__pyx_v_c_text);

    /* "src/lxml/xmlerror.pxi":767
 *     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);

    /* "src/lxml/xmlerror.pxi":768
 *         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))
 *         if c_message is NULL:
 */
    __pyx_v_c_message = ((char *)malloc(((((__pyx_v_text_size + 12) + __pyx_v_element_size) + 1) * (sizeof(char)))));

    /* "src/lxml/xmlerror.pxi":770
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:             # <<<<<<<<<<<<<<
 *             c_error.message = c_text
 *         else:
 */
    __pyx_t_1 = (__pyx_v_c_message == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xmlerror.pxi":771
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:
 *             c_error.message = c_text             # <<<<<<<<<<<<<<
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 */
      __pyx_v_c_error.message = __pyx_v_c_text;

      /* "src/lxml/xmlerror.pxi":770
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         if c_message is NULL:             # <<<<<<<<<<<<<<
 *             c_error.message = c_text
 *         else:
 */
      goto __pyx_L18;
    }

    /* "src/lxml/xmlerror.pxi":773
 *             c_error.message = c_text
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)             # <<<<<<<<<<<<<<
 *             c_error.message = c_message
 * 
 */
    /*else*/ {
      (void)(sprintf(__pyx_v_c_message, ((char const *)"%s, element '%s'"), __pyx_v_c_text, __pyx_v_c_element));

      /* "src/lxml/xmlerror.pxi":774
 *         else:
 *             stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 *             c_error.message = c_message             # <<<<<<<<<<<<<<
 * 
 *     c_error.domain = c_domain
 */
      __pyx_v_c_error.message = __pyx_v_c_message;
    }
    __pyx_L18:;
  }
  __pyx_L14:;

  /* "src/lxml/xmlerror.pxi":776
 *             c_error.message = c_message
 * 
 *     c_error.domain = c_domain             # <<<<<<<<<<<<<<
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 */
  __pyx_v_c_error.domain = __pyx_v_c_domain;

  /* "src/lxml/xmlerror.pxi":777
 * 
 *     c_error.domain = c_domain
 *     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;

  /* "src/lxml/xmlerror.pxi":778
 *     c_error.domain = c_domain
 *     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;

  /* "src/lxml/xmlerror.pxi":779
 *     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;

  /* "src/lxml/xmlerror.pxi":781
 *     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));

  /* "src/lxml/xmlerror.pxi":783
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_message)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_message != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlerror.pxi":784
 * 
 *     if c_message is not NULL:
 *         stdlib.free(c_message)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
    free(__pyx_v_c_message);

    /* "src/lxml/xmlerror.pxi":783
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_message)
 * 
 */
  }

  /* "src/lxml/xmlerror.pxi":699
 * 
 * 
 * cdef void _receiveGenericError(void* c_log_handler, int c_domain,             # <<<<<<<<<<<<<<
 *                                char* msg, cvarargs.va_list args) noexcept nogil:
 *     # no Python objects here, may be called without thread context !
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xmlerror.pxi":790
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     "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_const_defs = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_v_constants = NULL;
  PyObject *__pyx_v_reverse_dict = NULL;
  PyObject *__pyx_v_line = 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;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  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", 1);

  /* "src/lxml/xmlerror.pxi":793
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 793, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_4lxml_5etree___ERROR_LEVELS)) __PYX_ERR(1, 793, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":794
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),             # <<<<<<<<<<<<<<
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_4lxml_5etree___ERROR_DOMAINS)) __PYX_ERR(1, 794, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":795
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),             # <<<<<<<<<<<<<<
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES)) __PYX_ERR(1, 795, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":796
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))             # <<<<<<<<<<<<<<
 * 
 *     for cls, constants in const_defs:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RelaxNGErrorTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 796, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES)) __PYX_ERR(1, 796, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":793
 *     "Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(1, 793, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 793, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 793, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5)) __PYX_ERR(1, 793, __pyx_L1_error);
  __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;

  /* "src/lxml/xmlerror.pxi":798
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
 *     for cls, constants 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 (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 798, __pyx_L1_error)
      #endif
      if (__pyx_t_6 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(1, 798, __pyx_L1_error)
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 798, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __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_ERR(1, 798, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 798, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_cls, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_constants, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":799
 * 
 *     for cls, constants in const_defs:
 *         reverse_dict = {}             # <<<<<<<<<<<<<<
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 */
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_reverse_dict, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":800
 *     for cls, constants in const_defs:
 *         reverse_dict = {}
 *         cls._names   = reverse_dict             # <<<<<<<<<<<<<<
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_names, __pyx_v_reverse_dict) < 0) __PYX_ERR(1, 800, __pyx_L1_error)

    /* "src/lxml/xmlerror.pxi":801
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get             # <<<<<<<<<<<<<<
 *         for line in constants.splitlines():
 *             if not line:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse_dict, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_getName, __pyx_t_5) < 0) __PYX_ERR(1, 801, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/xmlerror.pxi":802
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():             # <<<<<<<<<<<<<<
 *             if not line:
 *                 continue
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_constants, __pyx_n_s_splitlines); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 802, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 802, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 802, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 802, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 802, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 802, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 802, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 802, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/xmlerror.pxi":803
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
 *             if not line:             # <<<<<<<<<<<<<<
 *                 continue
 *             name, value = line.split('=')
 */
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(1, 803, __pyx_L1_error)
      __pyx_t_11 = (!__pyx_t_10);
      if (__pyx_t_11) {

        /* "src/lxml/xmlerror.pxi":804
 *         for line in constants.splitlines():
 *             if not line:
 *                 continue             # <<<<<<<<<<<<<<
 *             name, value = line.split('=')
 *             value = int(value)
 */
        goto __pyx_L5_continue;

        /* "src/lxml/xmlerror.pxi":803
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():
 *             if not line:             # <<<<<<<<<<<<<<
 *                 continue
 *             name, value = line.split('=')
 */
      }

      /* "src/lxml/xmlerror.pxi":805
 *             if not line:
 *                 continue
 *             name, value = line.split('=')             # <<<<<<<<<<<<<<
 *             value = int(value)
 *             setattr(cls, name, value)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__24};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 805, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 805, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        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_ERR(1, 805, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 805, __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_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 805, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
        index = 0; __pyx_t_4 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_2 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) __PYX_ERR(1, 805, __pyx_L1_error)
        __pyx_t_13 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 805, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlerror.pxi":806
 *                 continue
 *             name, value = line.split('=')
 *             value = int(value)             # <<<<<<<<<<<<<<
 *             setattr(cls, name, value)
 *             reverse_dict[value] = name
 */
      __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/xmlerror.pxi":807
 *             name, value = line.split('=')
 *             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 == ((int)-1))) __PYX_ERR(1, 807, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":808
 *             value = int(value)
 *             setattr(cls, name, value)
 *             reverse_dict[value] = name             # <<<<<<<<<<<<<<
 * 
 *     # discard the global string references after use
 */
      if (unlikely((PyDict_SetItem(__pyx_v_reverse_dict, __pyx_v_value, __pyx_v_name) < 0))) __PYX_ERR(1, 808, __pyx_L1_error)

      /* "src/lxml/xmlerror.pxi":802
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for line in constants.splitlines():             # <<<<<<<<<<<<<<
 *             if not line:
 *                 continue
 */
      __pyx_L5_continue:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xmlerror.pxi":798
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 * 
 *     for cls, constants in const_defs:             # <<<<<<<<<<<<<<
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xmlerror.pxi":811
 * 
 *     # discard the global string 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);

  /* "src/lxml/xmlerror.pxi":790
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     "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_12);
  __Pyx_AddTraceback("lxml.etree.__initErrorConstants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_const_defs);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XDECREF(__pyx_v_constants);
  __Pyx_XDECREF(__pyx_v_reverse_dict);
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":380
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "lxml/etree.pyx":384
 *         # 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);

  /* "lxml/etree.pyx":380
 *     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 */
}

/* "lxml/etree.pyx":387
 * 
 *     @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", 1);

  /* "lxml/etree.pyx":390
 *         # 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);

  /* "lxml/etree.pyx":391
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":392
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":391
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self, c_node)
 */
  }

  /* "lxml/etree.pyx":393
 *         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_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":387
 * 
 *     @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;
}

/* "lxml/etree.pyx":396
 * 
 *     @cython.final
 *     cdef bint hasdoctype(self) noexcept:             # <<<<<<<<<<<<<<
 *         # 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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":398
 *     cdef bint hasdoctype(self) noexcept:
 *         # 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_2 = (__pyx_v_self->_c_doc != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_c_doc->intSubset != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":396
 * 
 *     @cython.final
 *     cdef bint hasdoctype(self) noexcept:             # <<<<<<<<<<<<<<
 *         # 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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":401
 * 
 *     @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", 1);

  /* "lxml/etree.pyx":405
 *         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 = ((PyObject*)Py_None);

  /* "lxml/etree.pyx":406
 *         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 = ((PyObject*)Py_None);

  /* "lxml/etree.pyx":407
 *         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;

  /* "lxml/etree.pyx":408
 *         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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":409
 *         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);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":410
 *         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_ERR(0, 410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":409
 *         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:
 */
    }

    /* "lxml/etree.pyx":411
 *             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);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":412
 *                 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_ERR(0, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":411
 *             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
 */
    }

    /* "lxml/etree.pyx":408
 *         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)
 */
  }

  /* "lxml/etree.pyx":413
 *             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;

  /* "lxml/etree.pyx":414
 *                 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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":415
 *         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_4 = (__pyx_v_public_id != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_public_id) != 0);
    __pyx_t_5 = (!__pyx_t_4);
    if (__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_c_dtd->ExternalID != NULL);
    __pyx_t_2 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":416
 *         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_ERR(0, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":415
 *         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:
 */
    }

    /* "lxml/etree.pyx":417
 *             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_v_sys_url != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_sys_url) != 0);
    __pyx_t_4 = (!__pyx_t_5);
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_dtd->SystemID != NULL);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":418
 *                 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_ERR(0, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":417
 *             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)
 */
    }

    /* "lxml/etree.pyx":414
 *                 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)
 */
  }

  /* "lxml/etree.pyx":419
 *             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);

  /* "lxml/etree.pyx":420
 *                 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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":421
 *         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 = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":420
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:             # <<<<<<<<<<<<<<
 *             root_name = None
 *         else:
 */
    goto __pyx_L13;
  }

  /* "lxml/etree.pyx":423
 *             root_name = None
 *         else:
 *             root_name = funicode(c_root_node.name)             # <<<<<<<<<<<<<<
 *         return root_name, public_id, sys_url
 * 
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_root_node->name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_root_name = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L13:;

  /* "lxml/etree.pyx":424
 *         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_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_root_name);
  __Pyx_GIVEREF(__pyx_v_root_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_root_name)) __PYX_ERR(0, 424, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_public_id)) __PYX_ERR(0, 424, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_sys_url);
  __Pyx_GIVEREF(__pyx_v_sys_url);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_sys_url)) __PYX_ERR(0, 424, __pyx_L1_error);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":401
 * 
 *     @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;
}

/* "lxml/etree.pyx":427
 * 
 *     @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", 1);

  /* "lxml/etree.pyx":429
 *     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;

  /* "lxml/etree.pyx":430
 *         # 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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":431
 *         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 = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":430
 *         # 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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":433
 *             version = None
 *         else:
 *             version = funicode(c_doc.version)             # <<<<<<<<<<<<<<
 *         if c_doc.encoding is NULL:
 *             encoding = None
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_version = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":434
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_c_doc->encoding == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":435
 *             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 = ((PyObject*)Py_None);

    /* "lxml/etree.pyx":434
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":437
 *             encoding = None
 *         else:
 *             encoding = funicode(c_doc.encoding)             # <<<<<<<<<<<<<<
 *         return version, encoding
 * 
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_encoding = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":438
 *         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_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_version);
  __Pyx_GIVEREF(__pyx_v_version);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_version)) __PYX_ERR(0, 438, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_encoding)) __PYX_ERR(0, 438, __pyx_L1_error);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":427
 * 
 *     @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;
}

/* "lxml/etree.pyx":441
 * 
 *     @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", 1);

  /* "lxml/etree.pyx":444
 *         # 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 == -1L);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":445
 *         # 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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":444
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  }

  /* "lxml/etree.pyx":447
 *             return None
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_self->_c_doc->standalone == 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":441
 * 
 *     @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;
}

/* "lxml/etree.pyx":450
 * 
 *     @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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("buildNewPrefix", 1);

  /* "lxml/etree.pyx":453
 *         # 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_ERR(0, 453, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_v_self->_ns_counter < __pyx_t_2);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":454
 *         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_ERR(0, 454, __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)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(0, 454, __pyx_L1_error)
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":453
 *         # 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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":456
 *             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
 */
  /*else*/ {
    __pyx_t_1 = PyBytes_FromFormat(((char *)"ns%d"), __pyx_v_self->_ns_counter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":457
 *         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));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":458
 *             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_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":457
 *         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
 */
  }

  /* "lxml/etree.pyx":459
 *         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);

  /* "lxml/etree.pyx":460
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
 */
  __pyx_t_3 = (__pyx_v_self->_ns_counter < 0);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":462
 *         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;

    /* "lxml/etree.pyx":463
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
 */
    __pyx_t_3 = (__pyx_v_self->_prefix_tail == ((PyObject*)Py_None));
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":464
 *             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;

      /* "lxml/etree.pyx":463
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
 */
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":466
 *                 self._prefix_tail = b"A"
 *             else:
 *                 self._prefix_tail += b"A"             # <<<<<<<<<<<<<<
 *         return ns
 * 
 */
    /*else*/ {
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_self->_prefix_tail, __pyx_n_b_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __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:;

    /* "lxml/etree.pyx":460
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
 */
  }

  /* "lxml/etree.pyx":467
 *             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;

  /* "lxml/etree.pyx":450
 * 
 *     @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;
}

/* "lxml/etree.pyx":470
 * 
 *     @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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __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("_findOrBuildNodeNs", 1);

  /* "lxml/etree.pyx":479
 *         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, \
 *                 "invalid node type %d, expected %d" % (
 */
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":480
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \             # <<<<<<<<<<<<<<
 *                 "invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
      if (unlikely(!__pyx_t_1)) {

        /* "lxml/etree.pyx":481
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (             # <<<<<<<<<<<<<<
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 */
        __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = 0;
        __pyx_t_4 = 127;
        __Pyx_INCREF(__pyx_kp_u_invalid_node_type);
        __pyx_t_3 += 18;
        __Pyx_GIVEREF(__pyx_kp_u_invalid_node_type);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_invalid_node_type);

        /* "lxml/etree.pyx":482
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "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_5 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
        __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected);
        __pyx_t_3 += 11;
        __Pyx_GIVEREF(__pyx_kp_u_expected);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_expected);
        __pyx_t_5 = __Pyx_PyUnicode_From_xmlElementType(XML_ELEMENT_NODE, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
        __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":481
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 "invalid node type %d, expected %d" % (             # <<<<<<<<<<<<<<
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 */
        __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 480, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 480, __pyx_L1_error)
    #endif

    /* "lxml/etree.pyx":479
 *         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, \
 *                 "invalid node type %d, expected %d" % (
 */
  }

  /* "lxml/etree.pyx":484
 *                 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);

  /* "lxml/etree.pyx":485
 *         # 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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":486
 *         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) {
    } else {
      __pyx_t_1 = __pyx_v_is_attribute;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_c_ns->prefix == NULL);
    __pyx_t_1 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_1) {
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":491
 *                 pass
 *             else:
 *                 return c_ns             # <<<<<<<<<<<<<<
 * 
 *         # none found => determine a suitable new prefix
 */
    /*else*/ {
      __pyx_r = __pyx_v_c_ns;
      goto __pyx_L0;
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":485
 *         # 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
 */
  }

  /* "lxml/etree.pyx":494
 * 
 *         # 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_1 = (__pyx_v_c_prefix == NULL);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":496
 *         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_5 = __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "lxml/etree.pyx":495
 *         # 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_5, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":497
 *             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_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":498
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self.buildNewPrefix()
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_prefix = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":497
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 prefix = <object>dict_result
 *             else:
 */
      goto __pyx_L9;
    }

    /* "lxml/etree.pyx":500
 *                 prefix = <object>dict_result
 *             else:
 *                 prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix)
 * 
 */
    /*else*/ {
      __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_prefix = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L9:;

    /* "lxml/etree.pyx":501
 *             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);

    /* "lxml/etree.pyx":494
 * 
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 */
  }

  /* "lxml/etree.pyx":504
 * 
 *         # 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_1 = (xmlSearchNs(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix) != NULL);
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":505
 *         # 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_2 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":506
 *         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);
  }

  /* "lxml/etree.pyx":509
 * 
 *         # 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);

  /* "lxml/etree.pyx":510
 *         # 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_1 = (__pyx_v_c_ns == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":511
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return c_ns
 * 
 */
    PyErr_NoMemory(); __PYX_ERR(0, 511, __pyx_L1_error)

    /* "lxml/etree.pyx":510
 *         # 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
 */
  }

  /* "lxml/etree.pyx":512
 *         if c_ns is NULL:
 *             raise MemoryError()
 *         return c_ns             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = __pyx_v_c_ns;
  goto __pyx_L0;

  /* "lxml/etree.pyx":470
 * 
 *     @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_5);
  __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;
}

/* "lxml/etree.pyx":515
 * 
 *     @cython.final
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:             # <<<<<<<<<<<<<<
 *         "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;
  xmlNs *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":517
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:
 *         "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 == ((xmlNs *)NULL))) __PYX_ERR(0, 517, __pyx_L1_error)
  __pyx_v_c_ns = __pyx_t_1;

  /* "lxml/etree.pyx":518
 *         "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);

  /* "lxml/etree.pyx":515
 * 
 *     @cython.final
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:             # <<<<<<<<<<<<<<
 *         "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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":520
 *         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_8genexpr7__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", 1);

  /* "lxml/etree.pyx":522
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(30) ])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":523
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
 *                    for i in range(30) ])             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()
 */
    for (__pyx_t_2 = 0; __pyx_t_2 < 30; __pyx_t_2+=1) {
      __pyx_8genexpr7__pyx_v_i = __pyx_t_2;

      /* "lxml/etree.pyx":522
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(30) ])
 * 
 */
      __pyx_t_3 = PyBytes_FromFormat(((char *)"ns%d"), __pyx_8genexpr7__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 522, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  } /* exit inner scope */
  __pyx_t_3 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __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;

  /* "lxml/etree.pyx":520
 *         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;
}

/* "lxml/etree.pyx":527
 * 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_documentFactory", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":529
 * 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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__Document(((PyTypeObject *)__pyx_ptype_4lxml_5etree__Document), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_result = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":530
 *     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;

  /* "lxml/etree.pyx":531
 *     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;

  /* "lxml/etree.pyx":532
 *     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);

  /* "lxml/etree.pyx":533
 *     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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":534
 *     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_ERR(0, 534, __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;

    /* "lxml/etree.pyx":533
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 */
  }

  /* "lxml/etree.pyx":535
 *     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((PyObject *)__pyx_v_result->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_parser);
  __pyx_v_result->_parser = __pyx_v_parser;

  /* "lxml/etree.pyx":536
 *         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;

  /* "lxml/etree.pyx":527
 * 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;
}

/* "lxml/etree.pyx":546
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 546, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_tree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 546, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "lxml/etree.pyx":548
 *     def __cinit__(self, tree):
 *         "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_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":549
 *         "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, "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_ERR(0, 549, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 549, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __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_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    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_ERR(0, 549, __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_ERR(0, 549, __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;

  /* "lxml/etree.pyx":550
 *         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, "Could not find root node"
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_root_name); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_t_9 = (!__pyx_t_8);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 550, __pyx_L1_error)
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "lxml/etree.pyx":551
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, "Could not find root node"             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Could_not_find_root_node, 0, 0);
    __PYX_ERR(0, 551, __pyx_L1_error)

    /* "lxml/etree.pyx":550
 *         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, "Could not find root node"
 * 
 */
  }

  /* "lxml/etree.pyx":546
 *     "Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":553
 *             raise ValueError, "Could not find root node"
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":556
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 *         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_ERR(0, 556, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 556, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __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_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    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_ERR(0, 556, __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_ERR(0, 556, __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;

  /* "lxml/etree.pyx":557
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         return root_name             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_root_name);
  __pyx_r = __pyx_v_root_name;
  goto __pyx_L0;

  /* "lxml/etree.pyx":553
 *             raise ValueError, "Could not find root node"
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def root_name(self):
 *         """Returns the name of the root node as defined by the DOCTYPE."""
 */

  /* 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;
}

/* "lxml/etree.pyx":560
 * 
 *     @cython.final
 *     cdef tree.xmlDtd* _get_c_dtd(self):             # <<<<<<<<<<<<<<
 *         """"Return the DTD. Create it if it does not yet exist."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */

static xmlDtd *__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_root_node;
  const xmlChar *__pyx_v_c_name;
  xmlDtd *__pyx_r;
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  const xmlChar *__pyx_t_3;

  /* "lxml/etree.pyx":562
 *     cdef tree.xmlDtd* _get_c_dtd(self):
 *         """"Return the DTD. Create it if it does not yet exist."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_root_node
 *         cdef const_xmlChar* c_name
 */
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "lxml/etree.pyx":566
 *         cdef const_xmlChar* c_name
 * 
 *         if c_doc.intSubset:             # <<<<<<<<<<<<<<
 *             return c_doc.intSubset
 * 
 */
  __pyx_t_2 = (__pyx_v_c_doc->intSubset != 0);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":567
 * 
 *         if c_doc.intSubset:
 *             return c_doc.intSubset             # <<<<<<<<<<<<<<
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
 */
    __pyx_r = __pyx_v_c_doc->intSubset;
    goto __pyx_L0;

    /* "lxml/etree.pyx":566
 *         cdef const_xmlChar* c_name
 * 
 *         if c_doc.intSubset:             # <<<<<<<<<<<<<<
 *             return c_doc.intSubset
 * 
 */
  }

  /* "lxml/etree.pyx":569
 *             return c_doc.intSubset
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 *         c_name = c_root_node.name if c_root_node else NULL
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 */
  __pyx_v_c_root_node = xmlDocGetRootElement(__pyx_v_c_doc);

  /* "lxml/etree.pyx":570
 * 
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
 *         c_name = c_root_node.name if c_root_node else NULL             # <<<<<<<<<<<<<<
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_root_node != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_c_root_node->name;
  } else {
    __pyx_t_3 = NULL;
  }
  __pyx_v_c_name = __pyx_t_3;

  /* "lxml/etree.pyx":571
 *         c_root_node = tree.xmlDocGetRootElement(c_doc)
 *         c_name = c_root_node.name if c_root_node else NULL
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __pyx_r = xmlCreateIntSubset(__pyx_v_c_doc, __pyx_v_c_name, NULL, NULL);
  goto __pyx_L0;

  /* "lxml/etree.pyx":560
 * 
 *     @cython.final
 *     cdef tree.xmlDtd* _get_c_dtd(self):             # <<<<<<<<<<<<<<
 *         """"Return the DTD. Create it if it does not yet exist."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":573
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_7DocInfo_2clear, "Removes DOCTYPE and internal subset from the document.");
static PyMethodDef __pyx_mdef_4lxml_5etree_7DocInfo_3clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7DocInfo_3clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7DocInfo_2clear};
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_2clear(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_2clear(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_dtd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("clear", 1);

  /* "lxml/etree.pyx":575
 *     def clear(self):
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:
 */
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "lxml/etree.pyx":576
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is NULL:
 *             return
 */
  __pyx_v_c_dtd = ((xmlNode *)__pyx_v_c_doc->intSubset);

  /* "lxml/etree.pyx":577
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
 */
  __pyx_t_2 = (__pyx_v_c_dtd == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":578
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_dtd)
 *         tree.xmlFreeNode(c_dtd)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":577
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 *         cdef tree.xmlNode* c_dtd = <xmlNode*>c_doc.intSubset
 *         if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
 */
  }

  /* "lxml/etree.pyx":579
 *         if c_dtd is NULL:
 *             return
 *         tree.xmlUnlinkNode(c_dtd)             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_dtd)
 * 
 */
  xmlUnlinkNode(__pyx_v_c_dtd);

  /* "lxml/etree.pyx":580
 *             return
 *         tree.xmlUnlinkNode(c_dtd)
 *         tree.xmlFreeNode(c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     property public_id:
 */
  xmlFreeNode(__pyx_v_c_dtd);

  /* "lxml/etree.pyx":573
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */

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

/* "lxml/etree.pyx":588
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":589
 *         """
 *         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_ERR(0, 589, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 589, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __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_ERR(0, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    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_ERR(0, 589, __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_ERR(0, 589, __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;

  /* "lxml/etree.pyx":590
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_public_id);
  __pyx_r = __pyx_v_public_id;
  goto __pyx_L0;

  /* "lxml/etree.pyx":588
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         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;
}

/* "lxml/etree.pyx":592
 *             return public_id
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_7DocInfo_9public_id_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value) {
  xmlChar *__pyx_v_c_value;
  PyObject *__pyx_v_match = NULL;
  xmlDtd *__pyx_v_c_dtd;
  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;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  xmlDtd *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":593
 * 
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL             # <<<<<<<<<<<<<<
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
 */
  __pyx_v_c_value = NULL;

  /* "lxml/etree.pyx":594
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
 */
  __pyx_t_1 = (__pyx_v_value != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":595
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)             # <<<<<<<<<<<<<<
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree__find_invalid_public_id_characters);
    __pyx_t_3 = __pyx_v_4lxml_5etree__find_invalid_public_id_characters; __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_v_match = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":596
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:             # <<<<<<<<<<<<<<
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_match); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 596, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":597
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'             # <<<<<<<<<<<<<<
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 */
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = 0;
      __pyx_t_7 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_character_s);
      __pyx_t_6 += 21;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_character_s);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Invalid_character_s);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_int_0};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_in_public_id);
      __pyx_t_6 += 14;
      __Pyx_GIVEREF(__pyx_kp_u_in_public_id);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_in_public_id);
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 597, __pyx_L1_error)

      /* "lxml/etree.pyx":596
 *             if value is not None:
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:             # <<<<<<<<<<<<<<
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
 */
    }

    /* "lxml/etree.pyx":598
 *                 if match:
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":599
 *                     raise ValueError, f'Invalid character(s) {match.group(0)!r} in public_id.'
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))             # <<<<<<<<<<<<<<
 *                 if not c_value:
 *                     raise MemoryError()
 */
    __pyx_v_c_value = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_value));

    /* "lxml/etree.pyx":600
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
 */
    __pyx_t_1 = (!(__pyx_v_c_value != 0));
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":601
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *             c_dtd = self._get_c_dtd()
 */
      PyErr_NoMemory(); __PYX_ERR(0, 601, __pyx_L1_error)

      /* "lxml/etree.pyx":600
 *                 value = _utf8(value)
 *                 c_value = tree.xmlStrdup(_xcstr(value))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
 */
    }

    /* "lxml/etree.pyx":594
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 match = _find_invalid_public_id_characters(value)
 *                 if match:
 */
  }

  /* "lxml/etree.pyx":603
 *                     raise MemoryError()
 * 
 *             c_dtd = self._get_c_dtd()             # <<<<<<<<<<<<<<
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 */
  __pyx_t_9 = __pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 603, __pyx_L1_error)
  __pyx_v_c_dtd = __pyx_t_9;

  /* "lxml/etree.pyx":604
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 */
  __pyx_t_1 = (!(__pyx_v_c_dtd != 0));
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":605
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:
 */
    xmlFree(__pyx_v_c_value);

    /* "lxml/etree.pyx":606
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 */
    PyErr_NoMemory(); __PYX_ERR(0, 606, __pyx_L1_error)

    /* "lxml/etree.pyx":604
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 */
  }

  /* "lxml/etree.pyx":607
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value
 */
  __pyx_t_1 = (__pyx_v_c_dtd->ExternalID != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":608
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             c_dtd.ExternalID = c_value
 * 
 */
    xmlFree(((void *)__pyx_v_c_dtd->ExternalID));

    /* "lxml/etree.pyx":607
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.ExternalID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value
 */
  }

  /* "lxml/etree.pyx":609
 *             if c_dtd.ExternalID:
 *                 tree.xmlFree(<void*>c_dtd.ExternalID)
 *             c_dtd.ExternalID = c_value             # <<<<<<<<<<<<<<
 * 
 *     property system_url:
 */
  __pyx_v_c_dtd->ExternalID = __pyx_v_c_value;

  /* "lxml/etree.pyx":592
 *             return public_id
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.DocInfo.public_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":617
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":618
 *         """
 *         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_ERR(0, 618, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 618, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __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_ERR(0, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    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_ERR(0, 618, __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_ERR(0, 618, __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;

  /* "lxml/etree.pyx":619
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_system_url);
  __pyx_r = __pyx_v_system_url;
  goto __pyx_L0;

  /* "lxml/etree.pyx":617
 *         exist, setting this variable (even to None) will create one.
 *         """
 *         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;
}

/* "lxml/etree.pyx":621
 *             return system_url
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_7DocInfo_10system_url_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_value) {
  xmlChar *__pyx_v_c_value;
  PyObject *__pyx_v_bvalue = NULL;
  xmlDtd *__pyx_v_c_dtd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDtd *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);

  /* "lxml/etree.pyx":622
 * 
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL             # <<<<<<<<<<<<<<
 *             if value is not None:
 *                 bvalue = _utf8(value)
 */
  __pyx_v_c_value = NULL;

  /* "lxml/etree.pyx":623
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 bvalue = _utf8(value)
 *                 # sys_url may be any valid unicode string that can be
 */
  __pyx_t_1 = (__pyx_v_value != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":624
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 *                 bvalue = _utf8(value)             # <<<<<<<<<<<<<<
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_bvalue = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":627
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
 */
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__25, __pyx_v_bvalue, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__26, __pyx_v_bvalue, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":628
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __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_ERR(0, 628, __pyx_L1_error)

      /* "lxml/etree.pyx":627
 *                 # sys_url may be any valid unicode string that can be
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
 */
    }

    /* "lxml/etree.pyx":630
 *                     raise ValueError(
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))             # <<<<<<<<<<<<<<
 *                 if not c_value:
 *                     raise MemoryError()
 */
    __pyx_v_c_value = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_bvalue));

    /* "lxml/etree.pyx":631
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
 */
    __pyx_t_1 = (!(__pyx_v_c_value != 0));
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":632
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *             c_dtd = self._get_c_dtd()
 */
      PyErr_NoMemory(); __PYX_ERR(0, 632, __pyx_L1_error)

      /* "lxml/etree.pyx":631
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 *                 if not c_value:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 * 
 */
    }

    /* "lxml/etree.pyx":623
 *         def __set__(self, value):
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 bvalue = _utf8(value)
 *                 # sys_url may be any valid unicode string that can be
 */
  }

  /* "lxml/etree.pyx":634
 *                     raise MemoryError()
 * 
 *             c_dtd = self._get_c_dtd()             # <<<<<<<<<<<<<<
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_7DocInfo__get_c_dtd(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 634, __pyx_L1_error)
  __pyx_v_c_dtd = __pyx_t_4;

  /* "lxml/etree.pyx":635
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 */
  __pyx_t_1 = (!(__pyx_v_c_dtd != 0));
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":636
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if c_dtd.SystemID:
 */
    xmlFree(__pyx_v_c_value);

    /* "lxml/etree.pyx":637
 *             if not c_dtd:
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 */
    PyErr_NoMemory(); __PYX_ERR(0, 637, __pyx_L1_error)

    /* "lxml/etree.pyx":635
 * 
 *             c_dtd = self._get_c_dtd()
 *             if not c_dtd:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 */
  }

  /* "lxml/etree.pyx":638
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.SystemID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value
 */
  __pyx_t_1 = (__pyx_v_c_dtd->SystemID != 0);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":639
 *                 raise MemoryError()
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *             c_dtd.SystemID = c_value
 * 
 */
    xmlFree(((void *)__pyx_v_c_dtd->SystemID));

    /* "lxml/etree.pyx":638
 *                 tree.xmlFree(c_value)
 *                 raise MemoryError()
 *             if c_dtd.SystemID:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value
 */
  }

  /* "lxml/etree.pyx":640
 *             if c_dtd.SystemID:
 *                 tree.xmlFree(<void*>c_dtd.SystemID)
 *             c_dtd.SystemID = c_value             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_v_c_dtd->SystemID = __pyx_v_c_value;

  /* "lxml/etree.pyx":621
 *             return system_url
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef xmlChar* c_value = NULL
 *             if value is not None:
 */

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

/* "lxml/etree.pyx":642
 *             c_dtd.SystemID = c_value
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":645
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
 *         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_ERR(0, 645, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 645, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __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_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    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_ERR(0, 645, __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_ERR(0, 645, __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;

  /* "lxml/etree.pyx":646
 *         """Returns the XML version as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()
 *         return xml_version             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xml_version);
  __pyx_r = __pyx_v_xml_version;
  goto __pyx_L0;

  /* "lxml/etree.pyx":642
 *             c_dtd.SystemID = c_value
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def xml_version(self):
 *         """Returns the XML version as declared by the document."""
 */

  /* 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;
}

/* "lxml/etree.pyx":648
 *         return xml_version
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":651
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
 *         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_ERR(0, 651, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 651, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __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_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    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_ERR(0, 651, __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_ERR(0, 651, __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;

  /* "lxml/etree.pyx":652
 *         """Returns the encoding name as declared by the document."""
 *         xml_version, encoding = self._doc.getxmlinfo()
 *         return encoding             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_encoding);
  __pyx_r = __pyx_v_encoding;
  goto __pyx_L0;

  /* "lxml/etree.pyx":648
 *         return xml_version
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def encoding(self):
 *         """Returns the encoding name as declared by the document."""
 */

  /* 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;
}

/* "lxml/etree.pyx":654
 *         return encoding
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def standalone(self):
 *         """Returns the standalone flag as declared by the document.  The possible
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":663
 *         ``standalone`` flag was set to ``'yes'`` or not.
 *         """
 *         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_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":654
 *         return encoding
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def standalone(self):
 *         """Returns the standalone flag as declared by the document.  The possible
 */

  /* 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;
}

/* "lxml/etree.pyx":667
 *     property URL:
 *         "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":668
 *         "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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":669
 *         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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":668
 *         "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)
 */
  }

  /* "lxml/etree.pyx":670
 *             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_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":667
 *     property URL:
 *         "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;
}

/* "lxml/etree.pyx":671
 *                 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "lxml/etree.pyx":672
 *             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_ERR(0, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":673
 *         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;

  /* "lxml/etree.pyx":674
 *             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);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":675
 *             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;

    /* "lxml/etree.pyx":674
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 self._doc._c_doc.URL = NULL
 *             else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":677
 *                 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)
 */
  /*else*/ {
    __pyx_v_self->_doc->_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_url));
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":678
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 */
  __pyx_t_3 = (__pyx_v_c_oldurl != NULL);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":679
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(<void*>c_oldurl)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    xmlFree(((void *)__pyx_v_c_oldurl));

    /* "lxml/etree.pyx":678
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 */
  }

  /* "lxml/etree.pyx":671
 *                 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;
}

/* "lxml/etree.pyx":681
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_v_quoted_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;
  Py_ssize_t __pyx_t_8;
  Py_UCS4 __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "lxml/etree.pyx":684
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         if system_url:
 *             # If '"' in system_url, we must escape it with single
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 684, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(0, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 684, __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_ERR(0, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    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_ERR(0, 684, __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_ERR(0, 684, __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;

  /* "lxml/etree.pyx":685
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if system_url:             # <<<<<<<<<<<<<<
 *             # If '"' in system_url, we must escape it with single
 *             # quotes, otherwise escape with double quotes. If url
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 685, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":690
 *             # contains both a single quote and a double quote, XML
 *             # standard is being violated.
 *             if '"' in system_url:             # <<<<<<<<<<<<<<
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
 */
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__26, __pyx_v_system_url, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 690, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "lxml/etree.pyx":691
 *             # standard is being violated.
 *             if '"' in system_url:
 *                 quoted_system_url = f"'{system_url}'"             # <<<<<<<<<<<<<<
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__25);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_system_url, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_quoted_system_url = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":690
 *             # contains both a single quote and a double quote, XML
 *             # standard is being violated.
 *             if '"' in system_url:             # <<<<<<<<<<<<<<
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
 */
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":693
 *                 quoted_system_url = f"'{system_url}'"
 *             else:
 *                 quoted_system_url = f'"{system_url}"'             # <<<<<<<<<<<<<<
 *         if public_id:
 *             if system_url:
 */
    /*else*/ {
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __Pyx_INCREF(__pyx_kp_u__26);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__26);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u__26);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_system_url, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u__26);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__26);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__26);
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_quoted_system_url = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "lxml/etree.pyx":685
 *         """Returns a DOCTYPE declaration string for the document."""
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if system_url:             # <<<<<<<<<<<<<<
 *             # If '"' in system_url, we must escape it with single
 *             # quotes, otherwise escape with double quotes. If url
 */
  }

  /* "lxml/etree.pyx":694
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:             # <<<<<<<<<<<<<<
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 694, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":695
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:
 *             if system_url:             # <<<<<<<<<<<<<<
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 695, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "lxml/etree.pyx":696
 *         if public_id:
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'             # <<<<<<<<<<<<<<
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __Pyx_INCREF(__pyx_kp_u_DOCTYPE);
      __pyx_t_8 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_DOCTYPE);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_DOCTYPE);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_PUBLIC);
      __pyx_t_8 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_PUBLIC);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_PUBLIC);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_public_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u__28);
      __pyx_t_8 += 2;
      __Pyx_GIVEREF(__pyx_kp_u__28);
      PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__28);
      if (unlikely(!__pyx_v_quoted_system_url)) { __Pyx_RaiseUnboundLocalError("quoted_system_url"); __PYX_ERR(0, 696, __pyx_L1_error) }
      __Pyx_INCREF(__pyx_v_quoted_system_url);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_quoted_system_url);
      __Pyx_GIVEREF(__pyx_v_quoted_system_url);
      PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_quoted_system_url);
      __Pyx_INCREF(__pyx_kp_u__29);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__29);
      PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__29);
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __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;

      /* "lxml/etree.pyx":695
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:
 *             if system_url:             # <<<<<<<<<<<<<<
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
 */
    }

    /* "lxml/etree.pyx":698
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'             # <<<<<<<<<<<<<<
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_9 = 127;
      __Pyx_INCREF(__pyx_kp_u_DOCTYPE);
      __pyx_t_8 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_DOCTYPE);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_DOCTYPE);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u_PUBLIC);
      __pyx_t_8 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_PUBLIC);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_PUBLIC);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_public_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_9;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u__30);
      __pyx_t_8 += 2;
      __Pyx_GIVEREF(__pyx_kp_u__30);
      PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__30);
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __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;
    }

    /* "lxml/etree.pyx":694
 *             else:
 *                 quoted_system_url = f'"{system_url}"'
 *         if public_id:             # <<<<<<<<<<<<<<
 *             if system_url:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}" {quoted_system_url}>'
 */
  }

  /* "lxml/etree.pyx":699
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 699, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":700
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'             # <<<<<<<<<<<<<<
 *         elif self._doc.hasdoctype():
 *             return f'<!DOCTYPE {root_name}>'
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = 0;
    __pyx_t_9 = 127;
    __Pyx_INCREF(__pyx_kp_u_DOCTYPE);
    __pyx_t_8 += 10;
    __Pyx_GIVEREF(__pyx_kp_u_DOCTYPE);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_DOCTYPE);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_kp_u_SYSTEM);
    __pyx_t_8 += 8;
    __Pyx_GIVEREF(__pyx_kp_u_SYSTEM);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_SYSTEM);
    if (unlikely(!__pyx_v_quoted_system_url)) { __Pyx_RaiseUnboundLocalError("quoted_system_url"); __PYX_ERR(0, 700, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_v_quoted_system_url);
    __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_quoted_system_url) : __pyx_t_9;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_quoted_system_url);
    __Pyx_GIVEREF(__pyx_v_quoted_system_url);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_quoted_system_url);
    __Pyx_INCREF(__pyx_kp_u__29);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__29);
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__29);
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __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;

    /* "lxml/etree.pyx":699
 *             else:
 *                 return f'<!DOCTYPE {root_name} PUBLIC "{public_id}">'
 *         elif system_url:             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
 */
  }

  /* "lxml/etree.pyx":701
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
 */
  __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document_hasdoctype(__pyx_v_self->_doc);
  if (__pyx_t_7) {

    /* "lxml/etree.pyx":702
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():
 *             return f'<!DOCTYPE {root_name}>'             # <<<<<<<<<<<<<<
 *         else:
 *             return ''
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = 127;
    __Pyx_INCREF(__pyx_kp_u_DOCTYPE);
    __pyx_t_8 += 10;
    __Pyx_GIVEREF(__pyx_kp_u_DOCTYPE);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_DOCTYPE);
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_root_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_9;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_kp_u__29);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__29);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__29);
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __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;

    /* "lxml/etree.pyx":701
 *         elif system_url:
 *             return f'<!DOCTYPE {root_name} SYSTEM {quoted_system_url}>'
 *         elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
 */
  }

  /* "lxml/etree.pyx":704
 *             return f'<!DOCTYPE {root_name}>'
 *         else:
 *             return ''             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_r = __pyx_kp_u__12;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":681
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def doctype(self):
 *         """Returns a DOCTYPE declaration string for the document."""
 */

  /* 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_XDECREF(__pyx_v_quoted_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":706
 *             return ''
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":709
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
 *         return _dtdFactory(self._doc._c_doc.intSubset)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":706
 *             return ''
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def internalDTD(self):
 *         """Returns a DTD validator based on the internal subset of the document."""
 */

  /* 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;
}

/* "lxml/etree.pyx":711
 *         return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":714
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
 *         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_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":711
 *         return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def externalDTD(self):
 *         """Returns a DTD validator based on the external subset of the document."""
 */

  /* 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;
}

/* "lxml/etree.pyx":730
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         """_init(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_1_init = {"_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_1_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element__init};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("_init", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "_init", 0))) return NULL;
  __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", 1);

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

/* "lxml/etree.pyx":737
 *         """
 * 
 *     @cython.linetrace(False)             # <<<<<<<<<<<<<<
 *     @cython.profile(False)
 *     def __dealloc__(self):
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":742
 *         #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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":743
 *         #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 == ((int)-1))) __PYX_ERR(0, 743, __pyx_L1_error)

    /* "lxml/etree.pyx":744
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
 */
    (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_self->_c_node));

    /* "lxml/etree.pyx":742
 *         #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)
 */
  }

  /* "lxml/etree.pyx":737
 *         """
 * 
 *     @cython.linetrace(False)             # <<<<<<<<<<<<<<
 *     @cython.profile(False)
 *     def __dealloc__(self):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._Element.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
}

/* "lxml/etree.pyx":748
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_4__setitem__, "__setitem__(self, x, value)\n\n        Replaces the given subelement index or slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  xmlDoc *__pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 1);

  /* "lxml/etree.pyx":753
 *         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;

  /* "lxml/etree.pyx":758
 *         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;

  /* "lxml/etree.pyx":759
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if value is None:
 *             raise ValueError, "cannot assign None"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 759, __pyx_L1_error)

  /* "lxml/etree.pyx":760
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":761
 *         _assertValidNode(self)
 *         if value is None:
 *             raise ValueError, "cannot assign None"             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slice assignment
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_cannot_assign_None, 0, 0);
    __PYX_ERR(0, 761, __pyx_L1_error)

    /* "lxml/etree.pyx":760
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):
 */
  }

  /* "lxml/etree.pyx":762
 *         if value is None:
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":764
 *         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 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error)

    /* "lxml/etree.pyx":765
 *             # 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);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":766
 *             _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;

      /* "lxml/etree.pyx":765
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 left_to_right = 1
 *             else:
 */
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":768
 *                 left_to_right = 1
 *             else:
 *                 left_to_right = 0             # <<<<<<<<<<<<<<
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 */
    /*else*/ {
      __pyx_v_left_to_right = 0;

      /* "lxml/etree.pyx":769
 *             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:;

    /* "lxml/etree.pyx":770
 *                 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 == ((int)-1))) __PYX_ERR(0, 770, __pyx_L1_error)

    /* "lxml/etree.pyx":771
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             # otherwise: normal item assignment
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":762
 *         if value is None:
 *             raise ValueError, "cannot assign None"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
  }

  /* "lxml/etree.pyx":774
 *         else:
 *             # otherwise: normal item assignment
 *             element = value             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 */
  /*else*/ {
    if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 774, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_element = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":775
 *             # 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 == ((int)-1))) __PYX_ERR(0, 775, __pyx_L1_error)

    /* "lxml/etree.pyx":776
 *             element = value
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_4);

    /* "lxml/etree.pyx":777
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":778
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "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_ERR(0, 778, __pyx_L1_error)

      /* "lxml/etree.pyx":777
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc
 */
    }

    /* "lxml/etree.pyx":779
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 */
    __pyx_t_5 = __pyx_v_element->_c_node->doc;
    __pyx_v_c_source_doc = __pyx_t_5;

    /* "lxml/etree.pyx":780
 *                 raise IndexError, "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_6 = __pyx_v_element->_c_node->next;
    __pyx_v_c_next = __pyx_t_6;

    /* "lxml/etree.pyx":781
 *             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);

    /* "lxml/etree.pyx":782
 *             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)
 */
    (void)(xmlReplaceNode(__pyx_v_c_node, __pyx_v_element->_c_node));

    /* "lxml/etree.pyx":783
 *             _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);

    /* "lxml/etree.pyx":784
 *             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_3 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 784, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":785
 *             _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));
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":786
 *             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_3 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 786, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":785
 *             _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)
 * 
 */
    }
  }

  /* "lxml/etree.pyx":748
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         """__setitem__(self, x, value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":788
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         """__delitem__(self, x)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_6__delitem__, "__delitem__(self, x)\n\n        Deletes the given subelement or a slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  xmlNode *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 1);

  /* "lxml/etree.pyx":793
 *         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;

  /* "lxml/etree.pyx":795
 *         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;

  /* "lxml/etree.pyx":796
 *         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 == ((int)-1))) __PYX_ERR(0, 796, __pyx_L1_error)

  /* "lxml/etree.pyx":797
 *         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); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":799
 *         if isinstance(x, slice):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 799, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":800
 *             # 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_3 = __pyx_v_self->_c_node->children;
      __pyx_v_c_node = __pyx_t_3;

      /* "lxml/etree.pyx":801
 *             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);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":802
 *                 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));
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":803
 *                 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);

          /* "lxml/etree.pyx":802
 *                 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:
 */
        }

        /* "lxml/etree.pyx":804
 *                     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);
          if (!__pyx_t_2) break;

          /* "lxml/etree.pyx":805
 *                         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);

          /* "lxml/etree.pyx":806
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                         c_node = c_next
 *             else:
 */
          __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 806, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "lxml/etree.pyx":807
 *                         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;
        }

        /* "lxml/etree.pyx":801
 *             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)
 */
      }

      /* "lxml/etree.pyx":799
 *         if isinstance(x, slice):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 */
      goto __pyx_L4;
    }

    /* "lxml/etree.pyx":809
 *                         c_node = c_next
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *                 _deleteSlice(self._doc, c_node, slicelength, step)
 *         else:
 */
    /*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 == ((int)-1))) __PYX_ERR(0, 809, __pyx_L1_error)

      /* "lxml/etree.pyx":810
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *                 _deleteSlice(self._doc, c_node, slicelength, step)             # <<<<<<<<<<<<<<
 *         else:
 *             # item deletion
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree__deleteSlice(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 810, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L4:;

    /* "lxml/etree.pyx":797
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":813
 *         else:
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 813, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_5);

    /* "lxml/etree.pyx":814
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":815
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"             # <<<<<<<<<<<<<<
 *             _removeNode(self._doc, c_node)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_x, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_index_out_of_range, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 815, __pyx_L1_error)

      /* "lxml/etree.pyx":814
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)
 */
    }

    /* "lxml/etree.pyx":816
 *             if c_node is NULL:
 *                 raise IndexError, f"index out of range: {x}"
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":788
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         """__delitem__(self, x)
 * 
 */

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

/* "lxml/etree.pyx":818
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_8__deepcopy__, "__deepcopy__(self, memo)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_9__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_8__deepcopy__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(0, 818, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 818, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(((struct LxmlElement *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 1);

  /* "lxml/etree.pyx":820
 *     def __deepcopy__(self, memo):
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __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;

  /* "lxml/etree.pyx":818
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

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

/* "lxml/etree.pyx":822
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_10__copy__, "__copy__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_11__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_11__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_10__copy__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __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;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 1);

  /* "lxml/etree.pyx":827
 *         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 == ((int)-1))) __PYX_ERR(0, 827, __pyx_L1_error)

  /* "lxml/etree.pyx":828
 *         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 == ((xmlDoc *)NULL))) __PYX_ERR(0, 828, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_2;

  /* "lxml/etree.pyx":829
 *         _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_ERR(0, 829, __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;

  /* "lxml/etree.pyx":830
 *         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_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_root = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":831
 *         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);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":832
 *         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;

    /* "lxml/etree.pyx":831
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  }

  /* "lxml/etree.pyx":834
 *             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;

  /* "lxml/etree.pyx":835
 *         # 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_7 = (__pyx_v_c_node != NULL);
    if (__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (__pyx_v_c_node->type != __pyx_v_self->_c_node->type);
    __pyx_t_5 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_5) break;

    /* "lxml/etree.pyx":836
 *         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;
  }

  /* "lxml/etree.pyx":837
 *         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_5 = (__pyx_v_c_node == NULL);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":838
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":837
 *         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)
 */
  }

  /* "lxml/etree.pyx":839
 *         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_ERR(0, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":822
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__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;
}

/* "lxml/etree.pyx":841
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_12set, "set(self, key, value)\n\n        Sets an element attribute.\n        In HTML documents (not XML or XHTML), the value None is allowed and creates\n        an attribute without value (just the attribute name).\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_13set = {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_13set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_12set};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 841, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 841, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); __PYX_ERR(0, 841, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set") < 0)) __PYX_ERR(0, 841, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 841, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":848
 *         an attribute without value (just the attribute name).
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self, key, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 848, __pyx_L1_error)

  /* "lxml/etree.pyx":849
 *         """
 *         _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 == ((int)-1))) __PYX_ERR(0, 849, __pyx_L1_error)

  /* "lxml/etree.pyx":841
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":851
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_14append, "append(self, element)\n\n        Adds a subelement to the end of this element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_15append = {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_15append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_14append};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "append") < 0)) __PYX_ERR(0, 851, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 851, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.append", __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_ERR(0, 851, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_14append(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":856
 *         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 == ((int)-1))) __PYX_ERR(0, 856, __pyx_L1_error)

  /* "lxml/etree.pyx":857
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _appendChild(self, element)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 857, __pyx_L1_error)

  /* "lxml/etree.pyx":858
 *         _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 == ((int)-1))) __PYX_ERR(0, 858, __pyx_L1_error)

  /* "lxml/etree.pyx":851
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":860
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_17addnext = {"addnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_17addnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_16addnext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "addnext") < 0)) __PYX_ERR(0, 860, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addnext", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 860, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.addnext", __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_ERR(0, 860, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_16addnext(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addnext", 1);

  /* "lxml/etree.pyx":870
 *         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 == ((int)-1))) __PYX_ERR(0, 870, __pyx_L1_error)

  /* "lxml/etree.pyx":871
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 871, __pyx_L1_error)

  /* "lxml/etree.pyx":872
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 */
  __pyx_t_3 = (__pyx_v_self->_c_node->parent != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!_isElement(__pyx_v_self->_c_node->parent));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":873
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
    switch (__pyx_v_element->_c_node->type) {
      case XML_PI_NODE:
      case XML_COMMENT_NODE:
      __pyx_t_2 = 0;
      break;
      default:
      __pyx_t_2 = 1;
      break;
    }
    __pyx_t_3 = __pyx_t_2;
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":874
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "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_ERR(0, 874, __pyx_L1_error)

      /* "lxml/etree.pyx":873
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
    }

    /* "lxml/etree.pyx":875
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "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_ERR(0, 875, __pyx_L1_error)

    /* "lxml/etree.pyx":872
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *                 raise TypeError, "Only processing instructions and comments can be siblings of the root element"
 */
  }

  /* "lxml/etree.pyx":876
 *                 raise TypeError, "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 == ((int)-1))) __PYX_ERR(0, 876, __pyx_L1_error)

  /* "lxml/etree.pyx":860
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":878
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_19addprevious = {"addprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_19addprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_18addprevious};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 878, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "addprevious") < 0)) __PYX_ERR(0, 878, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addprevious", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 878, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.addprevious", __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_ERR(0, 878, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_18addprevious(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addprevious", 1);

  /* "lxml/etree.pyx":888
 *         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 == ((int)-1))) __PYX_ERR(0, 888, __pyx_L1_error)

  /* "lxml/etree.pyx":889
 *         """
 *         _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 == ((int)-1))) __PYX_ERR(0, 889, __pyx_L1_error)

  /* "lxml/etree.pyx":890
 *         _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_3 = (__pyx_v_self->_c_node->parent != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!_isElement(__pyx_v_self->_c_node->parent));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":891
 *         _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, "Only processing instructions and comments can be siblings of the root element"
 */
    __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_PI_NODE);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":892
 *         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, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_COMMENT_NODE);
      if (unlikely(__pyx_t_2)) {

        /* "lxml/etree.pyx":893
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "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_ERR(0, 893, __pyx_L1_error)

        /* "lxml/etree.pyx":892
 *         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, "Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      }

      /* "lxml/etree.pyx":891
 *         _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, "Only processing instructions and comments can be siblings of the root element"
 */
    }

    /* "lxml/etree.pyx":894
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, "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_ERR(0, 894, __pyx_L1_error)

    /* "lxml/etree.pyx":890
 *         _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:
 */
  }

  /* "lxml/etree.pyx":895
 *                     raise TypeError, "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 == ((int)-1))) __PYX_ERR(0, 895, __pyx_L1_error)

  /* "lxml/etree.pyx":878
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":897
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_20extend, "extend(self, elements)\n\n        Extends the current children by the elements in the iterable.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_21extend = {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_21extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_20extend};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elements,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_elements)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 897, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "extend") < 0)) __PYX_ERR(0, 897, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 897, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_20extend(((struct LxmlElement *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 1);

  /* "lxml/etree.pyx":903
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 903, __pyx_L1_error)

  /* "lxml/etree.pyx":904
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, "Node must not be None"
 */
  if (likely(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_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 904, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 904, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(0, 904, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 904, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(0, 904, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 904, __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_ERR(0, 904, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "lxml/etree.pyx":905
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
 */
    __pyx_t_6 = (((PyObject *)__pyx_v_element) == Py_None);
    if (unlikely(__pyx_t_6)) {

      /* "lxml/etree.pyx":906
 *         for element in elements:
 *             if element is None:
 *                 raise TypeError, "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_ERR(0, 906, __pyx_L1_error)

      /* "lxml/etree.pyx":905
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
 */
    }

    /* "lxml/etree.pyx":907
 *             if element is None:
 *                 raise TypeError, "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 == ((int)-1))) __PYX_ERR(0, 907, __pyx_L1_error)

    /* "lxml/etree.pyx":908
 *                 raise TypeError, "Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self, bint keep_tail=False):
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 908, __pyx_L1_error)

    /* "lxml/etree.pyx":904
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, "Node must not be None"
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":897
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":910
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_22clear, "clear(self, keep_tail=False)\n\n        Resets an element.  This function removes all subelements, clears\n        all attributes and sets the text and tail properties to None.\n\n        Pass ``keep_tail=True`` to leave the tail text untouched.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_23clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_23clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_22clear};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_keep_tail;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_keep_tail,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_keep_tail);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 910, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clear") < 0)) __PYX_ERR(0, 910, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_keep_tail = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_keep_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 910, __pyx_L3_error)
    } else {
      __pyx_v_keep_tail = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clear", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 910, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_22clear(((struct LxmlElement *)__pyx_v_self), __pyx_v_keep_tail);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_22clear(struct LxmlElement *__pyx_v_self, int __pyx_v_keep_tail) {
  xmlAttr *__pyx_v_c_attr;
  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;
  int __pyx_t_3;
  xmlAttr *__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("clear", 1);

  /* "lxml/etree.pyx":922
 *         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 == ((int)-1))) __PYX_ERR(0, 922, __pyx_L1_error)

  /* "lxml/etree.pyx":923
 *         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;

  /* "lxml/etree.pyx":925
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *         if not keep_tail:
 *             _removeText(c_node.next)
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "lxml/etree.pyx":926
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         if not keep_tail:             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *         # remove all attributes
 */
  __pyx_t_3 = (!__pyx_v_keep_tail);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":927
 *         _removeText(c_node.children)
 *         if not keep_tail:
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *         # remove all attributes
 *         c_attr = c_node.properties
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "lxml/etree.pyx":926
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         if not keep_tail:             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *         # remove all attributes
 */
  }

  /* "lxml/etree.pyx":929
 *             _removeText(c_node.next)
 *         # remove all attributes
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         if c_attr:
 *             c_node.properties = NULL
 */
  __pyx_t_4 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_4;

  /* "lxml/etree.pyx":930
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         if c_attr:             # <<<<<<<<<<<<<<
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)
 */
  __pyx_t_3 = (__pyx_v_c_attr != 0);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":931
 *         c_attr = c_node.properties
 *         if c_attr:
 *             c_node.properties = NULL             # <<<<<<<<<<<<<<
 *             tree.xmlFreePropList(c_attr)
 *         # remove all subelements
 */
    __pyx_v_c_node->properties = NULL;

    /* "lxml/etree.pyx":932
 *         if c_attr:
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)             # <<<<<<<<<<<<<<
 *         # remove all subelements
 *         c_node = c_node.children
 */
    xmlFreePropList(__pyx_v_c_attr);

    /* "lxml/etree.pyx":930
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         if c_attr:             # <<<<<<<<<<<<<<
 *             c_node.properties = NULL
 *             tree.xmlFreePropList(c_attr)
 */
  }

  /* "lxml/etree.pyx":934
 *             tree.xmlFreePropList(c_attr)
 *         # remove all subelements
 *         c_node = c_node.children             # <<<<<<<<<<<<<<
 *         if c_node and not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 */
  __pyx_t_2 = __pyx_v_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "lxml/etree.pyx":935
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node and not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 */
  __pyx_t_5 = (__pyx_v_c_node != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = (!_isElement(__pyx_v_c_node));
  __pyx_t_3 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":936
 *         c_node = c_node.children
 *         if c_node and 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);

    /* "lxml/etree.pyx":935
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node and not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 */
  }

  /* "lxml/etree.pyx":937
 *         if c_node and 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_3 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_3) break;

    /* "lxml/etree.pyx":938
 *             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);

    /* "lxml/etree.pyx":939
 *         while c_node is not NULL:
 *             c_node_next = _nextElement(c_node)
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *             c_node = c_node_next
 * 
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "lxml/etree.pyx":940
 *             c_node_next = _nextElement(c_node)
 *             _removeNode(self._doc, c_node)
 *             c_node = c_node_next             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index: int, _Element element not None):
 */
    __pyx_v_c_node = __pyx_v_c_node_next;
  }

  /* "lxml/etree.pyx":910
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
 */

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

/* "lxml/etree.pyx":942
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_25insert = {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_25insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_24insert};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_index = 0;
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); __PYX_ERR(0, 942, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "insert") < 0)) __PYX_ERR(0, 942, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_index = ((PyObject*)values[0]);
    __pyx_v_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 942, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_index), (&PyInt_Type), 0, "index", 1))) __PYX_ERR(0, 942, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) __PYX_ERR(0, 942, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 1);

  /* "lxml/etree.pyx":950
 *         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 == ((int)-1))) __PYX_ERR(0, 950, __pyx_L1_error)

  /* "lxml/etree.pyx":951
 *         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 == ((int)-1))) __PYX_ERR(0, 951, __pyx_L1_error)

  /* "lxml/etree.pyx":952
 *         _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_ERR(0, 952, __pyx_L1_error)
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_2);

  /* "lxml/etree.pyx":953
 *         _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);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":954
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 *             return
 *         # prevent cycles
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 954, __pyx_L1_error)

    /* "lxml/etree.pyx":955
 *         if c_node is NULL:
 *             _appendChild(self, element)
 *             return             # <<<<<<<<<<<<<<
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":953
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 *             return
 */
  }

  /* "lxml/etree.pyx":957
 *             return
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_element->_c_node, __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":958
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_source_doc = element._c_node.doc
 *         c_next = element._c_node.next
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 958, __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_ERR(0, 958, __pyx_L1_error)

    /* "lxml/etree.pyx":957
 *             return
 *         # prevent cycles
 *         if _isAncestorOrSame(element._c_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc
 */
  }

  /* "lxml/etree.pyx":959
 *         if _isAncestorOrSame(element._c_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")
 *         c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 */
  __pyx_t_5 = __pyx_v_element->_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_5;

  /* "lxml/etree.pyx":960
 *             raise ValueError("cannot append parent to itself")
 *         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_6 = __pyx_v_element->_c_node->next;
  __pyx_v_c_next = __pyx_t_6;

  /* "lxml/etree.pyx":961
 *         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)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 */
  (void)(xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node));

  /* "lxml/etree.pyx":962
 *         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);

  /* "lxml/etree.pyx":963
 *         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_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 == ((int)-1))) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":942
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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;
}

/* "lxml/etree.pyx":965
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_27remove = {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_27remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_26remove};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 965, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove") < 0)) __PYX_ERR(0, 965, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 965, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.remove", __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_ERR(0, 965, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_26remove(((struct LxmlElement *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":974
 *         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 == ((int)-1))) __PYX_ERR(0, 974, __pyx_L1_error)

  /* "lxml/etree.pyx":975
 *         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 == ((int)-1))) __PYX_ERR(0, 975, __pyx_L1_error)

  /* "lxml/etree.pyx":976
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = element._c_node             # <<<<<<<<<<<<<<
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
 */
  __pyx_t_2 = __pyx_v_element->_c_node;
  __pyx_v_c_node = __pyx_t_2;

  /* "lxml/etree.pyx":977
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "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);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":978
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "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_ERR(0, 978, __pyx_L1_error)

    /* "lxml/etree.pyx":977
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_next = element._c_node.next
 */
  }

  /* "lxml/etree.pyx":979
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, "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;

  /* "lxml/etree.pyx":980
 *             raise ValueError, "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);

  /* "lxml/etree.pyx":981
 *         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);

  /* "lxml/etree.pyx":983
 *         _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 == ((int)-1))) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":965
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":985
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_29replace = {"replace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_29replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_28replace};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_old_element = 0;
  struct LxmlElement *__pyx_v_new_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_element,&__pyx_n_s_new_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_old_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 985, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 985, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, 1); __PYX_ERR(0, 985, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "replace") < 0)) __PYX_ERR(0, 985, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_old_element = ((struct LxmlElement *)values[0]);
    __pyx_v_new_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 985, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 985, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_element), __pyx_ptype_4lxml_5etree__Element, 0, "new_element", 0))) __PYX_ERR(0, 986, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 1);

  /* "lxml/etree.pyx":996
 *         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 == ((int)-1))) __PYX_ERR(0, 996, __pyx_L1_error)

  /* "lxml/etree.pyx":997
 *         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 == ((int)-1))) __PYX_ERR(0, 997, __pyx_L1_error)

  /* "lxml/etree.pyx":998
 *         _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 == ((int)-1))) __PYX_ERR(0, 998, __pyx_L1_error)

  /* "lxml/etree.pyx":999
 *         _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, "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;

  /* "lxml/etree.pyx":1000
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node
 */
  __pyx_t_3 = (__pyx_v_c_old_node->parent != __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1001
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_new_node = new_element._c_node
 *         # prevent cycles
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    __PYX_ERR(0, 1001, __pyx_L1_error)

    /* "lxml/etree.pyx":1000
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node
 */
  }

  /* "lxml/etree.pyx":1002
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
 *         c_new_node = new_element._c_node             # <<<<<<<<<<<<<<
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):
 */
  __pyx_t_2 = __pyx_v_new_element->_c_node;
  __pyx_v_c_new_node = __pyx_t_2;

  /* "lxml/etree.pyx":1004
 *         c_new_node = new_element._c_node
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__isAncestorOrSame(__pyx_v_c_new_node, __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1005
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         # replace node
 *         c_old_next = c_old_node.next
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __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_ERR(0, 1005, __pyx_L1_error)

    /* "lxml/etree.pyx":1004
 *         c_new_node = new_element._c_node
 *         # prevent cycles
 *         if _isAncestorOrSame(c_new_node, self._c_node):             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
 */
  }

  /* "lxml/etree.pyx":1007
 *             raise ValueError("cannot append parent to itself")
 *         # replace node
 *         c_old_next = c_old_node.next             # <<<<<<<<<<<<<<
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 */
  __pyx_t_2 = __pyx_v_c_old_node->next;
  __pyx_v_c_old_next = __pyx_t_2;

  /* "lxml/etree.pyx":1008
 *         # replace node
 *         c_old_next = c_old_node.next
 *         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;

  /* "lxml/etree.pyx":1009
 *         c_old_next = c_old_node.next
 *         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_5 = __pyx_v_c_new_node->doc;
  __pyx_v_c_source_doc = __pyx_t_5;

  /* "lxml/etree.pyx":1010
 *         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)
 */
  (void)(xmlReplaceNode(__pyx_v_c_old_node, __pyx_v_c_new_node));

  /* "lxml/etree.pyx":1011
 *         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);

  /* "lxml/etree.pyx":1012
 *         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);

  /* "lxml/etree.pyx":1013
 *         _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_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_c_new_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1015
 *         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_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_old_node->doc, __pyx_v_c_old_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":985
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """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_4);
  __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;
}

/* "lxml/etree.pyx":1021
 *         """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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "lxml/etree.pyx":1022
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
 */
  __pyx_t_1 = (__pyx_v_self->_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1023
 *         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;

    /* "lxml/etree.pyx":1022
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
 */
  }

  /* "lxml/etree.pyx":1024
 *             if self._tag is not None:
 *                 return self._tag
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1024, __pyx_L1_error)

  /* "lxml/etree.pyx":1025
 *                 return self._tag
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             return self._tag
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_tag);
  __Pyx_DECREF(__pyx_v_self->_tag);
  __pyx_v_self->_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1026
 *             _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;

  /* "lxml/etree.pyx":1021
 *         """Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":1028
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1030
 *         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 == ((int)-1))) __PYX_ERR(0, 1030, __pyx_L1_error)

  /* "lxml/etree.pyx":1031
 *             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_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1031, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1031, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_name = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1032
 *             _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;

  /* "lxml/etree.pyx":1033
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
 */
  __pyx_t_6 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __pyx_v_parser->_for_html;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":1034
 *             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 == ((int)-1))) __PYX_ERR(0, 1034, __pyx_L1_error)

    /* "lxml/etree.pyx":1033
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1036
 *                 _htmlTagValidOrRaise(name)
 *             else:
 *                 _tagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1036, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1037
 *             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;

  /* "lxml/etree.pyx":1038
 *                 _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));

  /* "lxml/etree.pyx":1039
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":1040
 *             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;

    /* "lxml/etree.pyx":1039
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
 */
    goto __pyx_L6;
  }

  /* "lxml/etree.pyx":1042
 *                 self._c_node.ns = NULL
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __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 == ((int)-1))) __PYX_ERR(0, 1042, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "lxml/etree.pyx":1028
 *             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;
}

/* "lxml/etree.pyx":1044
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Element attribute dictionary. Where possible, use get(), set(),
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1049
 *         keys(), values() and items() to access element attributes.
 *         """
 *         return _Attrib.__new__(_Attrib, self)             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1049, __pyx_L1_error);
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__Attrib(((PyTypeObject *)__pyx_ptype_4lxml_5etree__Attrib), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1044
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Element attribute dictionary. Where possible, use get(), set(),
 */

  /* 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;
}

/* "lxml/etree.pyx":1055
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1056
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 1056, __pyx_L1_error)

  /* "lxml/etree.pyx":1057
 *         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_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1055
 *         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;
}

/* "lxml/etree.pyx":1059
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "lxml/etree.pyx":1060
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1060, __pyx_L1_error)

  /* "lxml/etree.pyx":1061
 *         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, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1062
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(0, 1062, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_decode_bytes(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1061
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
 */
  }

  /* "lxml/etree.pyx":1063
 *             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 == ((int)-1))) __PYX_ERR(0, 1063, __pyx_L1_error)

  /* "lxml/etree.pyx":1059
 *             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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "lxml/etree.pyx":1074
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1075
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 1075, __pyx_L1_error)

  /* "lxml/etree.pyx":1076
 *         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_ERR(0, 1076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1074
 *         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;
}

/* "lxml/etree.pyx":1078
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1079
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1079, __pyx_L1_error)

  /* "lxml/etree.pyx":1080
 *         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 == ((int)-1))) __PYX_ERR(0, 1080, __pyx_L1_error)

  /* "lxml/etree.pyx":1078
 *             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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1087
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1091
 *         """Namespace prefix or None.
 *         """
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1092
 *         """
 *         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);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1093
 *         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_ERR(0, 1093, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1092
 *         """
 *         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
 */
    }

    /* "lxml/etree.pyx":1091
 *         """Namespace prefix or None.
 *         """
 *         if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
 */
  }

  /* "lxml/etree.pyx":1094
 *             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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1087
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
 */

  /* 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;
}

/* "lxml/etree.pyx":1100
 *         """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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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__", 1);

  /* "lxml/etree.pyx":1102
 *         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 == ((int)-1))) __PYX_ERR(0, 1102, __pyx_L1_error)

  /* "lxml/etree.pyx":1103
 *             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);

  /* "lxml/etree.pyx":1104
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)
 *             return line if line > 0 else None             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, line):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__pyx_v_line > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_line); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1100
 *         """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_4);
  __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;
}

/* "lxml/etree.pyx":1106
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1107
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1107, __pyx_L1_error)

  /* "lxml/etree.pyx":1108
 *         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_ERR(0, 1108, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1109
 *             _assertValidNode(self)
 *             if line <= 0:
 *                 self._c_node.line = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self._c_node.line = line
 */
    __pyx_v_self->_c_node->line = 0;

    /* "lxml/etree.pyx":1108
 *         def __set__(self, line):
 *             _assertValidNode(self)
 *             if line <= 0:             # <<<<<<<<<<<<<<
 *                 self._c_node.line = 0
 *             else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1111
 *                 self._c_node.line = 0
 *             else:
 *                 self._c_node.line = line             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyInt_As_unsigned_short(__pyx_v_line); if (unlikely((__pyx_t_4 == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L1_error)
    __pyx_v_self->_c_node->line = __pyx_t_4;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1106
 *             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;
}

/* "lxml/etree.pyx":1114
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  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__", 1);

  /* "lxml/etree.pyx":1122
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _build_nsmap(self._c_node)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1122, __pyx_L1_error)

  /* "lxml/etree.pyx":1123
 *         """
 *         _assertValidNode(self)
 *         return _build_nsmap(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__build_nsmap(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1114
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
 */

  /* 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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1137
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1138
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 1138, __pyx_L1_error)

  /* "lxml/etree.pyx":1139
 *         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);

  /* "lxml/etree.pyx":1140
 *             _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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1141
 *             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);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1142
 *             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_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "lxml/etree.pyx":1141
 *             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)
 */
    }

    /* "lxml/etree.pyx":1143
 *                 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_ERR(0, 1143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1140
 *             _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
 */
  }

  /* "lxml/etree.pyx":1144
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:             # <<<<<<<<<<<<<<
 *                 base = _decodeFilename(c_base)
 *             finally:
 */
  /*try:*/ {

    /* "lxml/etree.pyx":1145
 *                 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_ERR(0, 1145, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_base = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "lxml/etree.pyx":1147
 *                 base = _decodeFilename(c_base)
 *             finally:
 *                 tree.xmlFree(c_base)             # <<<<<<<<<<<<<<
 *             return base
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_base);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:;
  }

  /* "lxml/etree.pyx":1148
 *             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;

  /* "lxml/etree.pyx":1137
 *         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;
}

/* "lxml/etree.pyx":1150
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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_url);

  /* "lxml/etree.pyx":1151
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1151, __pyx_L1_error)

  /* "lxml/etree.pyx":1152
 *         def __set__(self, url):
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_url == Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1153
 *             _assertValidNode(self)
 *             if url is None:
 *                 c_base = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 url = _encodeFilename(url)
 */
    __pyx_v_c_base = ((const xmlChar *)NULL);

    /* "lxml/etree.pyx":1152
 *         def __set__(self, url):
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1155
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 *                 url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *                 c_base = _xcstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1156
 *             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:;

  /* "lxml/etree.pyx":1157
 *                 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);

  /* "lxml/etree.pyx":1150
 *             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_3);
  __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;
}

/* "lxml/etree.pyx":1160
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         "__repr__(self)"
 *         return "<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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_30__repr__, "__repr__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "lxml/etree.pyx":1162
 *     def __repr__(self):
 *         "__repr__(self)"
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u_Element);
  __pyx_t_2 += 9;
  __Pyx_GIVEREF(__pyx_kp_u_Element);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Element);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_at_0x);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__29);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __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;

  /* "lxml/etree.pyx":1160
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         "__repr__(self)"
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
 */

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

/* "lxml/etree.pyx":1164
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_32__getitem__, "Returns the subelement at the given position or the requested\n        slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  xmlNode *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);

  /* "lxml/etree.pyx":1168
 *         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;

  /* "lxml/etree.pyx":1169
 *         """
 *         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;

  /* "lxml/etree.pyx":1173
 *         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 == ((int)-1))) __PYX_ERR(0, 1173, __pyx_L1_error)

  /* "lxml/etree.pyx":1174
 *         cdef list result
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1176
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1176, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1177
 *             # 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_3 = __pyx_f_4lxml_5etree__collectChildren(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1176
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    }

    /* "lxml/etree.pyx":1178
 *             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 == ((int)-1))) __PYX_ERR(0, 1178, __pyx_L1_error)

    /* "lxml/etree.pyx":1179
 *                 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);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1180
 *             _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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1179
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
 */
    }

    /* "lxml/etree.pyx":1181
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":1182
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

      /* "lxml/etree.pyx":1181
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
      goto __pyx_L6;
    }

    /* "lxml/etree.pyx":1184
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
    /*else*/ {
      __pyx_v_step = (-__pyx_v_step);

      /* "lxml/etree.pyx":1185
 *             else:
 *                 step = -step
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L6:;

    /* "lxml/etree.pyx":1186
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1187
 *                 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;

    /* "lxml/etree.pyx":1188
 *             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_4 = (__pyx_v_c_node != NULL);
      if (__pyx_t_4) {
      } else {
        __pyx_t_2 = __pyx_t_4;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_c < __pyx_v_slicelength);
      __pyx_t_2 = __pyx_t_4;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "lxml/etree.pyx":1189
 *             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_3 = ((PyObject *)__pyx_v_self->_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_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lxml/etree.pyx":1190
 *             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);

      /* "lxml/etree.pyx":1191
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 */
      __pyx_t_7 = __pyx_v_step;
      __pyx_t_8 = __pyx_t_7;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_i = __pyx_t_9;

        /* "lxml/etree.pyx":1192
 *                 c += 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                     if c_node is NULL:
 *                         break
 */
        __pyx_t_10 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1192, __pyx_L1_error)
        __pyx_v_c_node = __pyx_t_10;

        /* "lxml/etree.pyx":1193
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             return result
 */
        __pyx_t_2 = (__pyx_v_c_node == NULL);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":1194
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:
 *                         break             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
          goto __pyx_L12_break;

          /* "lxml/etree.pyx":1193
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                     if c_node is NULL:             # <<<<<<<<<<<<<<
 *                         break
 *             return result
 */
        }
      }
      __pyx_L12_break:;
    }

    /* "lxml/etree.pyx":1195
 *                     if c_node is NULL:
 *                         break
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1174
 *         cdef list result
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  }

  /* "lxml/etree.pyx":1198
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 */
  /*else*/ {
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1198, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_7);

    /* "lxml/etree.pyx":1199
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":1200
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "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_ERR(0, 1200, __pyx_L1_error)

      /* "lxml/etree.pyx":1199
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)
 */
    }

    /* "lxml/etree.pyx":1201
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":1164
 *         return "<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "lxml/etree.pyx":1203
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """__len__(self)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_8_Element_35__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_34__len__, "__len__(self)\n\n        Returns the number of subelements.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1208
 *         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 == ((int)-1))) __PYX_ERR(0, 1208, __pyx_L1_error)

  /* "lxml/etree.pyx":1209
 *         """
 *         _assertValidNode(self)
 *         return _countElements(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_f_4lxml_5etree__countElements(__pyx_v_self->_c_node->children);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1203
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """__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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1211
 *         return _countElements(self._c_node.children)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         """__bool__(self)"""
 *         import warnings
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_37__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_37__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_36__bool__(((struct LxmlElement *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_8_Element_36__bool__(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;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 1);

  /* "lxml/etree.pyx":1213
 *     def __bool__(self):
 *         """__bool__(self)"""
 *         import warnings             # <<<<<<<<<<<<<<
 *         warnings.warn(
 *             "The behavior of this method will change in future versions. "
 */
  __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_warnings, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1214
 *         """__bool__(self)"""
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             "The behavior of this method will change in future versions. "
 *             "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_ERR(0, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "lxml/etree.pyx":1217
 *             "The behavior of this method will change in future versions. "
 *             "Use specific 'len(elem)' or 'elem is not None' test instead.",
 *             FutureWarning             # <<<<<<<<<<<<<<
 *             )
 *         # emulate old behaviour
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1214, __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;

  /* "lxml/etree.pyx":1220
 *             )
 *         # emulate old behaviour
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _hasChild(self._c_node)
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1220, __pyx_L1_error)

  /* "lxml/etree.pyx":1221
 *         # 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;

  /* "lxml/etree.pyx":1211
 *         return _countElements(self._c_node.children)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         """__bool__(self)"""
 *         import warnings
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1223
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         "__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_38__contains__, "__contains__(self, element)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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;

  /* "lxml/etree.pyx":1226
 *         "__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 == ((int)-1))) __PYX_ERR(0, 1226, __pyx_L1_error)

  /* "lxml/etree.pyx":1227
 *         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, __pyx_ptype_4lxml_5etree__Element); 
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1228
 *         _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;

    /* "lxml/etree.pyx":1227
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_node = (<_Element>element)._c_node
 */
  }

  /* "lxml/etree.pyx":1229
 *         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;

  /* "lxml/etree.pyx":1230
 *             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) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->parent == __pyx_v_self->_c_node);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1223
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         "__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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1232
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         "__iter__(self)"
 *         return ElementChildIterator(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_41__iter__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_40__iter__, "__iter__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 1);

  /* "lxml/etree.pyx":1234
 *     def __iter__(self):
 *         "__iter__(self)"
 *         return ElementChildIterator(self)             # <<<<<<<<<<<<<<
 * 
 *     def __reversed__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_ElementChildIterator), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1232
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         "__iter__(self)"
 *         return ElementChildIterator(self)
 */

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

/* "lxml/etree.pyx":1236
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_42__reversed__, "__reversed__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_43__reversed__ = {"__reversed__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_43__reversed__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_42__reversed__};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reversed__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__reversed__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reversed__", 0))) return NULL;
  __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__", 1);

  /* "lxml/etree.pyx":1238
 *     def __reversed__(self):
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)             # <<<<<<<<<<<<<<
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1238, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reversed, Py_True) < 0) __PYX_ERR(0, 1238, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementChildIterator), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __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;

  /* "lxml/etree.pyx":1236
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__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;
}

/* "lxml/etree.pyx":1240
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_45index = {"index", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_45index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_44index};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_child = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_child,&__pyx_n_s_start,&__pyx_n_s_stop,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_child)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "index") < 0)) __PYX_ERR(0, 1240, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_child = ((struct LxmlElement *)values[0]);
    __pyx_v_start = ((PyObject*)values[1]);
    __pyx_v_stop = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("index", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1240, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 1240, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start), (&PyInt_Type), 1, "start", 1))) __PYX_ERR(0, 1240, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stop), (&PyInt_Type), 1, "stop", 1))) __PYX_ERR(0, 1240, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 1);

  /* "lxml/etree.pyx":1251
 *         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 == ((int)-1))) __PYX_ERR(0, 1251, __pyx_L1_error)

  /* "lxml/etree.pyx":1252
 *         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 == ((int)-1))) __PYX_ERR(0, 1252, __pyx_L1_error)

  /* "lxml/etree.pyx":1253
 *         _assertValidNode(self)
 *         _assertValidNode(child)
 *         c_child = child._c_node             # <<<<<<<<<<<<<<
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, "Element is not a child of this node."
 */
  __pyx_t_2 = __pyx_v_child->_c_node;
  __pyx_v_c_child = __pyx_t_2;

  /* "lxml/etree.pyx":1254
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 * 
 */
  __pyx_t_3 = (__pyx_v_c_child->parent != __pyx_v_self->_c_node);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1255
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, "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_ERR(0, 1255, __pyx_L1_error)

    /* "lxml/etree.pyx":1254
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not a child of this node."
 * 
 */
  }

  /* "lxml/etree.pyx":1258
 * 
 *         # 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_4 = (__pyx_v_stop == ((PyObject*)Py_None));
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_start == ((PyObject*)Py_None));
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1259
 *         # 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;

    /* "lxml/etree.pyx":1260
 *         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;

    /* "lxml/etree.pyx":1261
 *             k = 0
 *             c_child = c_child.prev
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k += 1
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1262
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
 */
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1263
 *             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);

        /* "lxml/etree.pyx":1262
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
 */
      }

      /* "lxml/etree.pyx":1264
 *                 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;
    }

    /* "lxml/etree.pyx":1265
 *                     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_ERR(0, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1258
 * 
 *         # 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
 */
  }

  /* "lxml/etree.pyx":1268
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
 */
  __pyx_t_3 = (__pyx_v_start == ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1269
 *         # check indices
 *         if start is None:
 *             c_start = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_start = start
 */
    __pyx_v_c_start = 0;

    /* "lxml/etree.pyx":1268
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
 */
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":1271
 *             c_start = 0
 *         else:
 *             c_start = start             # <<<<<<<<<<<<<<
 *         if stop is None:
 *             c_stop = 0
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1271, __pyx_L1_error)
    __pyx_v_c_start = __pyx_t_6;
  }
  __pyx_L11:;

  /* "lxml/etree.pyx":1272
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
 */
  __pyx_t_3 = (__pyx_v_stop == ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1273
 *             c_start = start
 *         if stop is None:
 *             c_stop = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_stop = stop
 */
    __pyx_v_c_stop = 0;

    /* "lxml/etree.pyx":1272
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
 */
    goto __pyx_L12;
  }

  /* "lxml/etree.pyx":1275
 *             c_stop = 0
 *         else:
 *             c_stop = stop             # <<<<<<<<<<<<<<
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_stop); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1275, __pyx_L1_error)
    __pyx_v_c_stop = __pyx_t_6;

    /* "lxml/etree.pyx":1276
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
 */
    __pyx_t_4 = (__pyx_v_c_stop == 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }

    /* "lxml/etree.pyx":1277
 *             c_stop = stop
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
 */
    __pyx_t_4 = (__pyx_v_c_start >= __pyx_v_c_stop);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_stop > 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_c_start < 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L14_bool_binop_done:;

    /* "lxml/etree.pyx":1276
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
 */
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":1278
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "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_ERR(0, 1278, __pyx_L1_error)

      /* "lxml/etree.pyx":1276
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, "list.index(x): x not in slice"
 */
    }
  }
  __pyx_L12:;

  /* "lxml/etree.pyx":1281
 * 
 *         # 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_4 = (__pyx_v_c_start < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L19_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_stop < 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L19_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1283
 *         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_3 = (__pyx_v_c_start < __pyx_v_c_stop);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1284
 *             # 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);

      /* "lxml/etree.pyx":1283
 *         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:
 */
      goto __pyx_L21;
    }

    /* "lxml/etree.pyx":1286
 *                 k = -c_start
 *             else:
 *                 k = -c_stop             # <<<<<<<<<<<<<<
 *             c_start_node = self._c_node.last
 *             l = 1
 */
    /*else*/ {
      __pyx_v_k = (-__pyx_v_c_stop);
    }
    __pyx_L21:;

    /* "lxml/etree.pyx":1287
 *             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;

    /* "lxml/etree.pyx":1288
 *                 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;

    /* "lxml/etree.pyx":1289
 *             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_4 = (__pyx_v_c_start_node != __pyx_v_c_child);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_l < __pyx_v_k);
      __pyx_t_3 = __pyx_t_4;
      __pyx_L24_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1290
 *             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_3 = _isElement(__pyx_v_c_start_node);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1291
 *             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);

        /* "lxml/etree.pyx":1290
 *             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
 */
      }

      /* "lxml/etree.pyx":1292
 *                 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;
    }

    /* "lxml/etree.pyx":1293
 *                     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_3 = (__pyx_v_c_start_node == __pyx_v_c_child);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1295
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
 */
      __pyx_t_4 = (__pyx_v_c_stop < 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_l <= (-__pyx_v_c_stop));
      __pyx_t_3 = __pyx_t_4;
      __pyx_L29_bool_binop_done:;
      if (unlikely(__pyx_t_3)) {

        /* "lxml/etree.pyx":1296
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *             elif c_start < 0:
 *                 raise ValueError, "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_ERR(0, 1296, __pyx_L1_error)

        /* "lxml/etree.pyx":1295
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
 */
      }

      /* "lxml/etree.pyx":1293
 *                     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:
 */
      goto __pyx_L27;
    }

    /* "lxml/etree.pyx":1297
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
 */
    __pyx_t_3 = (__pyx_v_c_start < 0);
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":1298
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:
 *                 raise ValueError, "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_ERR(0, 1298, __pyx_L1_error)

      /* "lxml/etree.pyx":1297
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, "list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "list.index(x): x not in slice"
 * 
 */
    }
    __pyx_L27:;

    /* "lxml/etree.pyx":1281
 * 
 *         # 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:
 */
  }

  /* "lxml/etree.pyx":1301
 * 
 *         # 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;

  /* "lxml/etree.pyx":1302
 *         # 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;

  /* "lxml/etree.pyx":1303
 *         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);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":1305
 *         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_4 = (__pyx_v_c_child != NULL);
      if (__pyx_t_4) {
      } else {
        __pyx_t_3 = __pyx_t_4;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_k < __pyx_v_c_stop);
      __pyx_t_3 = __pyx_t_4;
      __pyx_L34_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1306
 *             # 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_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1307
 *             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);

        /* "lxml/etree.pyx":1306
 *             # 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
 */
      }

      /* "lxml/etree.pyx":1308
 *                 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;
    }

    /* "lxml/etree.pyx":1309
 *                     k += 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
 */
    __pyx_t_3 = (__pyx_v_k < __pyx_v_c_stop);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1310
 *                 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_ERR(0, 1310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1309
 *                     k += 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
 */
    }

    /* "lxml/etree.pyx":1303
 *         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:
 */
    goto __pyx_L31;
  }

  /* "lxml/etree.pyx":1313
 *         else:
 *             # traverse all
 *             while c_child != NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
 */
  /*else*/ {
    while (1) {
      __pyx_t_3 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_3) break;

      /* "lxml/etree.pyx":1314
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1315
 *             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);

        /* "lxml/etree.pyx":1314
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      }

      /* "lxml/etree.pyx":1316
 *                 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;
    }

    /* "lxml/etree.pyx":1317
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
 */
    __pyx_t_3 = (__pyx_v_c_start > 0);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":1318
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
 */
      __pyx_t_3 = (__pyx_v_k >= __pyx_v_c_start);
      if (__pyx_t_3) {

        /* "lxml/etree.pyx":1319
 *             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_ERR(0, 1319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L0;

        /* "lxml/etree.pyx":1318
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
 */
      }

      /* "lxml/etree.pyx":1317
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
 */
      goto __pyx_L41;
    }

    /* "lxml/etree.pyx":1321
 *                     return k
 *             else:
 *                 return k             # <<<<<<<<<<<<<<
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, "list.index(x): x not in slice"
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L41:;
  }
  __pyx_L31:;

  /* "lxml/etree.pyx":1322
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
 */
  __pyx_t_4 = (__pyx_v_c_start != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L44_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_stop != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L44_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1323
 *                 return k
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, "list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "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_ERR(0, 1323, __pyx_L1_error)

    /* "lxml/etree.pyx":1322
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
 */
  }

  /* "lxml/etree.pyx":1325
 *             raise ValueError, "list.index(x): x not in slice"
 *         else:
 *             raise ValueError, "list.index(x): x not in list"             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_list, 0, 0);
    __PYX_ERR(0, 1325, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":1240
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1327
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_46get, "get(self, key, default=None)\n\n        Gets an element attribute.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_47get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_47get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_46get};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1327, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1327, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1327, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1327, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1332
 *         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 == ((int)-1))) __PYX_ERR(0, 1332, __pyx_L1_error)

  /* "lxml/etree.pyx":1333
 *         """
 *         _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_ERR(0, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1327
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1335
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_49keys = {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_49keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_48keys};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1341
 *         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 == ((int)-1))) __PYX_ERR(0, 1341, __pyx_L1_error)

  /* "lxml/etree.pyx":1342
 *         """
 *         _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_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1335
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1344
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_51values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_51values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_50values};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1350
 *         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 == ((int)-1))) __PYX_ERR(0, 1350, __pyx_L1_error)

  /* "lxml/etree.pyx":1351
 *         """
 *         _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_ERR(0, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1344
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1353
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_53items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_53items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_52items};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1359
 *         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 == ((int)-1))) __PYX_ERR(0, 1359, __pyx_L1_error)

  /* "lxml/etree.pyx":1360
 *         """
 *         _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_ERR(0, 1360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1353
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1362
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_55getchildren = {"getchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_55getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_54getchildren};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getchildren", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getchildren", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1372
 *           ``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 == ((int)-1))) __PYX_ERR(0, 1372, __pyx_L1_error)

  /* "lxml/etree.pyx":1373
 *         """
 *         _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_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1362
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1375
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_57getparent = {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_57getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_56getparent};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getparent", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1382
 *         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);

  /* "lxml/etree.pyx":1383
 *         #_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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1384
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1383
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  }

  /* "lxml/etree.pyx":1385
 *         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_ERR(0, 1385, __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;

  /* "lxml/etree.pyx":1375
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1387
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_58getnext, "getnext(self)\n\n        Returns the following sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_59getnext = {"getnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_59getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_58getnext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getnext", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getnext", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1394
 *         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);

  /* "lxml/etree.pyx":1395
 *         #_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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1396
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1395
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  }

  /* "lxml/etree.pyx":1397
 *         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_ERR(0, 1397, __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;

  /* "lxml/etree.pyx":1387
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1399
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_60getprevious, "getprevious(self)\n\n        Returns the preceding sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_61getprevious = {"getprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_61getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_60getprevious};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getprevious", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getprevious", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1406
 *         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);

  /* "lxml/etree.pyx":1407
 *         #_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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1408
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1407
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  }

  /* "lxml/etree.pyx":1409
 *         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_ERR(0, 1409, __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;

  /* "lxml/etree.pyx":1399
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1411
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags,\n        see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_63itersiblings = {"itersiblings", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_63itersiblings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_62itersiblings};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_preceding = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_preceding,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1411, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1411, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "itersiblings") < 0)) __PYX_ERR(0, 1411, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_preceding = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "lxml/etree.pyx":1425
 *         see `iter`.
 *         """
 *         if preceding:             # <<<<<<<<<<<<<<
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_preceding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1425, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1426
 *         """
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:             # <<<<<<<<<<<<<<
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
 */
    __pyx_t_2 = (__pyx_v_self->_c_node != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (!(__pyx_v_self->_c_node->prev != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1427
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
      __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
      goto __pyx_L0;

      /* "lxml/etree.pyx":1426
 *         """
 *         if preceding:
 *             if self._c_node and not self._c_node.prev:             # <<<<<<<<<<<<<<
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
 */
    }

    /* "lxml/etree.pyx":1425
 *         see `iter`.
 *         """
 *         if preceding:             # <<<<<<<<<<<<<<
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1428
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->next != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1429
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:
 *             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;

    /* "lxml/etree.pyx":1428
 *             if self._c_node and not self._c_node.prev:
 *                 return ITER_EMPTY
 *         elif self._c_node and not self._c_node.next:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":1430
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1431
 *             return ITER_EMPTY
 *         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_ERR(0, 1431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(0, 1431, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1431, __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;

    /* "lxml/etree.pyx":1430
 *         elif self._c_node and not self._c_node.next:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)
 */
  }

  /* "lxml/etree.pyx":1432
 *         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_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1432, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags)) __PYX_ERR(0, 1432, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_preceding, __pyx_v_preceding) < 0) __PYX_ERR(0, 1432, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_SiblingsIterator), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1432, __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;

  /* "lxml/etree.pyx":1411
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1434
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags,\n        see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_65iterancestors = {"iterancestors", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_65iterancestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_64iterancestors};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1434, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "iterancestors") < 0)) __PYX_ERR(0, 1434, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "lxml/etree.pyx":1442
 *         see `iter`.
 *         """
 *         if self._c_node and not self._c_node.parent:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->parent != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1443
 *         """
 *         if self._c_node and not self._c_node.parent:
 *             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;

    /* "lxml/etree.pyx":1442
 *         see `iter`.
 *         """
 *         if self._c_node and not self._c_node.parent:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }

  /* "lxml/etree.pyx":1444
 *         if self._c_node and not self._c_node.parent:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1445
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return AncestorsIterator(self, tags)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(0, 1445, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1445, __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;

    /* "lxml/etree.pyx":1444
 *         if self._c_node and not self._c_node.parent:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)
 */
  }

  /* "lxml/etree.pyx":1446
 *         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_ERR(0, 1446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1446, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags)) __PYX_ERR(0, 1446, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_AncestorsIterator), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1446, __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;

  /* "lxml/etree.pyx":1434
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1448
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags, see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_67iterdescendants = {"iterdescendants", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_67iterdescendants, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_66iterdescendants};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "iterdescendants") < 0)) __PYX_ERR(0, 1448, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "lxml/etree.pyx":1457
 *         with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->children != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1458
 *         """
 *         if self._c_node and not self._c_node.children:
 *             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;

    /* "lxml/etree.pyx":1457
 *         with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }

  /* "lxml/etree.pyx":1459
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1460
 *             return ITER_EMPTY
 *         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_ERR(0, 1460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(0, 1460, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1460, __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;

    /* "lxml/etree.pyx":1459
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 */
  }

  /* "lxml/etree.pyx":1461
 *         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_ERR(0, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1461, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags)) __PYX_ERR(0, 1461, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inclusive, Py_False) < 0) __PYX_ERR(0, 1461, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1461, __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;

  /* "lxml/etree.pyx":1448
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1463
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags, see `iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_69iterchildren = {"iterchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_69iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_68iterchildren};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1463, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1463, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "iterchildren") < 0)) __PYX_ERR(0, 1463, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "lxml/etree.pyx":1472
 *         to find only elements with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_2 = (__pyx_v_self->_c_node != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_c_node->children != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1473
 *         """
 *         if self._c_node and not self._c_node.children:
 *             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;

    /* "lxml/etree.pyx":1472
 *         to find only elements with specific tags, see `iter`.
 *         """
 *         if self._c_node and not self._c_node.children:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }

  /* "lxml/etree.pyx":1474
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1475
 *             return ITER_EMPTY
 *         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_ERR(0, 1475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(0, 1475, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1475, __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;

    /* "lxml/etree.pyx":1474
 *         if self._c_node and not self._c_node.children:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)
 */
  }

  /* "lxml/etree.pyx":1476
 *         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_ERR(0, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1476, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags)) __PYX_ERR(0, 1476, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reversed, __pyx_v_reversed) < 0) __PYX_ERR(0, 1476, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementChildIterator), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1476, __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;

  /* "lxml/etree.pyx":1463
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1478
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_71getroottree = {"getroottree", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_71getroottree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_70getroottree};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroottree (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getroottree", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getroottree", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1487
 *         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 == ((int)-1))) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1488
 *         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_ERR(0, 1488, __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;

  /* "lxml/etree.pyx":1478
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1490
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags,\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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_73getiterator = {"getiterator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_73getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_72getiterator};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1490, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "getiterator") < 0)) __PYX_ERR(0, 1490, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1508
 *           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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1509
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag)) __PYX_ERR(0, 1509, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1508
 *           with older versions of lxml or ElementTree.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
 */
  }

  /* "lxml/etree.pyx":1510
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1510, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tags)) __PYX_ERR(0, 1510, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1510, __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;

  /* "lxml/etree.pyx":1490
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":1512
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 specific tags:\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 multiple tags (or a sequence of tags) instead of a single tag\n        will let the iterator return all elements matching any of these tags,\n        in document order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_75iter = {"iter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_75iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_74iter};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1512, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "iter") < 0)) __PYX_ERR(0, 1512, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1532
 *         in document order.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1533
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag)) __PYX_ERR(0, 1533, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1532
 *         in document order.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
 */
  }

  /* "lxml/etree.pyx":1534
 *         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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1534, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tags)) __PYX_ERR(0, 1534, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __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;

  /* "lxml/etree.pyx":1512
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":1536
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 tag names 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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_77itertext = {"itertext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_77itertext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_76itertext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_with_tail,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1536, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1536, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "itertext") < 0)) __PYX_ERR(0, 1536, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_with_tail = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("itertext", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":1547
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1548
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag)) __PYX_ERR(0, 1548, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1547
 *         over tail text.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 */
  }

  /* "lxml/etree.pyx":1549
 *         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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1549, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tags)) __PYX_ERR(0, 1549, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_with_tail, __pyx_v_with_tail) < 0) __PYX_ERR(0, 1549, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_ElementTextIterator), __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1549, __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;

  /* "lxml/etree.pyx":1536
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
 */

  /* 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._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;
}

/* "lxml/etree.pyx":1551
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_79makeelement = {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_79makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_78makeelement};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "makeelement") < 0)) __PYX_ERR(0, 1551, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1551, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1556
 *         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 == ((int)-1))) __PYX_ERR(0, 1556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1557
 *         """
 *         _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);

  /* "lxml/etree.pyx":1558
 *         _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_ERR(0, 1557, __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;

  /* "lxml/etree.pyx":1551
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1560
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_81find = {"find", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_81find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_80find};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "find") < 0)) __PYX_ERR(0, 1560, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1560, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1569
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1570
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1569
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  }

  /* "lxml/etree.pyx":1571
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_find); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1571, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path)) __PYX_ERR(0, 1571, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces)) __PYX_ERR(0, 1571, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1571, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_with_prefixes, __pyx_t_5) < 0) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1560
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_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;
}

/* "lxml/etree.pyx":1573
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_83findtext = {"findtext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_83findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_82findtext};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_default,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1573, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1573, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1573, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findtext") < 0)) __PYX_ERR(0, 1573, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1573, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1582
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1583
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1582
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  }

  /* "lxml/etree.pyx":1584
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_findtext); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1584, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path)) __PYX_ERR(0, 1584, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_default)) __PYX_ERR(0, 1584, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_namespaces)) __PYX_ERR(0, 1584, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1584, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_with_prefixes, __pyx_t_5) < 0) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1573
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_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;
}

/* "lxml/etree.pyx":1586
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_85findall = {"findall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_85findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_84findall};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findall") < 0)) __PYX_ERR(0, 1586, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1586, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1595
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1596
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1595
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  }

  /* "lxml/etree.pyx":1597
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_findall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1597, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path)) __PYX_ERR(0, 1597, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces)) __PYX_ERR(0, 1597, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1597, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_with_prefixes, __pyx_t_5) < 0) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1586
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_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;
}

/* "lxml/etree.pyx":1599
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_87iterfind = {"iterfind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_87iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_86iterfind};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iterfind") < 0)) __PYX_ERR(0, 1599, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1599, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":1608
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1609
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1608
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 */
  }

  /* "lxml/etree.pyx":1610
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1610, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path)) __PYX_ERR(0, 1610, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces)) __PYX_ERR(0, 1610, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree__isHtmlDocument(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1610, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_with_prefixes, __pyx_t_5) < 0) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1599
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_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;
}

/* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_89xpath = {"xpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_89xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_88xpath};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_89xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_smart_strings,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":1613
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values + 0, kwd_pos_args, "xpath") < 0)) __PYX_ERR(0, 1612, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1612, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

  /* function exit code */
  __Pyx_DECREF(__pyx_v__variables);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1618
 *         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_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 1618, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(0, 1618, __pyx_L1_error)

  /* "lxml/etree.pyx":1619
 *         """
 *         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_ERR(0, 1618, __pyx_L1_error)

  /* "lxml/etree.pyx":1620
 *         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_ERR(0, 1618, __pyx_L1_error)

  /* "lxml/etree.pyx":1618
 *         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 *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1618, __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;

  /* "lxml/etree.pyx":1621
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     def cssselect(self, expr, *, translator='xml'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__path)) __PYX_ERR(0, 1621, __pyx_L1_error);
  __pyx_t_2 = PyDict_Copy(__pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__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_ERR(0, 1621, __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;

  /* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """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;
}

/* "lxml/etree.pyx":1623
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_91cssselect(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8_Element_90cssselect, "\n        Run the CSS expression on this element and its children,\n        returning a list of the results.\n\n        Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note\n        that pre-compiling the expression can provide a substantial\n        speedup.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8_Element_91cssselect = {"cssselect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_91cssselect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_90cssselect};
static PyObject *__pyx_pw_4lxml_5etree_8_Element_91cssselect(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_translator = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cssselect (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expr,&__pyx_n_s_translator,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_xml));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_expr)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1623, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1623, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cssselect") < 0)) __PYX_ERR(0, 1623, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_expr = values[0];
    __pyx_v_translator = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cssselect", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1623, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Element.cssselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_90cssselect(((struct LxmlElement *)__pyx_v_self), __pyx_v_expr, __pyx_v_translator);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_90cssselect(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_translator) {
  PyObject *__pyx_v_CSSSelector = 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("cssselect", 1);

  /* "lxml/etree.pyx":1633
 *         """
 *         # Do the import here to make the dependency optional.
 *         from lxml.cssselect import CSSSelector             # <<<<<<<<<<<<<<
 *         return CSSSelector(expr, translator=translator)(self)
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_CSSSelector);
  __Pyx_GIVEREF(__pyx_n_s_CSSSelector);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_CSSSelector)) __PYX_ERR(0, 1633, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml_cssselect, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CSSSelector); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_CSSSelector = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1634
 *         # Do the import here to make the dependency optional.
 *         from lxml.cssselect import CSSSelector
 *         return CSSSelector(expr, translator=translator)(self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_expr);
  __Pyx_GIVEREF(__pyx_v_expr);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_expr)) __PYX_ERR(0, 1634, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_translator, __pyx_v_translator) < 0) __PYX_ERR(0, 1634, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_CSSSelector, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1623
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
 */

  /* 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._Element.cssselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_CSSSelector);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1643
 * 
 * @cython.linetrace(False)
 * 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;
  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("_elementFactory", 1);

  /* "lxml/etree.pyx":1645
 * 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_ERR(0, 1645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1646
 *     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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1647
 *     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;

    /* "lxml/etree.pyx":1646
 *     cdef _Element result
 *     result = getProxy(c_node)
 *     if result is not None:             # <<<<<<<<<<<<<<
 *         return result
 *     if c_node is NULL:
 */
  }

  /* "lxml/etree.pyx":1648
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1649
 *         return result
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(
 */
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":1648
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "lxml/etree.pyx":1652
 * 
 *     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);

  /* "lxml/etree.pyx":1651
 *         return None
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(             # <<<<<<<<<<<<<<
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if hasProxy(c_node):
 */
  __pyx_t_3 = __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_element_class = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1653
 *     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_2 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1653, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1655
 *     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_3 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1653
 *     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)
 */
  }

  /* "lxml/etree.pyx":1656
 *         # 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_3 = PY_NEW(__pyx_v_element_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1656, __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_ERR(0, 1656, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_result, ((struct LxmlElement *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1657
 *         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_2 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1657, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1659
 *     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;

    /* "lxml/etree.pyx":1660
 *         # 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_3 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1657
 *         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
 */
  }

  /* "lxml/etree.pyx":1662
 *         return getProxy(c_node)
 * 
 *     _registerProxy(result, doc, c_node)             # <<<<<<<<<<<<<<
 *     if element_class is not _Element:
 *         result._init()
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_result, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1662, __pyx_L1_error)

  /* "lxml/etree.pyx":1663
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
 */
  __pyx_t_2 = (__pyx_v_element_class != ((PyObject *)__pyx_ptype_4lxml_5etree__Element));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1664
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:
 *         result._init()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_init_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1663
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
 */
  }

  /* "lxml/etree.pyx":1665
 *     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;

  /* "lxml/etree.pyx":1643
 * 
 * @cython.linetrace(False)
 * 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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "lxml/etree.pyx":1670
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, "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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1671
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, "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_ERR(0, 1671, __pyx_L1_error)

  /* "lxml/etree.pyx":1670
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, "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;
  return __pyx_r;
}

/* "lxml/etree.pyx":1673
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_set, "set(self, key, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_1set = {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1673, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1673, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); __PYX_ERR(0, 1673, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set") < 0)) __PYX_ERR(0, 1673, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1673, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1675
 *     def set(self, key, value):
 *         "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 == ((int)-1))) __PYX_ERR(0, 1675, __pyx_L1_error)

  /* "lxml/etree.pyx":1673
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1677
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append, "append(self, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_3append = {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1677, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "append") < 0)) __PYX_ERR(0, 1677, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1677, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_value);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1679
 *     def append(self, value):
 *         "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 == ((int)-1))) __PYX_ERR(0, 1679, __pyx_L1_error)

  /* "lxml/etree.pyx":1677
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1681
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert, "insert(self, index, value)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_5insert = {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_index = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); __PYX_ERR(0, 1681, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "insert") < 0)) __PYX_ERR(0, 1681, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_index = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1681, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1683
 *     def insert(self, index, value):
 *         "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 == ((int)-1))) __PYX_ERR(0, 1683, __pyx_L1_error)

  /* "lxml/etree.pyx":1681
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1685
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         "__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_6__setitem__, "__setitem__(self, index, value)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1687
 *     def __setitem__(self, index, value):
 *         "__setitem__(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1687, __pyx_L1_error)

  /* "lxml/etree.pyx":1685
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         "__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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1689
 *         self._raiseImmutable()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1691
 *     @property
 *     def attrib(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;

  /* "lxml/etree.pyx":1689
 *         self._raiseImmutable()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         return IMMUTABLE_EMPTY_MAPPING
 */

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

/* "lxml/etree.pyx":1694
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1695
 *     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 == ((int)-1))) __PYX_ERR(0, 1695, __pyx_L1_error)

  /* "lxml/etree.pyx":1696
 *         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_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1694
 * 
 *     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;
}

/* "lxml/etree.pyx":1698
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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_value);

  /* "lxml/etree.pyx":1700
 *         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 == ((int)-1))) __PYX_ERR(0, 1700, __pyx_L1_error)

  /* "lxml/etree.pyx":1701
 *             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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1702
 *             _assertValidNode(self)
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = ((const xmlChar *)NULL);

    /* "lxml/etree.pyx":1701
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":1704
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1705
 *             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:;

  /* "lxml/etree.pyx":1706
 *                 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);

  /* "lxml/etree.pyx":1698
 *             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_3);
  __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;
}

/* "lxml/etree.pyx":1709
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         "__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_8__getitem__, "__getitem__(self, x)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);

  /* "lxml/etree.pyx":1711
 *     def __getitem__(self, x):
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_x); 
  if (likely(__pyx_t_1)) {

    /* "lxml/etree.pyx":1712
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):
 *             return []             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "list index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1711
 *     def __getitem__(self, x):
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  }

  /* "lxml/etree.pyx":1714
 *             return []
 *         else:
 *             raise IndexError, "list index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_u_list_index_out_of_range, 0, 0);
    __PYX_ERR(0, 1714, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":1709
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         "__getitem__(self, x)"
 *         if isinstance(x, slice):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "lxml/etree.pyx":1716
 *             raise IndexError, "list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         "__len__(self)"
 *         return 0
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_10__len__, "__len__(self)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;

  /* "lxml/etree.pyx":1718
 *     def __len__(self):
 *         "__len__(self)"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1716
 *             raise IndexError, "list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         "__len__(self)"
 *         return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1720
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get, "get(self, key, default=None)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_13get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1720, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1720, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1720, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1720, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1722
 *     def get(self, key, default=None):
 *         "get(self, key, default=None)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1720
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
 */

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

/* "lxml/etree.pyx":1724
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys, "keys(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_15keys = {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1726
 *     def keys(self):
 *         "keys(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1724
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1728
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items, "items(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_17items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1730
 *     def items(self):
 *         "items(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1728
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1732
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values, "values(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_20__ContentOnlyElement_19values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values};
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1734
 *     def values(self):
 *         "values(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 * cdef class _Comment(__ContentOnlyElement):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1732
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "lxml/etree.pyx":1737
 * 
 * cdef class _Comment(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1739
 *     @property
 *     def tag(self):
 *         return Comment             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1737
 * 
 * cdef class _Comment(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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;
}

/* "lxml/etree.pyx":1741
 *         return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<!--%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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1742
 * 
 *     def __repr__(self):
 *         return "<!--%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_ERR(0, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1742, __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;

  /* "lxml/etree.pyx":1741
 *         return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<!--%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;
}

/* "lxml/etree.pyx":1745
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1747
 *     @property
 *     def tag(self):
 *         return ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 *     property target:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1745
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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;
}

/* "lxml/etree.pyx":1751
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1752
 *         # 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 == ((int)-1))) __PYX_ERR(0, 1752, __pyx_L1_error)

  /* "lxml/etree.pyx":1753
 *         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_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1751
 *     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;
}

/* "lxml/etree.pyx":1755
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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);

  /* "lxml/etree.pyx":1756
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1756, __pyx_L1_error)

  /* "lxml/etree.pyx":1757
 *         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_ERR(0, 1757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1758
 *             _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);

  /* "lxml/etree.pyx":1759
 *             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);

  /* "lxml/etree.pyx":1755
 *             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;
}

/* "lxml/etree.pyx":1761
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __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("__repr__", 1);

  /* "lxml/etree.pyx":1762
 * 
 *     def __repr__(self):
 *         text = self.text             # <<<<<<<<<<<<<<
 *         if text:
 *             return "<?%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_ERR(0, 1762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":1763
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1763, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":1764
 *         text = self.text
 *         if text:
 *             return "<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *         else:
 *             return "<?%s?>" % self.target
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 0;
    __pyx_t_4 = 127;
    __Pyx_INCREF(__pyx_kp_u__32);
    __pyx_t_3 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__32);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__32);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_kp_u__11);
    __pyx_t_3 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__11);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__11);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_text), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_kp_u__33);
    __pyx_t_3 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__33);
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__33);
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1763
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
 */
  }

  /* "lxml/etree.pyx":1766
 *             return "<?%s %s?>" % (self.target, text)
 *         else:
 *             return "<?%s?>" % self.target             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":1761
 *             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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "lxml/etree.pyx":1768
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_22_ProcessingInstruction_3get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get};
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1768, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1768, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1768, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1768, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 1);

  /* "lxml/etree.pyx":1780
 *         It is not guaranteed to work for all possible text content.
 *         """
 *         return self.attrib.get(key, default)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_key, __pyx_v_default};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1780, __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;

  /* "lxml/etree.pyx":1768
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":1782
 *         return self.attrib.get(key, default)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Returns a dict containing all pseudo-attributes that can be
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_8genexpr8__pyx_v_attr = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_value1 = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_value2 = 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;
  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)(PyObject *);
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "lxml/etree.pyx":1789
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1789, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":1790
 *         """
 *         return { attr : (value1 or value2)
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_u__11, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
    __pyx_t_3 = __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1790, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1790, __pyx_L5_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 1790, __pyx_L5_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1790, __pyx_L5_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 1790, __pyx_L5_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1790, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1790, __pyx_L5_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1790, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1790, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1790, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
        index = 0; __pyx_t_4 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(0, 1790, __pyx_L5_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1790, __pyx_L5_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_attr, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_value1, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_value2, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "lxml/etree.pyx":1789
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_8genexpr8__pyx_v_value1); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1789, __pyx_L5_error)
      if (!__pyx_t_12) {
      } else {
        __Pyx_INCREF(__pyx_8genexpr8__pyx_v_value1);
        __pyx_t_2 = __pyx_8genexpr8__pyx_v_value1;
        goto __pyx_L10_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_8genexpr8__pyx_v_value2);
      __pyx_t_2 = __pyx_8genexpr8__pyx_v_value2;
      __pyx_L10_bool_binop_done:;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr8__pyx_v_attr, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1789, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1790
 *         """
 *         return { attr : (value1 or value2)
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_attr); __pyx_8genexpr8__pyx_v_attr = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value1); __pyx_8genexpr8__pyx_v_value1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value2); __pyx_8genexpr8__pyx_v_value2 = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_attr); __pyx_8genexpr8__pyx_v_attr = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value1); __pyx_8genexpr8__pyx_v_value1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value2); __pyx_8genexpr8__pyx_v_value2 = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1782
 *         return self.attrib.get(key, default)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         """Returns a dict containing all pseudo-attributes that can be
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_attr);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value1);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_value2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1795
 * 
 * cdef class _Entity(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1797
 *     @property
 *     def tag(self):
 *         return Entity             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1795
 * 
 * cdef class _Entity(__ContentOnlyElement):
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(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;
}

/* "lxml/etree.pyx":1801
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1802
 *         # 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 == ((int)-1))) __PYX_ERR(0, 1802, __pyx_L1_error)

  /* "lxml/etree.pyx":1803
 *         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_ERR(0, 1803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1801
 *     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;
}

/* "lxml/etree.pyx":1805
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_5;
  Py_UCS4 __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);

  /* "lxml/etree.pyx":1806
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 1806, __pyx_L1_error)

  /* "lxml/etree.pyx":1807
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1808
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__34, __pyx_v_value_utf, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1808, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__35, __pyx_v_value_utf, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1808, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":1809
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 */
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = 127;
    __Pyx_INCREF(__pyx_kp_u_Invalid_entity_name);
    __pyx_t_5 += 21;
    __Pyx_GIVEREF(__pyx_kp_u_Invalid_entity_name);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Invalid_entity_name);
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_5 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__25);
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_7, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 1809, __pyx_L1_error)

    /* "lxml/etree.pyx":1808
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  }

  /* "lxml/etree.pyx":1810
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError, f"Invalid entity name '{value}'"
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "lxml/etree.pyx":1805
 *             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_7);
  __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;
}

/* "lxml/etree.pyx":1812
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __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("__get__", 1);

  /* "lxml/etree.pyx":1816
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 *         # entity value ?
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return f'&{funicode(self._c_node.name)};'
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1816, __pyx_L1_error)

  /* "lxml/etree.pyx":1817
 *         # entity value ?
 *         _assertValidNode(self)
 *         return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_4 = 127;
  __Pyx_INCREF(__pyx_kp_u__34);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__34);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__34);
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__35);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__35);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__35);
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1812
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "lxml/etree.pyx":1819
 *         return f'&{funicode(self._c_node.name)};'
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "&%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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1820
 * 
 *     def __repr__(self):
 *         return "&%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_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1820, __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;

  /* "lxml/etree.pyx":1819
 *         return f'&{funicode(self._c_node.name)};'
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "&%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;
}

/* "lxml/etree.pyx":1847
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
 */

/* 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text_or_uri_or_element,&__pyx_n_s_tag,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text_or_uri_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 1847, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1847, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  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);
  __Pyx_INCREF(__pyx_v_tag);

  /* "lxml/etree.pyx":1848
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:             # <<<<<<<<<<<<<<
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
 */
  __pyx_t_1 = (__pyx_v_text_or_uri_or_element == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1850
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None             # <<<<<<<<<<<<<<
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 */
    __pyx_t_2 = __pyx_v_tag;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1848
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:             # <<<<<<<<<<<<<<
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = tag, None
 */
  }

  /* "lxml/etree.pyx":1851
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = 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));
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1852
 *             text_or_uri_or_element, tag = 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, __pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1853
 *         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, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_text_or_uri_or_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1853, __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;

      /* "lxml/etree.pyx":1854
 *             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, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
 */
      __pyx_t_1 = (!_isString(__pyx_v_text_or_uri_or_element));
      if (unlikely(__pyx_t_1)) {

        /* "lxml/etree.pyx":1855
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"             # <<<<<<<<<<<<<<
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 */
        __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_input_tag_of_type, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 1855, __pyx_L1_error)

        /* "lxml/etree.pyx":1854
 *             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, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
 */
      }

      /* "lxml/etree.pyx":1852
 *             text_or_uri_or_element, tag = 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):
 */
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1856
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, __pyx_ptype_4lxml_5etree_QName); 
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1857
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text             # <<<<<<<<<<<<<<
 *             elif text_or_uri_or_element is not None:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 */
      __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_text_or_uri_or_element)->text;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1856
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
 */
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1858
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_text_or_uri_or_element != Py_None);
    if (likely(__pyx_t_1)) {

      /* "lxml/etree.pyx":1859
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 */
      __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":1858
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             elif text_or_uri_or_element is not None:             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":1861
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 *             else:
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"             # <<<<<<<<<<<<<<
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_input_tag_of_type, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 1861, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":1851
 *             # Allow None as no namespace.
 *             text_or_uri_or_element, tag = 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
 */
  }

  /* "lxml/etree.pyx":1863
 *                 raise ValueError, f"Invalid input tag of type {type(text_or_uri_or_element)!r}"
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1863, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1863, __pyx_L1_error)
  }
  __pyx_v_ns_utf = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag_utf = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1864
 * 
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1866
 *         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_1 = (__pyx_v_ns_utf == Py_None);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":1867
 *             # 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);

      /* "lxml/etree.pyx":1866
 *         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)
 */
    }

    /* "lxml/etree.pyx":1868
 *             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_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_tag_utf, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1864
 * 
 *         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:
 */
  }

  /* "lxml/etree.pyx":1869
 *                 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_5 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_tag_utf); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1869, __pyx_L1_error)

  /* "lxml/etree.pyx":1870
 *             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 '%.30s'", "decode");
    __PYX_ERR(0, 1870, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->localname);
  __Pyx_DECREF(__pyx_v_self->localname);
  __pyx_v_self->localname = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":1871
 *         _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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1872
 *         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);

    /* "lxml/etree.pyx":1873
 *         if ns_utf is None:
 *             self.namespace = None
 *             self.text = self.localname             # <<<<<<<<<<<<<<
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 */
    __pyx_t_3 = __pyx_v_self->localname;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1871
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:             # <<<<<<<<<<<<<<
 *             self.namespace = None
 *             self.text = self.localname
 */
    goto __pyx_L9;
  }

  /* "lxml/etree.pyx":1875
 *             self.text = self.localname
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')             # <<<<<<<<<<<<<<
 *             self.text = "{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 */
  /*else*/ {
    if (unlikely(__pyx_v_ns_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(0, 1875, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_ns_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->namespace);
    __Pyx_DECREF(__pyx_v_self->namespace);
    __pyx_v_self->namespace = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":1876
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%s}%s" % (self.namespace, self.localname)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return self.text
 */
    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = 127;
    __Pyx_INCREF(__pyx_kp_u__18);
    __pyx_t_6 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__18);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__18);
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_self->namespace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
    __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_kp_u__19);
    __pyx_t_6 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__19);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__19);
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_self->localname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
    __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1876, __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->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L9:;

  /* "lxml/etree.pyx":1847
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if text_or_uri_or_element is None:
 *             # Allow None as no namespace.
 */

  /* 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.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_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1877
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1878
 *             self.text = "{%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;

  /* "lxml/etree.pyx":1877
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = "{%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;
}

/* "lxml/etree.pyx":1879
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(self, 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":1880
 *         return self.text
 *     def __hash__(self):
 *         return hash(self.text)             # <<<<<<<<<<<<<<
 *     def __richcmp__(self, 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 == ((Py_hash_t)-1))) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1879
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(self, 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;
}

/* "lxml/etree.pyx":1881
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(other) is QName:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_6__richcmp__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self), ((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__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, 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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "lxml/etree.pyx":1882
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":1883
 *     def __richcmp__(self, other, int op):
 *         try:
 *             if type(other) is QName:             # <<<<<<<<<<<<<<
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 */
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_other)) == ((PyObject *)__pyx_ptype_4lxml_5etree_QName));
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":1884
 *         try:
 *             if type(other) is QName:
 *                 other = (<QName>other).text             # <<<<<<<<<<<<<<
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
 */
        __pyx_t_5 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_other)->text;
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":1883
 *     def __richcmp__(self, other, int op):
 *         try:
 *             if type(other) is QName:             # <<<<<<<<<<<<<<
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 */
        goto __pyx_L9;
      }

      /* "lxml/etree.pyx":1885
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):             # <<<<<<<<<<<<<<
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 */
      __pyx_t_4 = PyUnicode_Check(__pyx_v_other); 
      __pyx_t_6 = (!__pyx_t_4);
      if (__pyx_t_6) {

        /* "lxml/etree.pyx":1886
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)             # <<<<<<<<<<<<<<
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
 */
        __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_v_other); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1886, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":1885
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):             # <<<<<<<<<<<<<<
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 */
      }
      __pyx_L9:;

      /* "lxml/etree.pyx":1882
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":1887
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(self.text, other, op)
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_ValueError, __pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.QName.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 1887, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "lxml/etree.pyx":1888
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(self.text, other, op)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":1882
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 */
    __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_L8_try_end:;
  }

  /* "lxml/etree.pyx":1889
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(self.text, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __pyx_v_self->text;
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1881
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(other) is QName:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __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_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":1844
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "lxml/etree.pyx":1845
 *     """
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "lxml/etree.pyx":1846
 *     cdef readonly unicode text
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace             # <<<<<<<<<<<<<<
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if text_or_uri_or_element is None:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "lxml/etree.pyx":1902
 * 
 *     @cython.final
 *     cdef int _assertHasRoot(self) except -1:             # <<<<<<<<<<<<<<
 *         """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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "lxml/etree.pyx":1908
 *         the caller program.
 *         """
 *         assert self._context_node is not None, \             # <<<<<<<<<<<<<<
 *                "ElementTree not initialized, missing root"
 *         return 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_ElementTree_not_initialized_miss, 0, 0);
      __PYX_ERR(0, 1908, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1908, __pyx_L1_error)
  #endif

  /* "lxml/etree.pyx":1910
 *         assert self._context_node is not None, \
 *                "ElementTree not initialized, missing root"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1902
 * 
 *     @cython.final
 *     cdef int _assertHasRoot(self) except -1:             # <<<<<<<<<<<<<<
 *         """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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":1912
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_1parse = {"parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_1parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_parse};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_source)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parse") < 0)) __PYX_ERR(0, 1912, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1912, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 1912, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  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("parse", 1);

  /* "lxml/etree.pyx":1917
 *         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);

  /* "lxml/etree.pyx":1918
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":1919
 *         cdef _Document doc = None
 *         try:
 *             doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
 */
      __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_ERR(0, 1919, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":1918
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
 */
    }

    /* "lxml/etree.pyx":1924
 *             self._context_node = result_container.result
 *         else:
 *             self._context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *         self._doc = None if self._context_node is not None else doc
 *         return self._context_node
 */
    /*else:*/ {
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L5_except_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_ERR(0, 1924, __pyx_L5_except_error)
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF((PyObject *)__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;
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":1920
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 */
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1920, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 1920, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":1922
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result             # <<<<<<<<<<<<<<
 *         else:
 *             self._context_node = doc.getroot()
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1922, __pyx_L14_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_ERR(0, 1922, __pyx_L14_error)
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF((PyObject *)__pyx_v_self->_context_node);
        __Pyx_DECREF((PyObject *)__pyx_v_self->_context_node);
        __pyx_v_self->_context_node = ((struct LxmlElement *)__pyx_t_7);
        __pyx_t_7 = 0;
      }

      /* "lxml/etree.pyx":1920
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 */
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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_7); __pyx_t_7 = 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_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          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_L5_except_error;
        }
        __pyx_L15:;
      }
      __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;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":1918
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *         except _TargetParserResult as result_container:
 */
    __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_L8_try_end:;
  }

  /* "lxml/etree.pyx":1925
 *         else:
 *             self._context_node = doc.getroot()
 *         self._doc = None if self._context_node is not None else doc             # <<<<<<<<<<<<<<
 *         return self._context_node
 * 
 */
  __pyx_t_17 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_17) {
    __Pyx_INCREF(Py_None);
    __pyx_t_4 = Py_None;
  } else {
    __Pyx_INCREF((PyObject *)__pyx_v_doc);
    __pyx_t_4 = ((PyObject *)__pyx_v_doc);
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Document))))) __PYX_ERR(0, 1925, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":1926
 *             self._context_node = doc.getroot()
 *         self._doc = None if self._context_node is not None else doc
 *         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;

  /* "lxml/etree.pyx":1912
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("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;
}

/* "lxml/etree.pyx":1928
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_2_setroot, "_setroot(self, root)\n\n        Relocate the ElementTree to a new root node.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_3_setroot = {"_setroot", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_2_setroot};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_root = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setroot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_root,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_root)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1928, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_setroot") < 0)) __PYX_ERR(0, 1928, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_root = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_setroot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1928, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree._setroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_5etree__Element, 0, "root", 0))) __PYX_ERR(0, 1928, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_root);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":1933
 *         Relocate the ElementTree to a new root node.
 *         """
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "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 == ((int)-1))) __PYX_ERR(0, 1933, __pyx_L1_error)

  /* "lxml/etree.pyx":1934
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, "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);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":1935
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "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_ERR(0, 1935, __pyx_L1_error)

    /* "lxml/etree.pyx":1934
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Only elements can be the root of an ElementTree"
 *         self._context_node = root
 */
  }

  /* "lxml/etree.pyx":1936
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, "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((PyObject *)__pyx_v_self->_context_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_context_node);
  __pyx_v_self->_context_node = __pyx_v_root;

  /* "lxml/etree.pyx":1937
 *             raise TypeError, "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((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "lxml/etree.pyx":1928
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_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;
}

/* "lxml/etree.pyx":1939
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_4getroot, "getroot(self)\n\n        Gets the root element for this tree.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_5getroot = {"getroot", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_5getroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_4getroot};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getroot", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getroot", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":1944
 *         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;

  /* "lxml/etree.pyx":1939
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
 */

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

/* "lxml/etree.pyx":1946
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_7__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __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__", 1);

  /* "lxml/etree.pyx":1947
 * 
 *     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_ERR(0, 1947, __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;

  /* "lxml/etree.pyx":1946
 *         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;
}

/* "lxml/etree.pyx":1949
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_9__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1949, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(0, 1949, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1949, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("__deepcopy__", 1);

  /* "lxml/etree.pyx":1953
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1954
 *         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_ERR(0, 1954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 1954, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1955
 *         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(__pyx_assertions_enabled())) {
      __pyx_t_1 = (((PyObject *)__pyx_v_root) != Py_None);
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(0, 1955, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1955, __pyx_L1_error)
    #endif

    /* "lxml/etree.pyx":1956
 *             root = self._context_node.__copy__()
 *             assert root is not None
 *             _assertValidNode(root)             # <<<<<<<<<<<<<<
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1956, __pyx_L1_error)

    /* "lxml/etree.pyx":1957
 *             assert root is not None
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 */
    __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 == ((int)-1))) __PYX_ERR(0, 1957, __pyx_L1_error)

    /* "lxml/etree.pyx":1958
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)Py_None), __pyx_v_root)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1953
 *         cdef _Document doc
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node.__copy__()
 *             assert root is not None
 */
  }

  /* "lxml/etree.pyx":1959
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1960
 *             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_2 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_2)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1960, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":1961
 *         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);

    /* "lxml/etree.pyx":1962
 *             _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_1 = (__pyx_v_c_doc == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":1963
 *             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_ERR(0, 1963, __pyx_L1_error)

      /* "lxml/etree.pyx":1962
 *             _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)
 */
    }

    /* "lxml/etree.pyx":1964
 *             if c_doc is NULL:
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(doc, None)
 *         else:
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __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;

    /* "lxml/etree.pyx":1965
 *                 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_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":1959
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 */
  }

  /* "lxml/etree.pyx":1968
 *         else:
 *             # so what ...
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "lxml/etree.pyx":1949
 *         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_2);
  __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;
}

/* "lxml/etree.pyx":1971
 * 
 *     # not in ElementTree
 *     @property             # <<<<<<<<<<<<<<
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "lxml/etree.pyx":1974
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
 *         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 == ((int)-1))) __PYX_ERR(0, 1974, __pyx_L1_error)

  /* "lxml/etree.pyx":1975
 *         """Information about the document provided by parser and DTD."""
 *         self._assertHasRoot()
 *         return DocInfo(self._context_node._doc)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_DocInfo), ((PyObject *)__pyx_v_self->_context_node->_doc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":1971
 * 
 *     # not in ElementTree
 *     @property             # <<<<<<<<<<<<<<
 *     def docinfo(self) -> DocInfo:
 *         """Information about the document provided by parser and DTD."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "lxml/etree.pyx":1978
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def parser(self):
 *         """The parser that was used to parse the document in this ElementTree.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "lxml/etree.pyx":1982
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "lxml/etree.pyx":1983
 *         """
 *         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_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "lxml/etree.pyx":1982
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
 */
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1984
 *         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;

    /* "lxml/etree.pyx":1982
 *         """The parser that was used to parse the document in this ElementTree.
 *         """
 *         if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                self._context_node._doc is not None:
 *             return self._context_node._doc._parser
 */
  }

  /* "lxml/etree.pyx":1985
 *                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_1 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":1986
 *             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;

    /* "lxml/etree.pyx":1985
 *                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
 */
  }

  /* "lxml/etree.pyx":1987
 *         if self._doc is not None:
 *             return self._doc._parser
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "lxml/etree.pyx":1978
 * 
 *     # not in ElementTree, read-only
 *     @property             # <<<<<<<<<<<<<<
 *     def parser(self):
 *         """The parser that was used to parse the document in this ElementTree.
 */

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

/* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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, doctype=None, compression=0,\n                  exclusive=False, inclusive_ns_prefixes=None,\n                  with_comments=True, strip_text=False)\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', 'c14n' or 'c14n2'.  Default is 'xml'.\n\n        With ``method=\"c14n\"`` (C14N version 1), the options ``exclusive``,\n        ``with_comments`` and ``inclusive_ns_prefixes`` request exclusive\n        C14N, include comments, and list the inclusive prefixes respectively.\n\n        With ``method=\"c14n2\"`` (C14N version 2), the ``with_comments`` and\n        ``strip_text`` options control the output of comments and text space\n        according to C14N 2.0.\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 ``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        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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_11write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_11write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_10write};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_xml_declaration = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  PyObject *__pyx_v_compression = 0;
  int __pyx_v_exclusive;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_v_with_comments;
  int __pyx_v_strip_text;
  PyObject *__pyx_v_docstring = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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_doctype,&__pyx_n_s_compression,&__pyx_n_s_exclusive,&__pyx_n_s_inclusive_ns_prefixes,&__pyx_n_s_with_comments,&__pyx_n_s_strip_text,&__pyx_n_s_docstring,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_xml));

    /* "lxml/etree.pyx":1990
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 */
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":1991
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,             # <<<<<<<<<<<<<<
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 */
    values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));

    /* "lxml/etree.pyx":1992
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
 */
    values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":1994
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):             # <<<<<<<<<<<<<<
 *         """write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
 */
    values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1989, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 13)) {
        Py_ssize_t index;
        for (index = 1; index < 14 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1989, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 1989, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    if (values[3]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1990, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":1990
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 */
      __pyx_v_pretty_print = ((int)0);
    }
    __pyx_v_xml_declaration = values[4];
    if (values[5]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1990, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)1);
    }
    __pyx_v_standalone = values[6];
    __pyx_v_doctype = values[7];
    __pyx_v_compression = values[8];
    if (values[9]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1992, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":1992
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
 */
      __pyx_v_exclusive = ((int)0);
    }
    __pyx_v_inclusive_ns_prefixes = values[10];
    if (values[11]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[11]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1993, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":1993
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *               docstring=None):
 *         """write(self, file, encoding=None, method="xml",
 */
      __pyx_v_with_comments = ((int)1);
    }
    if (values[12]) {
      __pyx_v_strip_text = __Pyx_PyObject_IsTrue(values[12]); if (unlikely((__pyx_v_strip_text == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1993, __pyx_L3_error)
    } else {
      __pyx_v_strip_text = ((int)0);
    }
    __pyx_v_docstring = values[13];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1989, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_doctype, __pyx_v_compression, __pyx_v_exclusive, __pyx_v_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_strip_text, __pyx_v_docstring);

  /* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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, int __pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, PyObject *__pyx_v_compression, int __pyx_v_exclusive, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text, PyObject *__pyx_v_docstring) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_v_f = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  PyObject *__pyx_v_warnings = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  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("write", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);
  __Pyx_INCREF(__pyx_v_compression);

  /* "lxml/etree.pyx":2041
 *         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 == ((int)-1))) __PYX_ERR(0, 2041, __pyx_L1_error)

  /* "lxml/etree.pyx":2042
 * 
 *         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 == ((int)-1))) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2043
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  __pyx_t_4 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2044
 *         _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);

    /* "lxml/etree.pyx":2043
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  }

  /* "lxml/etree.pyx":2047
 * 
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 */
  __Pyx_INCREF(__pyx_v_method);
  __pyx_t_2 = __pyx_v_method;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2047, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_u_c14n2, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2047, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_t_3;
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2048
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 */
    __pyx_t_4 = (__pyx_v_encoding != Py_None);
    if (unlikely(__pyx_t_4)) {

      /* "lxml/etree.pyx":2049
 *         if method in ('c14n', 'c14n2'):
 *             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__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2049, __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_ERR(0, 2049, __pyx_L1_error)

      /* "lxml/etree.pyx":2048
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 */
    }

    /* "lxml/etree.pyx":2050
 *             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_4 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2050, __pyx_L1_error)
    if (unlikely(__pyx_t_4)) {

      /* "lxml/etree.pyx":2051
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 * 
 *             if method == 'c14n':
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2051, __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_ERR(0, 2051, __pyx_L1_error)

      /* "lxml/etree.pyx":2050
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 */
    }

    /* "lxml/etree.pyx":2053
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             if method == 'c14n':             # <<<<<<<<<<<<<<
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)
 */
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2053, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2054
 * 
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
      __Pyx_INCREF(__pyx_t_2);

      /* "lxml/etree.pyx":2055
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:
 */
      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2055, __pyx_L1_error)

      /* "lxml/etree.pyx":2054
 * 
 *             if method == 'c14n':
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_v_exclusive, __pyx_v_with_comments, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2054, __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;

      /* "lxml/etree.pyx":2053
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             if method == 'c14n':             # <<<<<<<<<<<<<<
 *                 _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                                 compression, inclusive_ns_prefixes)
 */
      goto __pyx_L11;
    }

    /* "lxml/etree.pyx":2057
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 */
    /*else*/ {
      /*with:*/ {
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2057, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_file);
        __Pyx_GIVEREF(__pyx_v_file);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_file)) __PYX_ERR(0, 2057, __pyx_L1_error);
        __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2057, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_compression, __pyx_v_compression) < 0) __PYX_ERR(0, 2057, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__open_utf8_file, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2057, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2057, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2057, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = NULL;
        __pyx_t_1 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_1 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2057, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_5 = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __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:*/ {
              __pyx_v_f = __pyx_t_5;
              __pyx_t_5 = 0;

              /* "lxml/etree.pyx":2059
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)             # <<<<<<<<<<<<<<
 *                     _tree_to_target(self, target)
 *             return
 */
              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_5);

              /* "lxml/etree.pyx":2058
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)
 */
              __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2058, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_GIVEREF(__pyx_t_5);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 2058, __pyx_L16_error);
              __pyx_t_5 = 0;

              /* "lxml/etree.pyx":2059
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)             # <<<<<<<<<<<<<<
 *                     _tree_to_target(self, target)
 *             return
 */
              __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_with_comments); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_comments, __pyx_t_2) < 0) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_strip_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_strip_text, __pyx_t_2) < 0) __PYX_ERR(0, 2059, __pyx_L16_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2058
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:
 *                     target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)
 */
              __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget), __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2058, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_2);
              __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2060
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
              __pyx_t_2 = __pyx_f_4lxml_5etree__tree_to_target(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2060, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "lxml/etree.pyx":2057
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 */
            }
            __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_L21_try_end;
            __pyx_L16_error:;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 2057, __pyx_L18_except_error)
              __Pyx_XGOTREF(__pyx_t_2);
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2057, __pyx_L18_except_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL);
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2057, __pyx_L18_except_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (__pyx_t_4 < 0) __PYX_ERR(0, 2057, __pyx_L18_except_error)
              __pyx_t_3 = (!__pyx_t_4);
              if (unlikely(__pyx_t_3)) {
                __Pyx_GIVEREF(__pyx_t_2);
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_XGIVEREF(__pyx_t_6);
                __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_5, __pyx_t_6);
                __pyx_t_2 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; 
                __PYX_ERR(0, 2057, __pyx_L18_except_error)
              }
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              goto __pyx_L17_exception_handled;
            }
            __pyx_L18_except_error:;
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
            goto __pyx_L1_error;
            __pyx_L17_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_L21_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_7) {
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2057, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
            goto __pyx_L15;
          }
          __pyx_L15:;
        }
        goto __pyx_L25;
        __pyx_L12_error:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L1_error;
        __pyx_L25:;
      }
    }
    __pyx_L11:;

    /* "lxml/etree.pyx":2061
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 *                     _tree_to_target(self, target)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if not with_comments:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "lxml/etree.pyx":2047
 * 
 *         # C14N serialisation
 *         if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 */
  }

  /* "lxml/etree.pyx":2063
 *             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_3 = (!__pyx_v_with_comments);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":2064
 * 
 *         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__39, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2064, __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_ERR(0, 2064, __pyx_L1_error)

    /* "lxml/etree.pyx":2063
 *             return
 * 
 *         if not with_comments:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 */
  }

  /* "lxml/etree.pyx":2066
 *             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);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2067
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *             if encoding is None:
 *                 encoding = 'ASCII'
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2067, __pyx_L1_error)
    __pyx_v_write_declaration = __pyx_t_3;

    /* "lxml/etree.pyx":2068
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = 'ASCII'
 *             else:
 */
    __pyx_t_3 = (__pyx_v_encoding == Py_None);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":2069
 *             write_declaration = xml_declaration
 *             if encoding is None:
 *                 encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *             else:
 *                 encoding = encoding.upper()
 */
      __Pyx_INCREF(__pyx_n_u_ASCII);
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);

      /* "lxml/etree.pyx":2068
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = 'ASCII'
 *             else:
 */
      goto __pyx_L28;
    }

    /* "lxml/etree.pyx":2071
 *                 encoding = 'ASCII'
 *             else:
 *                 encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *         elif encoding is None:
 *             encoding = 'ASCII'
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = NULL;
      __pyx_t_1 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_1 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2071, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_6);
      __pyx_t_6 = 0;
    }
    __pyx_L28:;

    /* "lxml/etree.pyx":2066
 *             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:
 */
    goto __pyx_L27;
  }

  /* "lxml/etree.pyx":2072
 *             else:
 *                 encoding = encoding.upper()
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = 'ASCII'
 *             write_declaration = 0
 */
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2073
 *                 encoding = encoding.upper()
 *         elif encoding is None:
 *             encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *             write_declaration = 0
 *         else:
 */
    __Pyx_INCREF(__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);

    /* "lxml/etree.pyx":2074
 *         elif encoding is None:
 *             encoding = 'ASCII'
 *             write_declaration = 0             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = encoding.upper()
 */
    __pyx_v_write_declaration = 0;

    /* "lxml/etree.pyx":2072
 *             else:
 *                 encoding = encoding.upper()
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = 'ASCII'
 *             write_declaration = 0
 */
    goto __pyx_L27;
  }

  /* "lxml/etree.pyx":2076
 *             write_declaration = 0
 *         else:
 *             encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_1 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_1 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "lxml/etree.pyx":2077
 *         else:
 *             encoding = encoding.upper()
 *             write_declaration = encoding not in (             # <<<<<<<<<<<<<<
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:
 */
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_6 = __pyx_v_encoding;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u_US_ASCII, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2077, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_ASCII, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2077, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_UTF8, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2077, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u_UTF_8, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2077, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_L29_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_write_declaration = __pyx_t_3;
  }
  __pyx_L27:;

  /* "lxml/etree.pyx":2079
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
 */
  __pyx_t_3 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2080
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:
 *             is_standalone = -1             # <<<<<<<<<<<<<<
 *         elif standalone:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = -1;

    /* "lxml/etree.pyx":2079
 *             write_declaration = encoding not in (
 *                 'US-ASCII', 'ASCII', 'UTF8', 'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
 */
    goto __pyx_L33;
  }

  /* "lxml/etree.pyx":2081
 *         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_ERR(0, 2081, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2082
 *             is_standalone = -1
 *         elif standalone:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 1
 *         else:
 */
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":2083
 *         elif standalone:
 *             write_declaration = 1
 *             is_standalone = 1             # <<<<<<<<<<<<<<
 *         else:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = 1;

    /* "lxml/etree.pyx":2081
 *         if standalone is None:
 *             is_standalone = -1
 *         elif standalone:             # <<<<<<<<<<<<<<
 *             write_declaration = 1
 *             is_standalone = 1
 */
    goto __pyx_L33;
  }

  /* "lxml/etree.pyx":2085
 *             is_standalone = 1
 *         else:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 0
 * 
 */
  /*else*/ {
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":2086
 *         else:
 *             write_declaration = 1
 *             is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *         if docstring is not None and doctype is None:
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L33:;

  /* "lxml/etree.pyx":2088
 *             is_standalone = 0
 * 
 *         if docstring is not None and doctype is None:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
 */
  __pyx_t_4 = (__pyx_v_docstring != Py_None);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_doctype == Py_None);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L35_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2089
 * 
 *         if docstring is not None and doctype is None:
 *             import warnings             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 */
    __pyx_t_6 = __Pyx_ImportDottedModule(__pyx_n_s_warnings, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_warnings = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "lxml/etree.pyx":2090
 *         if docstring is not None and doctype is None:
 *             import warnings
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "lxml/etree.pyx":2092
 *             warnings.warn(
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)             # <<<<<<<<<<<<<<
 *             doctype = docstring
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":2093
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)
 *             doctype = docstring             # <<<<<<<<<<<<<<
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,
 */
    __Pyx_INCREF(__pyx_v_docstring);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_v_docstring);

    /* "lxml/etree.pyx":2088
 *             is_standalone = 0
 * 
 *         if docstring is not None and doctype is None:             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(
 */
  }

  /* "lxml/etree.pyx":2095
 *             doctype = docstring
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_5);

  /* "lxml/etree.pyx":2097
 *         _tofilelike(file, self._context_node, encoding, doctype, 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_ERR(0, 2097, __pyx_L1_error)

  /* "lxml/etree.pyx":2095
 *             doctype = docstring
 * 
 *         _tofilelike(file, self._context_node, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelike(__pyx_v_file, ((struct LxmlElement *)__pyx_t_5), __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, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2095, __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;

  /* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XDECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2099
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_12getpath, "getpath(self, element)\n\n        Returns a structural, absolute XPath expression to find the element.\n\n        For namespaced elements, the expression uses prefixes from the\n        document, which therefore need to be provided in order to make any\n        use of the expression in XPath.\n\n        Also see the method getelementpath(self, element), which returns a\n        self-contained ElementPath expression.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_13getpath = {"getpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_13getpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_12getpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2099, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getpath") < 0)) __PYX_ERR(0, 2099, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2099, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.getpath", __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_ERR(0, 2099, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_12getpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getpath", 1);

  /* "lxml/etree.pyx":2114
 *         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 == ((int)-1))) __PYX_ERR(0, 2114, __pyx_L1_error)

  /* "lxml/etree.pyx":2115
 *         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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2116
 *         _assertValidNode(element)
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *         elif self._doc is not None:
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2117
 *         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_3 = ((PyObject *)__pyx_v_root->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2115
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *             doc = root._doc
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2118
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (likely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2119
 *             doc = root._doc
 *         elif self._doc is not None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             root = doc.getroot()
 *         else:
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2120
 *         elif self._doc is not None:
 *             doc = self._doc
 *             root = doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "Element is not in this tree."
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2120, __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_ERR(0, 2120, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2118
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2122
 *             root = doc.getroot()
 *         else:
 *             raise ValueError, "Element is not in this tree."             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
    __PYX_ERR(0, 2122, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2123
 *         else:
 *             raise ValueError, "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 == ((int)-1))) __PYX_ERR(0, 2123, __pyx_L1_error)

  /* "lxml/etree.pyx":2124
 *             raise ValueError, "Element is not in this tree."
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not doc:
 *             raise ValueError, "Element is not in this tree."
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2124, __pyx_L1_error)

  /* "lxml/etree.pyx":2125
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree."
 * 
 */
  __pyx_t_2 = (__pyx_v_element->_doc != __pyx_v_doc);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2126
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 *             raise ValueError, "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_ERR(0, 2126, __pyx_L1_error)

    /* "lxml/etree.pyx":2125
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree."
 * 
 */
  }

  /* "lxml/etree.pyx":2128
 *             raise ValueError, "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_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root->_c_node); if (unlikely(__pyx_t_4 == ((xmlDoc *)NULL))) __PYX_ERR(0, 2128, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_4;

  /* "lxml/etree.pyx":2129
 * 
 *         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);

  /* "lxml/etree.pyx":2130
 *         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);

  /* "lxml/etree.pyx":2131
 *         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_2 = (__pyx_v_c_path == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2132
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 */
    PyErr_NoMemory(); __PYX_ERR(0, 2132, __pyx_L1_error)

    /* "lxml/etree.pyx":2131
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         path = funicode(c_path)
 */
  }

  /* "lxml/etree.pyx":2133
 *         if c_path is NULL:
 *             raise MemoryError()
 *         path = funicode(c_path)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(c_path)
 *         return path
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2134
 *             raise MemoryError()
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)             # <<<<<<<<<<<<<<
 *         return path
 * 
 */
  xmlFree(__pyx_v_c_path);

  /* "lxml/etree.pyx":2135
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 *         return path             # <<<<<<<<<<<<<<
 * 
 *     def getelementpath(self, _Element element not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_path);
  __pyx_r = __pyx_v_path;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2099
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":2137
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath, "getelementpath(self, element)\n\n        Returns a structural, absolute ElementPath expression to find the\n        element.  This path can be used in the .find() method to look up\n        the element, provided that the elements along the path and their\n        list of immediate children were not modified in between.\n\n        ElementPath has the advantage over an XPath expression (as returned\n        by the .getpath() method) that it does not require additional prefix\n        declarations.  It is always self-contained.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_15getelementpath = {"getelementpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getelementpath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2137, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getelementpath") < 0)) __PYX_ERR(0, 2137, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getelementpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2137, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.getelementpath", __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_ERR(0, 2137, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_14getelementpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14getelementpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  struct LxmlElement *__pyx_v_root = 0;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_v_path = NULL;
  xmlNode *__pyx_v_c_element;
  const xmlChar *__pyx_v_c_name;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_tag = NULL;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlNode *__pyx_t_4;
  const xmlChar *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getelementpath", 1);

  /* "lxml/etree.pyx":2151
 *         cdef _Element root
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2151, __pyx_L1_error)

  /* "lxml/etree.pyx":2152
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
 */
  __pyx_t_2 = (__pyx_v_element->_c_node->type != XML_ELEMENT_NODE);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2153
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"             # <<<<<<<<<<<<<<
 *         if self._context_node is not None:
 *             root = self._context_node
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_input_is_not_an_Element, 0, 0);
    __PYX_ERR(0, 2153, __pyx_L1_error)

    /* "lxml/etree.pyx":2152
 *         cdef Py_ssize_t count
 *         _assertValidNode(element)
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
 */
  }

  /* "lxml/etree.pyx":2154
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *         elif self._doc is not None:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2155
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             root = self._doc.getroot()
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2154
 *         if element._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise ValueError, "input is not an Element"
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *         elif self._doc is not None:
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2156
 *         if self._context_node is not None:
 *             root = self._context_node
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *         else:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (likely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2157
 *             root = self._context_node
 *         elif self._doc is not None:
 *             root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, "Element is not in this tree"
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2157, __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_ERR(0, 2157, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2156
 *         if self._context_node is not None:
 *             root = self._context_node
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *         else:
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2159
 *             root = self._doc.getroot()
 *         else:
 *             raise ValueError, "Element is not in this tree"             # <<<<<<<<<<<<<<
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree_2, 0, 0);
    __PYX_ERR(0, 2159, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":2160
 *         else:
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not root._doc:
 *             raise ValueError, "Element is not in this tree"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2160, __pyx_L1_error)

  /* "lxml/etree.pyx":2161
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree"
 * 
 */
  __pyx_t_2 = (__pyx_v_element->_doc != __pyx_v_root->_doc);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2162
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:
 *             raise ValueError, "Element is not in this tree"             # <<<<<<<<<<<<<<
 * 
 *         path = []
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree_2, 0, 0);
    __PYX_ERR(0, 2162, __pyx_L1_error)

    /* "lxml/etree.pyx":2161
 *             raise ValueError, "Element is not in this tree"
 *         _assertValidNode(root)
 *         if element._doc is not root._doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Element is not in this tree"
 * 
 */
  }

  /* "lxml/etree.pyx":2164
 *             raise ValueError, "Element is not in this tree"
 * 
 *         path = []             # <<<<<<<<<<<<<<
 *         c_element = element._c_node
 *         while c_element is not root._c_node:
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2165
 * 
 *         path = []
 *         c_element = element._c_node             # <<<<<<<<<<<<<<
 *         while c_element is not root._c_node:
 *             c_name = c_element.name
 */
  __pyx_t_4 = __pyx_v_element->_c_node;
  __pyx_v_c_element = __pyx_t_4;

  /* "lxml/etree.pyx":2166
 *         path = []
 *         c_element = element._c_node
 *         while c_element is not root._c_node:             # <<<<<<<<<<<<<<
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_element != __pyx_v_root->_c_node);
    if (!__pyx_t_2) break;

    /* "lxml/etree.pyx":2167
 *         c_element = element._c_node
 *         while c_element is not root._c_node:
 *             c_name = c_element.name             # <<<<<<<<<<<<<<
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 */
    __pyx_t_5 = __pyx_v_c_element->name;
    __pyx_v_c_name = __pyx_t_5;

    /* "lxml/etree.pyx":2168
 *         while c_element is not root._c_node:
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)             # <<<<<<<<<<<<<<
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:
 */
    __pyx_v_c_href = _getNs(__pyx_v_c_element);

    /* "lxml/etree.pyx":2169
 *             c_name = c_element.name
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)             # <<<<<<<<<<<<<<
 *             if c_href is NULL:
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2170
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:             # <<<<<<<<<<<<<<
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
 */
    __pyx_t_2 = (__pyx_v_c_href == NULL);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2171
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)             # <<<<<<<<<<<<<<
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0
 */
      __pyx_v_c_href = ((const xmlChar *)((const xmlChar *)((char const *)"")));

      /* "lxml/etree.pyx":2170
 *             c_href = _getNs(c_element)
 *             tag = _namespacedNameFromNsName(c_href, c_name)
 *             if c_href is NULL:             # <<<<<<<<<<<<<<
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
 */
    }

    /* "lxml/etree.pyx":2173
 *                 c_href = <const_xmlChar*>b''  # no namespace (NULL is wildcard)
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0             # <<<<<<<<<<<<<<
 *             c_node = c_element.prev
 *             while c_node is not NULL:
 */
    __pyx_v_count = 0;

    /* "lxml/etree.pyx":2174
 *             # use tag[N] if there are preceding siblings with the same tag
 *             count = 0
 *             c_node = c_element.prev             # <<<<<<<<<<<<<<
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 */
    __pyx_t_4 = __pyx_v_c_element->prev;
    __pyx_v_c_node = __pyx_t_4;

    /* "lxml/etree.pyx":2175
 *             count = 0
 *             c_node = c_element.prev
 *             while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_2) break;

      /* "lxml/etree.pyx":2176
 *             c_node = c_element.prev
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
 */
      __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":2177
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                         count += 1
 *                 c_node = c_node.prev
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":2178
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1             # <<<<<<<<<<<<<<
 *                 c_node = c_node.prev
 *             if count:
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "lxml/etree.pyx":2177
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:
 *                     if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                         count += 1
 *                 c_node = c_node.prev
 */
        }

        /* "lxml/etree.pyx":2176
 *             c_node = c_element.prev
 *             while c_node is not NULL:
 *                 if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
 */
      }

      /* "lxml/etree.pyx":2179
 *                     if _tagMatches(c_node, c_href, c_name):
 *                         count += 1
 *                 c_node = c_node.prev             # <<<<<<<<<<<<<<
 *             if count:
 *                 tag = f'{tag}[{count+1}]'
 */
      __pyx_t_4 = __pyx_v_c_node->prev;
      __pyx_v_c_node = __pyx_t_4;
    }

    /* "lxml/etree.pyx":2180
 *                         count += 1
 *                 c_node = c_node.prev
 *             if count:             # <<<<<<<<<<<<<<
 *                 tag = f'{tag}[{count+1}]'
 *             else:
 */
    __pyx_t_2 = (__pyx_v_count != 0);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2181
 *                 c_node = c_node.prev
 *             if count:
 *                 tag = f'{tag}[{count+1}]'             # <<<<<<<<<<<<<<
 *             else:
 *                 # use tag[1] if there are following siblings with the same tag
 */
      __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = 0;
      __pyx_t_7 = 127;
      __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7;
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_kp_u__41);
      __pyx_t_6 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__41);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u__41);
      __pyx_t_8 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_v_count + 1), 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_kp_u__42);
      __pyx_t_6 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__42);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_kp_u__42);
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "lxml/etree.pyx":2180
 *                         count += 1
 *                 c_node = c_node.prev
 *             if count:             # <<<<<<<<<<<<<<
 *                 tag = f'{tag}[{count+1}]'
 *             else:
 */
      goto __pyx_L13;
    }

    /* "lxml/etree.pyx":2184
 *             else:
 *                 # use tag[1] if there are following siblings with the same tag
 *                 c_node = c_element.next             # <<<<<<<<<<<<<<
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_c_element->next;
      __pyx_v_c_node = __pyx_t_4;

      /* "lxml/etree.pyx":2185
 *                 # use tag[1] if there are following siblings with the same tag
 *                 c_node = c_element.next
 *                 while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):
 */
      while (1) {
        __pyx_t_2 = (__pyx_v_c_node != NULL);
        if (!__pyx_t_2) break;

        /* "lxml/etree.pyx":2186
 *                 c_node = c_element.next
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
 */
        __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
        if (__pyx_t_2) {

          /* "lxml/etree.pyx":2187
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                             tag += '[1]'
 *                             break
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
          if (__pyx_t_2) {

            /* "lxml/etree.pyx":2188
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'             # <<<<<<<<<<<<<<
 *                             break
 *                     c_node = c_node.next
 */
            __pyx_t_8 = __Pyx_PyUnicode_ConcatInPlaceSafe(__pyx_v_tag, __pyx_kp_u_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2188, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_8));
            __pyx_t_8 = 0;

            /* "lxml/etree.pyx":2189
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
 *                             break             # <<<<<<<<<<<<<<
 *                     c_node = c_node.next
 * 
 */
            goto __pyx_L15_break;

            /* "lxml/etree.pyx":2187
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:
 *                         if _tagMatches(c_node, c_href, c_name):             # <<<<<<<<<<<<<<
 *                             tag += '[1]'
 *                             break
 */
          }

          /* "lxml/etree.pyx":2186
 *                 c_node = c_element.next
 *                 while c_node is not NULL:
 *                     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                         if _tagMatches(c_node, c_href, c_name):
 *                             tag += '[1]'
 */
        }

        /* "lxml/etree.pyx":2190
 *                             tag += '[1]'
 *                             break
 *                     c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *             path.append(tag)
 */
        __pyx_t_4 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_4;
      }
      __pyx_L15_break:;
    }
    __pyx_L13:;

    /* "lxml/etree.pyx":2192
 *                     c_node = c_node.next
 * 
 *             path.append(tag)             # <<<<<<<<<<<<<<
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_path, __pyx_v_tag); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 2192, __pyx_L1_error)

    /* "lxml/etree.pyx":2193
 * 
 *             path.append(tag)
 *             c_element = c_element.parent             # <<<<<<<<<<<<<<
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
 */
    __pyx_t_4 = __pyx_v_c_element->parent;
    __pyx_v_c_element = __pyx_t_4;

    /* "lxml/etree.pyx":2194
 *             path.append(tag)
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
 */
    __pyx_t_10 = (__pyx_v_c_element == NULL);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_10 = (__pyx_v_c_element->type != XML_ELEMENT_NODE);
    __pyx_t_2 = __pyx_t_10;
    __pyx_L19_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":2195
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."             # <<<<<<<<<<<<<<
 *         if not path:
 *             return '.'
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
      __PYX_ERR(0, 2195, __pyx_L1_error)

      /* "lxml/etree.pyx":2194
 *             path.append(tag)
 *             c_element = c_element.parent
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
 */
    }
  }

  /* "lxml/etree.pyx":2196
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:             # <<<<<<<<<<<<<<
 *             return '.'
 *         path.reverse()
 */
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_path) != 0);
  __pyx_t_10 = (!__pyx_t_2);
  if (__pyx_t_10) {

    /* "lxml/etree.pyx":2197
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:
 *             return '.'             # <<<<<<<<<<<<<<
 *         path.reverse()
 *         return '/'.join(path)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__4);
    __pyx_r = __pyx_kp_u__4;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2196
 *             if c_element is NULL or c_element.type != tree.XML_ELEMENT_NODE:
 *                 raise ValueError, "Element is not in this tree."
 *         if not path:             # <<<<<<<<<<<<<<
 *             return '.'
 *         path.reverse()
 */
  }

  /* "lxml/etree.pyx":2198
 *         if not path:
 *             return '.'
 *         path.reverse()             # <<<<<<<<<<<<<<
 *         return '/'.join(path)
 * 
 */
  __pyx_t_9 = PyList_Reverse(__pyx_v_path); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 2198, __pyx_L1_error)

  /* "lxml/etree.pyx":2199
 *             return '.'
 *         path.reverse()
 *         return '/'.join(path)             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyUnicode_Join(__pyx_kp_u__43, __pyx_v_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2137
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getelementpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2201
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_16getiterator, "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 specific tags,\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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_17getiterator = {"getiterator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_16getiterator};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "getiterator") < 0)) __PYX_ERR(0, 2201, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_16getiterator(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16getiterator(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;
  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("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":2218
 *           with older versions of lxml or ElementTree.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2219
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_5 = (__pyx_v_root == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2220
 *         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;

    /* "lxml/etree.pyx":2219
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }

  /* "lxml/etree.pyx":2221
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.getiterator(*tags)
 */
  __pyx_t_5 = (__pyx_v_tag != Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2222
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.getiterator(*tags)
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag)) __PYX_ERR(0, 2222, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2221
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.getiterator(*tags)
 */
  }

  /* "lxml/etree.pyx":2223
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.getiterator(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_getiterator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_tags, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2223, __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;

  /* "lxml/etree.pyx":2201
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """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_3);
  __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;
}

/* "lxml/etree.pyx":2225
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_18iter, "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.  Note that siblings\n        of the root element (comments or processing instructions) are not\n        returned by the iterator.\n\n        Can be restricted to find only elements with specific tags,\n        see `_Element.iter`.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_19iter = {"iter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_19iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_18iter};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tags = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tags)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tags);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2225, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "iter") < 0)) __PYX_ERR(0, 2225, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_18iter(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_tags);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18iter(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;
  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("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "lxml/etree.pyx":2236
 *         see `_Element.iter`.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2237
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_5 = (__pyx_v_root == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2238
 *         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;

    /* "lxml/etree.pyx":2237
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  }

  /* "lxml/etree.pyx":2239
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.iter(*tags)
 */
  __pyx_t_5 = (__pyx_v_tag != Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2240
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.iter(*tags)
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag)) __PYX_ERR(0, 2240, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2239
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.iter(*tags)
 */
  }

  /* "lxml/etree.pyx":2241
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.iter(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_iter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_tags, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2241, __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;

  /* "lxml/etree.pyx":2225
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """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_3);
  __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;
}

/* "lxml/etree.pyx":2243
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_20find, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_21find = {"find", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_21find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_20find};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2243, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2243, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "find") < 0)) __PYX_ERR(0, 2243, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2243, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_20find(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = 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("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2253
 *         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 == ((int)-1))) __PYX_ERR(0, 2253, __pyx_L1_error)

  /* "lxml/etree.pyx":2254
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2255
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2256
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__43, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2256, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2257
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
 */
      __pyx_t_2 = PyNumber_Add(__pyx_kp_u__4, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2258
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_warn);
      __Pyx_GIVEREF(__pyx_n_s_warn);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn)) __PYX_ERR(0, 2258, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_warn = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2262
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
 */
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "lxml/etree.pyx":2260
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 */
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2259
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 2259, __pyx_L1_error);
      __Pyx_INCREF(__pyx_builtin_FutureWarning);
      __Pyx_GIVEREF(__pyx_builtin_FutureWarning);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_FutureWarning)) __PYX_ERR(0, 2259, __pyx_L1_error);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2263
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.find(path, namespaces)
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stacklevel, __pyx_int_1) < 0) __PYX_ERR(0, 2263, __pyx_L1_error)

      /* "lxml/etree.pyx":2259
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2256
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    }

    /* "lxml/etree.pyx":2255
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  }

  /* "lxml/etree.pyx":2265
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.find(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_find); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_1, 2+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2265, __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;

  /* "lxml/etree.pyx":2243
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2267
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_22findtext, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_23findtext = {"findtext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_23findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_22findtext};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findtext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_default,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2267, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2267, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2267, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findtext") < 0)) __PYX_ERR(0, 2267, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2267, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_22findtext(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findtext(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = 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("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2277
 *         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 == ((int)-1))) __PYX_ERR(0, 2277, __pyx_L1_error)

  /* "lxml/etree.pyx":2278
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2279
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2280
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__43, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2281
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
 */
      __pyx_t_2 = PyNumber_Add(__pyx_kp_u__4, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2282
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_warn);
      __Pyx_GIVEREF(__pyx_n_s_warn);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn)) __PYX_ERR(0, 2282, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_warn = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2286
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
 */
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "lxml/etree.pyx":2284
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 */
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2283
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 2283, __pyx_L1_error);
      __Pyx_INCREF(__pyx_builtin_FutureWarning);
      __Pyx_GIVEREF(__pyx_builtin_FutureWarning);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_FutureWarning)) __PYX_ERR(0, 2283, __pyx_L1_error);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2287
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.findtext(path, default, namespaces)
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stacklevel, __pyx_int_1) < 0) __PYX_ERR(0, 2287, __pyx_L1_error)

      /* "lxml/etree.pyx":2283
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2280
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    }

    /* "lxml/etree.pyx":2279
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  }

  /* "lxml/etree.pyx":2289
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.findtext(path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_findtext); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_path, __pyx_v_default, __pyx_v_namespaces};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_1, 3+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2289, __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;

  /* "lxml/etree.pyx":2267
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2291
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_24findall, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_25findall = {"findall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_25findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_24findall};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25findall(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findall") < 0)) __PYX_ERR(0, 2291, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2291, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_24findall(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_24findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = 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("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2301
 *         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 == ((int)-1))) __PYX_ERR(0, 2301, __pyx_L1_error)

  /* "lxml/etree.pyx":2302
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2303
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2304
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__43, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2304, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2305
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
 */
      __pyx_t_2 = PyNumber_Add(__pyx_kp_u__4, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2306
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_warn);
      __Pyx_GIVEREF(__pyx_n_s_warn);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn)) __PYX_ERR(0, 2306, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_warn = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2310
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
 */
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "lxml/etree.pyx":2308
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 */
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2307
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 2307, __pyx_L1_error);
      __Pyx_INCREF(__pyx_builtin_FutureWarning);
      __Pyx_GIVEREF(__pyx_builtin_FutureWarning);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_FutureWarning)) __PYX_ERR(0, 2307, __pyx_L1_error);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2311
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.findall(path, namespaces)
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2311, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stacklevel, __pyx_int_1) < 0) __PYX_ERR(0, 2311, __pyx_L1_error)

      /* "lxml/etree.pyx":2307
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2304
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    }

    /* "lxml/etree.pyx":2303
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  }

  /* "lxml/etree.pyx":2313
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.findall(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_findall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_1, 2+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2313, __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;

  /* "lxml/etree.pyx":2291
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2315
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_26iterfind, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_27iterfind = {"iterfind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_26iterfind};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2315, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2315, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iterfind") < 0)) __PYX_ERR(0, 2315, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2315, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_26iterfind(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_warn = 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("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "lxml/etree.pyx":2325
 *         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 == ((int)-1))) __PYX_ERR(0, 2325, __pyx_L1_error)

  /* "lxml/etree.pyx":2326
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2327
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_5 = _isString(__pyx_v_path);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2328
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__43, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "lxml/etree.pyx":2329
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *                 from warnings import warn
 *                 warn(
 */
      __pyx_t_2 = PyNumber_Add(__pyx_kp_u__4, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2330
 *             if path[:1] == "/":
 *                 path = "." + path
 *                 from warnings import warn             # <<<<<<<<<<<<<<
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_warn);
      __Pyx_GIVEREF(__pyx_n_s_warn);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn)) __PYX_ERR(0, 2330, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_warn = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2334
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",             # <<<<<<<<<<<<<<
 *                     FutureWarning, stacklevel=1
 *                 )
 */
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_path), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "lxml/etree.pyx":2332
 *                 from warnings import warn
 *                 warn(
 *                     "This search incorrectly ignores the root element, and will be "             # <<<<<<<<<<<<<<
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 */
      __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_This_search_incorrectly_ignores, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":2331
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 2331, __pyx_L1_error);
      __Pyx_INCREF(__pyx_builtin_FutureWarning);
      __Pyx_GIVEREF(__pyx_builtin_FutureWarning);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_FutureWarning)) __PYX_ERR(0, 2331, __pyx_L1_error);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2335
 *                     "fixed in a future version.  If you rely on the current "
 *                     f"behaviour, change it to {path!r}",
 *                     FutureWarning, stacklevel=1             # <<<<<<<<<<<<<<
 *                 )
 *         return root.iterfind(path, namespaces)
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stacklevel, __pyx_int_1) < 0) __PYX_ERR(0, 2335, __pyx_L1_error)

      /* "lxml/etree.pyx":2331
 *                 path = "." + path
 *                 from warnings import warn
 *                 warn(             # <<<<<<<<<<<<<<
 *                     "This search incorrectly ignores the root element, and will be "
 *                     "fixed in a future version.  If you rely on the current "
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":2328
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
    }

    /* "lxml/etree.pyx":2327
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  }

  /* "lxml/etree.pyx":2337
 *                     FutureWarning, stacklevel=1
 *                 )
 *         return root.iterfind(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_path, __pyx_v_namespaces};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_1, 2+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2337, __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;

  /* "lxml/etree.pyx":2315
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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_warn);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_28xpath, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_29xpath = {"xpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_29xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_28xpath};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xpath(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_smart_strings,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":2340
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2339, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2339, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values + 0, kwd_pos_args, "xpath") < 0)) __PYX_ERR(0, 2339, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2339, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_28xpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_smart_strings, __pyx_v__variables);

  /* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

  /* function exit code */
  __Pyx_DECREF(__pyx_v__variables);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xpath(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", 1);

  /* "lxml/etree.pyx":2358
 *         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 == ((int)-1))) __PYX_ERR(0, 2358, __pyx_L1_error)

  /* "lxml/etree.pyx":2359
 *         """
 *         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_ERR(0, 2359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 2359, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(0, 2359, __pyx_L1_error)

  /* "lxml/etree.pyx":2360
 *         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_ERR(0, 2359, __pyx_L1_error)

  /* "lxml/etree.pyx":2361
 *         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_ERR(0, 2359, __pyx_L1_error)

  /* "lxml/etree.pyx":2359
 *         """
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2359, __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;

  /* "lxml/etree.pyx":2362
 *                                            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_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__path)) __PYX_ERR(0, 2362, __pyx_L1_error);
  __pyx_t_3 = PyDict_Copy(__pyx_v__variables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__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_ERR(0, 2362, __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;

  /* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """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;
}

/* "lxml/etree.pyx":2364
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31xslt(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_30xslt, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_31xslt = {"xslt", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_31xslt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_30xslt};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31xslt(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__xslt = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_access_control = 0;
  PyObject *__pyx_v__kw = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__kw = PyDict_New(); if (unlikely(!__pyx_v__kw)) return NULL;
  __Pyx_GOTREF(__pyx_v__kw);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xslt,&__pyx_n_s_extensions,&__pyx_n_s_access_control,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xslt)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2364, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extensions);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2364, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_access_control);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2364, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__kw, values + 0, kwd_pos_args, "xslt") < 0)) __PYX_ERR(0, 2364, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xslt", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2364, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_30xslt(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__xslt, __pyx_v_extensions, __pyx_v_access_control, __pyx_v__kw);

  /* function exit code */
  __Pyx_DECREF(__pyx_v__kw);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_30xslt(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", 1);

  /* "lxml/etree.pyx":2378
 *         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 == ((int)-1))) __PYX_ERR(0, 2378, __pyx_L1_error)

  /* "lxml/etree.pyx":2379
 *         """
 *         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_ERR(0, 2379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v__xslt);
  __Pyx_GIVEREF(__pyx_v__xslt);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__xslt)) __PYX_ERR(0, 2379, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, __pyx_v_extensions) < 0) __PYX_ERR(0, 2379, __pyx_L1_error)

  /* "lxml/etree.pyx":2380
 *         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_ERR(0, 2379, __pyx_L1_error)

  /* "lxml/etree.pyx":2379
 *         """
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,             # <<<<<<<<<<<<<<
 *                      access_control=access_control)
 *         return style(self, **_kw)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLT), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2379, __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;

  /* "lxml/etree.pyx":2381
 *         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_ERR(0, 2381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 2381, __pyx_L1_error);
  __pyx_t_3 = PyDict_Copy(__pyx_v__kw); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2381, __pyx_L1_error)
  __Pyx_GOTREF(__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_ERR(0, 2381, __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;

  /* "lxml/etree.pyx":2364
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":2383
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_32relaxng, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_33relaxng = {"relaxng", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_32relaxng};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_relaxng = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("relaxng (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_relaxng,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_relaxng)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2383, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "relaxng") < 0)) __PYX_ERR(0, 2383, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_relaxng = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("relaxng", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2383, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.relaxng", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_32relaxng(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_relaxng);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_32relaxng(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", 1);

  /* "lxml/etree.pyx":2397
 *         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 == ((int)-1))) __PYX_ERR(0, 2397, __pyx_L1_error)

  /* "lxml/etree.pyx":2398
 *         """
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNG), __pyx_v_relaxng); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2399
 *         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_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2399, __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;

  /* "lxml/etree.pyx":2383
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":2401
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_35xmlschema = {"xmlschema", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_xmlschema = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xmlschema (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xmlschema,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xmlschema)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2401, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "xmlschema") < 0)) __PYX_ERR(0, 2401, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_xmlschema = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xmlschema", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2401, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ElementTree.xmlschema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_xmlschema);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xmlschema(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", 1);

  /* "lxml/etree.pyx":2415
 *         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 == ((int)-1))) __PYX_ERR(0, 2415, __pyx_L1_error)

  /* "lxml/etree.pyx":2416
 *         """
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_XMLSchema), __pyx_v_xmlschema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2417
 *         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_ERR(0, 2417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2417, __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;

  /* "lxml/etree.pyx":2401
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":2419
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_36xinclude, "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 PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_37xinclude = {"xinclude", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_36xinclude};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xinclude (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("xinclude", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "xinclude", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36xinclude(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", 1);

  /* "lxml/etree.pyx":2431
 *         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 == ((int)-1))) __PYX_ERR(0, 2431, __pyx_L1_error)

  /* "lxml/etree.pyx":2432
 *         """
 *         self._assertHasRoot()
 *         XInclude()(self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree_XInclude)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self->_context_node)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2419
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_12_ElementTree_38write_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\n        NOTE: This method is deprecated as of lxml 4.4 and will be removed in a\n        future release.  Use ``.write(f, method=\"c14n\")`` instead.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ElementTree_39write_c14n = {"write_c14n", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_38write_c14n};
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  int __pyx_v_exclusive;
  int __pyx_v_with_comments;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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};
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));

    /* "lxml/etree.pyx":2435
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
 *                    compression=0, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 *                        compression=0, inclusive_ns_prefixes=None)
 */
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2434, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2434, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_c14n") < 0)) __PYX_ERR(0, 2434, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_file = values[0];
    if (values[1]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2434, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 */
      __pyx_v_exclusive = ((int)0);
    }
    if (values[2]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2434, __pyx_L3_error)
    } else {
      __pyx_v_with_comments = ((int)1);
    }
    __pyx_v_compression = values[3];
    __pyx_v_inclusive_ns_prefixes = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_c14n", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2434, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_38write_c14n(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_file, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_compression, __pyx_v_inclusive_ns_prefixes);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_38write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, int __pyx_v_exclusive, int __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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_c14n", 0);
  __Pyx_INCREF(__pyx_v_compression);

  /* "lxml/etree.pyx":2456
 *         future release.  Use ``.write(f, method="c14n")`` instead.
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 2456, __pyx_L1_error)

  /* "lxml/etree.pyx":2457
 *         """
 *         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 == ((int)-1))) __PYX_ERR(0, 2457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2458
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  __pyx_t_4 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2458, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2459
 *         _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);

    /* "lxml/etree.pyx":2458
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  }

  /* "lxml/etree.pyx":2461
 *             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);

  /* "lxml/etree.pyx":2462
 * 
 *         _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_ERR(0, 2462, __pyx_L1_error)

  /* "lxml/etree.pyx":2461
 *             compression = 0
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression, inclusive_ns_prefixes)
 * 
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_v_exclusive, __pyx_v_with_comments, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2461, __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;

  /* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """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_5);
  __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;
}

/* "lxml/etree.pyx":2464
 *                         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", 1);

  /* "lxml/etree.pyx":2465
 * 
 * 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 *)__pyx_ptype_4lxml_5etree__ElementTree))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2464
 *                         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;
}

/* "lxml/etree.pyx":2467
 *     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;
  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("_newElementTree", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_context_node);

  /* "lxml/etree.pyx":2470
 *                                   object baseclass):
 *     cdef _ElementTree result
 *     result = baseclass()             # <<<<<<<<<<<<<<
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 */
  __Pyx_INCREF(__pyx_v_baseclass);
  __pyx_t_2 = __pyx_v_baseclass; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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__ElementTree))))) __PYX_ERR(0, 2470, __pyx_L1_error)
  __pyx_v_result = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2471
 *     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_6 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (((PyObject *)__pyx_v_doc) != Py_None);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2472
 *     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_ERR(0, 2472, __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_ERR(0, 2472, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_context_node, ((struct LxmlElement *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":2471
 *     cdef _ElementTree result
 *     result = baseclass()
 *     if context_node is None and doc is not None:             # <<<<<<<<<<<<<<
 *         context_node = doc.getroot()
 *     if context_node is None:
 */
  }

  /* "lxml/etree.pyx":2473
 *     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_5 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":2474
 *         context_node = doc.getroot()
 *     if context_node is None:
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         result._doc = doc
 *     else:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 2474, __pyx_L1_error)

    /* "lxml/etree.pyx":2475
 *     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((PyObject *)__pyx_v_result->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_result->_doc);
    __pyx_v_result->_doc = __pyx_v_doc;

    /* "lxml/etree.pyx":2473
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 *     if context_node is None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         result._doc = doc
 */
    goto __pyx_L6;
  }

  /* "lxml/etree.pyx":2477
 *         result._doc = doc
 *     else:
 *         _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     result._context_node = context_node
 *     return result
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 2477, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "lxml/etree.pyx":2478
 *     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((PyObject *)__pyx_v_result->_context_node);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_context_node);
  __pyx_v_result->_context_node = __pyx_v_context_node;

  /* "lxml/etree.pyx":2479
 *         _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;

  /* "lxml/etree.pyx":2467
 *     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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":2488
 *     """
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2488, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2488, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2488, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 2488, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":2489
 *     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 == ((int)-1))) __PYX_ERR(0, 2489, __pyx_L1_error)

  /* "lxml/etree.pyx":2490
 *     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((PyObject *)__pyx_v_self->_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element;

  /* "lxml/etree.pyx":2488
 *     """
 *     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;
}

/* "lxml/etree.pyx":2493
 * 
 *     # 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2494
 *     # 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 == ((int)-1))) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2495
 *     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 == ((int)-1))) __PYX_ERR(0, 2495, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2493
 * 
 *     # 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;
}

/* "lxml/etree.pyx":2497
 *         _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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2498
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2499
 *     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 == ((int)-1))) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2497
 *         _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;
}

/* "lxml/etree.pyx":2501
 *         _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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_7update = {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_7update, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_7update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_sequence_or_dict = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sequence_or_dict,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sequence_or_dict)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2501, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 2501, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_sequence_or_dict = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2501, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_6update(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_sequence_or_dict);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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)(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);

  /* "lxml/etree.pyx":2502
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2502, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2503
 *     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_4 = PyDict_Check(__pyx_v_sequence_or_dict); 
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_sequence_or_dict, __pyx_ptype_4lxml_5etree__Attrib); 
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":2504
 *         _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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sequence_or_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_2 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_2 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_2, 0+__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2504, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_sequence_or_dict, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":2503
 *     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:
 */
  }

  /* "lxml/etree.pyx":2505
 *         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 (likely(PyList_CheckExact(__pyx_v_sequence_or_dict)) || PyTuple_CheckExact(__pyx_v_sequence_or_dict)) {
    __pyx_t_1 = __pyx_v_sequence_or_dict; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sequence_or_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2505, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2505, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 2505, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2505, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2505, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 2505, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2505, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2505, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2505, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2505, __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_ERR(0, 2505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
      index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 2505, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2505, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "lxml/etree.pyx":2506
 *             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_5 = ((PyObject *)__pyx_v_self->_element);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_5), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2506, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":2505
 *         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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2501
 *         _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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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;
}

/* "lxml/etree.pyx":2508
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_9pop = {"pop", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_9pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_default = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_default)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_default);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2508, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "pop") < 0)) __PYX_ERR(0, 2508, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 2508, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_default);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":2509
 * 
 *     def pop(self, key, *default):
 *         if len(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)
 */
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2509, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 > 1);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2510
 *     def pop(self, key, *default):
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 */
    __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2510, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t((__pyx_t_1 + 1), 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_pop_expected_at_most_2_arguments, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2510, __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_ERR(0, 2510, __pyx_L1_error)

    /* "lxml/etree.pyx":2509
 * 
 *     def pop(self, key, *default):
 *         if len(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 *         _assertValidNode(self._element)
 */
  }

  /* "lxml/etree.pyx":2511
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {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 == ((int)-1))) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":2512
 *             raise TypeError, f"pop expected at most 2 arguments, got {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_ERR(0, 2512, __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;

  /* "lxml/etree.pyx":2513
 *         _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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2514
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if not default:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             result = default[0]
 */
    __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_default) != 0);
    __pyx_t_6 = (!__pyx_t_2);
    if (unlikely(__pyx_t_6)) {

      /* "lxml/etree.pyx":2515
 *         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_ERR(0, 2515, __pyx_L1_error)

      /* "lxml/etree.pyx":2514
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if not default:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             result = default[0]
 */
    }

    /* "lxml/etree.pyx":2516
 *             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)) __PYX_ERR(0, 2516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2513
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             if not default:
 *                 raise KeyError, key
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2518
 *             result = default[0]
 *         else:
 *             _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  /*else*/ {
    __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 == ((int)-1))) __PYX_ERR(0, 2518, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":2519
 *         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;

  /* "lxml/etree.pyx":2508
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 */

  /* 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;
}

/* "lxml/etree.pyx":2521
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_11clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL;
  __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) {
  xmlAttr *__pyx_v_c_attrs;
  PyObject *__pyx_r = NULL;
  __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("clear", 1);

  /* "lxml/etree.pyx":2522
 * 
 *     def clear(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:
 */
  __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 == ((int)-1))) __PYX_ERR(0, 2522, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2523
 *     def clear(self):
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         if c_attrs:
 *             self._element._c_node.properties = NULL
 */
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attrs = __pyx_t_3;

  /* "lxml/etree.pyx":2524
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:             # <<<<<<<<<<<<<<
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)
 */
  __pyx_t_4 = (__pyx_v_c_attrs != 0);
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2525
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:
 *             self._element._c_node.properties = NULL             # <<<<<<<<<<<<<<
 *             tree.xmlFreePropList(c_attrs)
 * 
 */
    __pyx_v_self->_element->_c_node->properties = NULL;

    /* "lxml/etree.pyx":2526
 *         if c_attrs:
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
    xmlFreePropList(__pyx_v_c_attrs);

    /* "lxml/etree.pyx":2524
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 *         if c_attrs:             # <<<<<<<<<<<<<<
 *             self._element._c_node.properties = NULL
 *             tree.xmlFreePropList(c_attrs)
 */
  }

  /* "lxml/etree.pyx":2521
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 */

  /* 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;
}

/* "lxml/etree.pyx":2529
 * 
 *     # 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2530
 *     # 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 == ((int)-1))) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2531
 *     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_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Repr(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2531, __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;

  /* "lxml/etree.pyx":2529
 * 
 *     # 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;
}

/* "lxml/etree.pyx":2533
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_15__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __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__", 1);

  /* "lxml/etree.pyx":2534
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2535
 *     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_ERR(0, 2535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2535, __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;

  /* "lxml/etree.pyx":2533
 *         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;
}

/* "lxml/etree.pyx":2537
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_17__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2537, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(0, 2537, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2537, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":2538
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2539
 *     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_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2539, __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;

  /* "lxml/etree.pyx":2537
 *         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;
}

/* "lxml/etree.pyx":2541
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);

  /* "lxml/etree.pyx":2542
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2543
 *     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_ERR(0, 2543, __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;

  /* "lxml/etree.pyx":2544
 *         _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);
  if (unlikely(__pyx_t_4)) {

    /* "lxml/etree.pyx":2545
 *         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_ERR(0, 2545, __pyx_L1_error)

    /* "lxml/etree.pyx":2544
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             raise KeyError, key
 *         return result
 */
  }

  /* "lxml/etree.pyx":2546
 *         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;

  /* "lxml/etree.pyx":2541
 *         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;
}

/* "lxml/etree.pyx":2548
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2549
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2550
 *     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;

  /* "lxml/etree.pyx":2551
 *         _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);
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2552
 *         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);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2553
 *         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;

      /* "lxml/etree.pyx":2552
 *         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
 */
    }

    /* "lxml/etree.pyx":2554
 *             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;
  }

  /* "lxml/etree.pyx":2555
 *                 return 1
 *             c_attr = c_attr.next
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2548
 *         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;
}

/* "lxml/etree.pyx":2557
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2558
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2559
 *     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;

  /* "lxml/etree.pyx":2560
 *         _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;

  /* "lxml/etree.pyx":2561
 *         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);
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2562
 *         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);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2563
 *         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);

      /* "lxml/etree.pyx":2562
 *         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
 */
    }

    /* "lxml/etree.pyx":2564
 *             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;
  }

  /* "lxml/etree.pyx":2565
 *                 c += 1
 *             c_attr = c_attr.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2557
 *         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;
}

/* "lxml/etree.pyx":2567
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_25get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_25get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_25get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2567, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2567, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 2567, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2567, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":2568
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2569
 *     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_ERR(0, 2569, __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;

  /* "lxml/etree.pyx":2567
 *         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;
}

/* "lxml/etree.pyx":2571
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_27keys = {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_27keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_27keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2572
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2572, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2573
 *     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_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2571
 *         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;
}

/* "lxml/etree.pyx":2575
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2576
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2577
 *     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_ERR(0, 2577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2577, __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;

  /* "lxml/etree.pyx":2575
 *         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;
}

/* "lxml/etree.pyx":2579
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_31iterkeys = {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iterkeys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2580
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2580, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2581
 *     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_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2581, __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;

  /* "lxml/etree.pyx":2579
 *         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;
}

/* "lxml/etree.pyx":2583
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_33values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_33values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_33values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2584
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2585
 *     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_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2583
 *         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;
}

/* "lxml/etree.pyx":2587
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_35itervalues = {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_35itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_35itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2588
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2589
 *     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_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2589, __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;

  /* "lxml/etree.pyx":2587
 *         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;
}

/* "lxml/etree.pyx":2591
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_37items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_37items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_37items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2592
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2593
 *     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_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2591
 *         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;
}

/* "lxml/etree.pyx":2595
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_39iteritems = {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_39iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_39iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) return NULL;
  __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", 1);

  /* "lxml/etree.pyx":2596
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2597
 *     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_ERR(0, 2597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2597, __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;

  /* "lxml/etree.pyx":2595
 *         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;
}

/* "lxml/etree.pyx":2599
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_Attrib_41has_key = {"has_key", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_41has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_41has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2599, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "has_key") < 0)) __PYX_ERR(0, 2599, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2599, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Attrib.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_40has_key(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":2600
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2601
 *     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_ContainsTF(__pyx_v_key, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2601, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2599
 *         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;
}

/* "lxml/etree.pyx":2603
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2604
 * 
 *     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 == ((int)-1))) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2606
 *         _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_ERR(0, 2606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2606, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(0, 2606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2606, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_tag = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":2607
 *         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;

  /* "lxml/etree.pyx":2608
 *         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) {
    __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;

  /* "lxml/etree.pyx":2609
 *         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__(self, other, int op):
 */
  __pyx_t_7 = (xmlHasNsProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href) != 0);
  if (__pyx_t_7) {
    __pyx_t_2 = 1;
  } else {
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2603
 *         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;
}

/* "lxml/etree.pyx":2611
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             one = dict(self.items())
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((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__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_v_one = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "lxml/etree.pyx":2612
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":2613
 *     def __richcmp__(self, other, int op):
 *         try:
 *             one = dict(self.items())             # <<<<<<<<<<<<<<
 *             if not isinstance(other, dict):
 *                 other = dict(other)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2613, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2613, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2613, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_one = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "lxml/etree.pyx":2614
 *         try:
 *             one = dict(self.items())
 *             if not isinstance(other, dict):             # <<<<<<<<<<<<<<
 *                 other = dict(other)
 *         except (TypeError, ValueError):
 */
      __pyx_t_8 = PyDict_Check(__pyx_v_other); 
      __pyx_t_9 = (!__pyx_t_8);
      if (__pyx_t_9) {

        /* "lxml/etree.pyx":2615
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
 *                 other = dict(other)             # <<<<<<<<<<<<<<
 *         except (TypeError, ValueError):
 *             return NotImplemented
 */
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_other); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2615, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "lxml/etree.pyx":2614
 *         try:
 *             one = dict(self.items())
 *             if not isinstance(other, dict):             # <<<<<<<<<<<<<<
 *                 other = dict(other)
 *         except (TypeError, ValueError):
 */
      }

      /* "lxml/etree.pyx":2612
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __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;

    /* "lxml/etree.pyx":2616
 *             if not isinstance(other, dict):
 *                 other = dict(other)
 *         except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_ValueError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 2616, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "lxml/etree.pyx":2617
 *                 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_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":2612
 * 
 *     def __richcmp__(self, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             one = dict(self.items())
 *             if not isinstance(other, dict):
 */
    __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_L8_try_end:;
  }

  /* "lxml/etree.pyx":2618
 *         except (TypeError, ValueError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * MutableMapping.register(_Attrib)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2611
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             one = dict(self.items())
 */

  /* 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._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;
}

/* "lxml/etree.pyx":2632
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2633
 *     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;

  /* "lxml/etree.pyx":2632
 *     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;
}

/* "lxml/etree.pyx":2635
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);

  /* "lxml/etree.pyx":2637
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2638
 *         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_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2637
 *     def __next__(self):
 *         cdef xmlAttr* c_attr
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_attr = self._c_attr
 */
  }

  /* "lxml/etree.pyx":2639
 *         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_2 = __pyx_v_self->_c_attr;
  __pyx_v_c_attr = __pyx_t_2;

  /* "lxml/etree.pyx":2640
 *             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_3 = (__pyx_v_c_attr != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_c_attr->type != XML_ATTRIBUTE_NODE);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":2641
 *         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_2 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_2;
  }

  /* "lxml/etree.pyx":2642
 *         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_1 = (__pyx_v_c_attr == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2643
 *             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((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":2644
 *         if c_attr is NULL:
 *             self._node = None
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         self._c_attr = c_attr.next
 */
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2642
 *         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
 */
  }

  /* "lxml/etree.pyx":2646
 *             raise StopIteration
 * 
 *         self._c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 */
  __pyx_t_2 = __pyx_v_c_attr->next;
  __pyx_v_self->_c_attr = __pyx_t_2;

  /* "lxml/etree.pyx":2647
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 */
  switch (__pyx_v_self->_keysvalues) {
    case 1:

    /* "lxml/etree.pyx":2648
 *         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_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2647
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 */
    break;
    case 2:

    /* "lxml/etree.pyx":2650
 *             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_4 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2649
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 */
    break;
    default:

    /* "lxml/etree.pyx":2652
 *             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_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "lxml/etree.pyx":2653
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 *                     _attributeValue(self._node._c_node, c_attr))             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "lxml/etree.pyx":2652
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 */
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 2652, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 2652, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    break;
  }

  /* "lxml/etree.pyx":2635
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "lxml/etree.pyx":2655
 *                     _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", 1);

  /* "lxml/etree.pyx":2657
 * 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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2658
 *     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;

    /* "lxml/etree.pyx":2657
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 */
  }

  /* "lxml/etree.pyx":2659
 *     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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__AttribIterator)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2660
 *         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((PyObject *)__pyx_v_attribs->_node);
  __Pyx_DECREF((PyObject *)__pyx_v_attribs->_node);
  __pyx_v_attribs->_node = __pyx_v_element;

  /* "lxml/etree.pyx":2661
 *     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;

  /* "lxml/etree.pyx":2662
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues             # <<<<<<<<<<<<<<
 *     return attribs
 * 
 */
  __pyx_v_attribs->_keysvalues = __pyx_v_keysvalues;

  /* "lxml/etree.pyx":2663
 *     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;

  /* "lxml/etree.pyx":2655
 *                     _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;
}

/* "lxml/etree.pyx":2675
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initTagMatch", 1);

  /* "lxml/etree.pyx":2676
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL             # <<<<<<<<<<<<<<
 *         self._name = NULL
 *         if tag is None:
 */
  __pyx_v_self->_href = NULL;

  /* "lxml/etree.pyx":2677
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL
 *         self._name = NULL             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             self._node_type = 0
 */
  __pyx_v_self->_name = NULL;

  /* "lxml/etree.pyx":2678
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2679
 *         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;

    /* "lxml/etree.pyx":2678
 *         self._href = NULL
 *         self._name = NULL
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             self._node_type = 0
 *         elif tag is Comment:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2680
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2681
 *             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;

    /* "lxml/etree.pyx":2680
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2682
 *         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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2683
 *             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;

    /* "lxml/etree.pyx":2682
 *         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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2684
 *         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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Entity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2685
 *             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;

    /* "lxml/etree.pyx":2684
 *         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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2686
 *         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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Element_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2687
 *             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;

    /* "lxml/etree.pyx":2686
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2689
 *             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:
 */
  /*else*/ {
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;

    /* "lxml/etree.pyx":2690
 *         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_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_pystrings);
    __Pyx_DECREF(__pyx_v_self->_pystrings);
    __pyx_v_self->_pystrings = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2691
 *             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_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2692
 *             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_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2692, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_self->_href = PyBytes_AS_STRING(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":2691
 *             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])
 */
    }

    /* "lxml/etree.pyx":2693
 *             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_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_self->_name = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":2694
 *                 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_v_self->_name[0]) == '*');
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_self->_name[1]) == '\x00');
    __pyx_t_1 = __pyx_t_3;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2695
 *             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;

      /* "lxml/etree.pyx":2694
 *                 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_L3:;

  /* "lxml/etree.pyx":2675
 *     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_2);
  __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;
}

/* "lxml/etree.pyx":2705
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2706
 *     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;

  /* "lxml/etree.pyx":2705
 *     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;
}

/* "lxml/etree.pyx":2708
 *         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
  xmlNode *__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("_storeNext", 1);

  /* "lxml/etree.pyx":2710
 *     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_t_1 = __pyx_v_self->_next_element(__pyx_v_node->_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_1;

  /* "lxml/etree.pyx":2711
 *         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_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2712
 *         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_3 = (__pyx_v_self->__pyx_base._node_type != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2713
 *         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);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "lxml/etree.pyx":2714
 *                   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_3 = (!__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)));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "lxml/etree.pyx":2715
 *                   (<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_t_1 = __pyx_v_self->_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2715, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "lxml/etree.pyx":2716
 *                    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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2717
 *             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((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":2716
 *                    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:
 */
    goto __pyx_L9;
  }

  /* "lxml/etree.pyx":2720
 *         else:
 *             # Python ref:
 *             self._node = _elementFactory(node._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  /*else*/ {
    __pyx_t_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
    __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L9:;

  /* "lxml/etree.pyx":2708
 *         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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementIterator._storeNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "lxml/etree.pyx":2722
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);

  /* "lxml/etree.pyx":2725
 *         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);
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":2726
 *         cdef _Element current_node
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         # Python ref:
 *         current_node = self._node
 */
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2725
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         # Python ref:
 */
  }

  /* "lxml/etree.pyx":2728
 *             raise StopIteration
 *         # Python ref:
 *         current_node = self._node             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2729
 *         # 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); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2729, __pyx_L1_error)

  /* "lxml/etree.pyx":2730
 *         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;

  /* "lxml/etree.pyx":2722
 *             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_2);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "lxml/etree.pyx":2745
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._py_tags = []
 *         self.initTagMatch(tags)
 */

/* 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tags,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tags)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2745, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2745, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_tags = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2745, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":2746
 * 
 *     def __cinit__(self, tags):
 *         self._py_tags = []             # <<<<<<<<<<<<<<
 *         self.initTagMatch(tags)
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2746, __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;

  /* "lxml/etree.pyx":2747
 *     def __cinit__(self, tags):
 *         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_ERR(0, 2747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2745
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._py_tags = []
 *         self.initTagMatch(tags)
 */

  /* 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;
}

/* "lxml/etree.pyx":2749
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "lxml/etree.pyx":2750
 * 
 *     def __dealloc__(self):
 *         self._clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAll(self) noexcept:
 */
  __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(__pyx_v_self);

  /* "lxml/etree.pyx":2749
 *         self.initTagMatch(tags)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._clear()
 * 
 */

  /* function exit code */
}

/* "lxml/etree.pyx":2752
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":2753
 * 
 *     cdef bint rejectsAll(self) noexcept:
 *         return not self._tag_count and not self._node_types             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:
 */
  __pyx_t_2 = (!(__pyx_v_self->_tag_count != 0));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (!(__pyx_v_self->_node_types != 0));
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2752
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count and not self._node_types
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2755
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:             # <<<<<<<<<<<<<<
 *         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;

  /* "lxml/etree.pyx":2756
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:
 *         return not self._tag_count             # <<<<<<<<<<<<<<
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
 */
  __pyx_r = (!(__pyx_v_self->_tag_count != 0));
  goto __pyx_L0;

  /* "lxml/etree.pyx":2755
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self) noexcept:             # <<<<<<<<<<<<<<
 *         return not self._tag_count
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2758
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":2759
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:             # <<<<<<<<<<<<<<
 *             return True
 *         return self._node_types & (1 << node_type)
 */
  __pyx_t_2 = (__pyx_v_node_type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_tag_count != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2760
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         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;

    /* "lxml/etree.pyx":2759
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:             # <<<<<<<<<<<<<<
 *             return True
 *         return self._node_types & (1 << node_type)
 */
  }

  /* "lxml/etree.pyx":2761
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 *         return self._node_types & (1 << node_type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _clear(self) noexcept:
 */
  __pyx_r = (__pyx_v_self->_node_types & (1 << __pyx_v_node_type));
  goto __pyx_L0;

  /* "lxml/etree.pyx":2758
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type) noexcept:             # <<<<<<<<<<<<<<
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2763
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  size_t __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;

  /* "lxml/etree.pyx":2765
 *     cdef void _clear(self) noexcept:
 *         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;

  /* "lxml/etree.pyx":2766
 *         cdef size_t i, count
 *         count = self._tag_count
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         if self._cached_tags:
 *             for i in range(count):
 */
  __pyx_v_self->_tag_count = 0;

  /* "lxml/etree.pyx":2767
 *         count = self._tag_count
 *         self._tag_count = 0
 *         if self._cached_tags:             # <<<<<<<<<<<<<<
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 */
  __pyx_t_2 = (__pyx_v_self->_cached_tags != 0);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2768
 *         self._tag_count = 0
 *         if self._cached_tags:
 *             for i in range(count):             # <<<<<<<<<<<<<<
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)
 */
    __pyx_t_1 = __pyx_v_count;
    __pyx_t_3 = __pyx_t_1;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "lxml/etree.pyx":2769
 *         if self._cached_tags:
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)             # <<<<<<<<<<<<<<
 *             python.lxml_free(self._cached_tags)
 *             self._cached_tags = NULL
 */
      Py_XDECREF((__pyx_v_self->_cached_tags[__pyx_v_i]).href);
    }

    /* "lxml/etree.pyx":2770
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)             # <<<<<<<<<<<<<<
 *             self._cached_tags = NULL
 * 
 */
    lxml_free(__pyx_v_self->_cached_tags);

    /* "lxml/etree.pyx":2771
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             python.lxml_free(self._cached_tags)
 *             self._cached_tags = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef initTagMatch(self, tags):
 */
    __pyx_v_self->_cached_tags = NULL;

    /* "lxml/etree.pyx":2767
 *         count = self._tag_count
 *         self._tag_count = 0
 *         if self._cached_tags:             # <<<<<<<<<<<<<<
 *             for i in range(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 */
  }

  /* "lxml/etree.pyx":2763
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef size_t i, count
 *         count = self._tag_count
 */

  /* function exit code */
}

/* "lxml/etree.pyx":2773
 *             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;
  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("initTagMatch", 1);

  /* "lxml/etree.pyx":2774
 * 
 *     cdef initTagMatch(self, tags):
 *         self._cached_doc = None             # <<<<<<<<<<<<<<
 *         del self._py_tags[:]
 *         self._clear()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_cached_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
  __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

  /* "lxml/etree.pyx":2775
 *     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_ERR(0, 2775, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_py_tags, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)

  /* "lxml/etree.pyx":2776
 *         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);

  /* "lxml/etree.pyx":2777
 *         del self._py_tags[:]
 *         self._clear()
 *         if tags is None or tags == ():             # <<<<<<<<<<<<<<
 *             # no selection in tags argument => match anything
 *             self._node_types = (
 */
  __pyx_t_2 = (__pyx_v_tags == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_tags, __pyx_empty_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2777, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2779
 *         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));

    /* "lxml/etree.pyx":2777
 *         del self._py_tags[:]
 *         self._clear()
 *         if tags is None or tags == ():             # <<<<<<<<<<<<<<
 *             # no selection in tags argument => match anything
 *             self._node_types = (
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2785
 *                 1 << tree.XML_ELEMENT_NODE)
 *         else:
 *             self._node_types = 0             # <<<<<<<<<<<<<<
 *             self._storeTags(tags, set())
 * 
 */
  /*else*/ {
    __pyx_v_self->_node_types = 0;

    /* "lxml/etree.pyx":2786
 *         else:
 *             self._node_types = 0
 *             self._storeTags(tags, set())             # <<<<<<<<<<<<<<
 * 
 *     cdef _storeTags(self, tag, set seen):
 */
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_tags, ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2773
 *             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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "lxml/etree.pyx":2788
 *             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;
  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("_storeTags", 1);

  /* "lxml/etree.pyx":2789
 * 
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2789, __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;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2790
 *     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));

    /* "lxml/etree.pyx":2789
 * 
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2791
 *         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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2791, __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;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2792
 *             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));

    /* "lxml/etree.pyx":2791
 *         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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2793
 *         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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2793, __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;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2794
 *             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));

    /* "lxml/etree.pyx":2793
 *         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:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2795
 *         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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Element_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2795, __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;
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2796
 *             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));

    /* "lxml/etree.pyx":2795
 *         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):
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2797
 *         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);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2798
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 *             if tag in seen:             # <<<<<<<<<<<<<<
 *                 return
 *             seen.add(tag)
 */
    if (unlikely(__pyx_v_seen == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 2798, __pyx_L1_error)
    }
    __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2798, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":2799
 *         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;

      /* "lxml/etree.pyx":2798
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 *             if tag in seen:             # <<<<<<<<<<<<<<
 *                 return
 *             seen.add(tag)
 */
    }

    /* "lxml/etree.pyx":2800
 *             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 '%.30s'", "add");
      __PYX_ERR(0, 2800, __pyx_L1_error)
    }
    __pyx_t_3 = PySet_Add(__pyx_v_seen, __pyx_v_tag); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2800, __pyx_L1_error)

    /* "lxml/etree.pyx":2801
 *                 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_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__22, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2801, __pyx_L1_error)
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__45, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2801, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_2;
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2802
 *             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));

      /* "lxml/etree.pyx":2801
 *                 return
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):             # <<<<<<<<<<<<<<
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
 */
      goto __pyx_L5;
    }

    /* "lxml/etree.pyx":2804
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
 *                 href, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *                 if name == b'*':
 *                     name = None
 */
    /*else*/ {
      __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(__pyx_t_1 != Py_None)) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2804, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(0, 2804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2804, __pyx_L1_error)
      }
      __pyx_v_href = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_name = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "lxml/etree.pyx":2805
 *             else:
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':             # <<<<<<<<<<<<<<
 *                     name = None
 *                 if href is None:
 */
      __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_name, __pyx_kp_b__22, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2805, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2806
 *                 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);

        /* "lxml/etree.pyx":2805
 *             else:
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':             # <<<<<<<<<<<<<<
 *                     name = None
 *                 if href is None:
 */
      }

      /* "lxml/etree.pyx":2807
 *                 if name == b'*':
 *                     name = None
 *                 if href is None:             # <<<<<<<<<<<<<<
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 */
      __pyx_t_4 = (__pyx_v_href == Py_None);
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2808
 *                     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__12);
        __Pyx_DECREF_SET(__pyx_v_href, __pyx_kp_b__12);

        /* "lxml/etree.pyx":2807
 *                 if name == b'*':
 *                     name = None
 *                 if href is None:             # <<<<<<<<<<<<<<
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 */
        goto __pyx_L9;
      }

      /* "lxml/etree.pyx":2809
 *                 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_4 = (__Pyx_PyBytes_Equals(__pyx_v_href, __pyx_kp_b__22, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2809, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "lxml/etree.pyx":2810
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none             # <<<<<<<<<<<<<<
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_href, Py_None);

        /* "lxml/etree.pyx":2809
 *                 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_L9:;

      /* "lxml/etree.pyx":2811
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))             # <<<<<<<<<<<<<<
 *         elif isinstance(tag, QName):
 *             self._storeTags(tag.text, seen)
 */
      if (unlikely(__pyx_v_self->_py_tags == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 2811, __pyx_L1_error)
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2811, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_href)) __PYX_ERR(0, 2811, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_name)) __PYX_ERR(0, 2811, __pyx_L1_error);
      __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_py_tags, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2811, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L5:;

    /* "lxml/etree.pyx":2797
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):             # <<<<<<<<<<<<<<
 *             if tag in seen:
 *                 return
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2812
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *             self._storeTags(tag.text, seen)
 *         else:
 */
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_tag, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2813
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):
 *             self._storeTags(tag.text, seen)             # <<<<<<<<<<<<<<
 *         else:
 *             # support a sequence of tags
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tag, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_t_1, __pyx_v_seen); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2813, __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;

    /* "lxml/etree.pyx":2812
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
 *         elif isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *             self._storeTags(tag.text, seen)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2816
 *         else:
 *             # support a sequence of tags
 *             for item in tag:             # <<<<<<<<<<<<<<
 *                 self._storeTags(item, seen)
 * 
 */
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_tag)) || PyTuple_CheckExact(__pyx_v_tag)) {
      __pyx_t_6 = __pyx_v_tag; __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_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2816, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2816, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(0, 2816, __pyx_L1_error)
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2816, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2816, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(0, 2816, __pyx_L1_error)
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2816, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_8(__pyx_t_6);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2816, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "lxml/etree.pyx":2817
 *             # 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_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_item, __pyx_v_seen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "lxml/etree.pyx":2816
 *         else:
 *             # support a sequence of tags
 *             for item in tag:             # <<<<<<<<<<<<<<
 *                 self._storeTags(item, seen)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2788
 *             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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "lxml/etree.pyx":2819
 *                 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;
  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("cacheTags", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_force_into_dict = __pyx_optional_args->force_into_dict;
    }
  }

  /* "lxml/etree.pyx":2823
 *         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);

  /* "lxml/etree.pyx":2824
 *         """
 *         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_2 = (__pyx_v_doc == __pyx_v_self->_cached_doc);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_dict_size == __pyx_v_self->_cached_size);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2826
 *         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;

    /* "lxml/etree.pyx":2824
 *         """
 *         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
 */
  }

  /* "lxml/etree.pyx":2827
 *             # 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;

  /* "lxml/etree.pyx":2828
 *             return 0
 *         self._tag_count = 0
 *         if not self._py_tags:             # <<<<<<<<<<<<<<
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 */
  __pyx_t_1 = (__pyx_v_self->_py_tags != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_py_tags) != 0);
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2829
 *         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((PyObject *)__pyx_v_self->_cached_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
    __pyx_v_self->_cached_doc = __pyx_v_doc;

    /* "lxml/etree.pyx":2830
 *         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;

    /* "lxml/etree.pyx":2831
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 *             return 0             # <<<<<<<<<<<<<<
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":2828
 *             return 0
 *         self._tag_count = 0
 *         if not self._py_tags:             # <<<<<<<<<<<<<<
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 */
  }

  /* "lxml/etree.pyx":2832
 *             self._cached_size = dict_size
 *             return 0
 *         if not self._cached_tags:             # <<<<<<<<<<<<<<
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:
 */
  __pyx_t_2 = (!(__pyx_v_self->_cached_tags != 0));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2833
 *             return 0
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))             # <<<<<<<<<<<<<<
 *             if not self._cached_tags:
 *                 self._cached_doc = None
 */
    __pyx_t_3 = __pyx_v_self->_py_tags;
    __Pyx_INCREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 2833, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_self->_cached_tags = ((struct __pyx_t_4lxml_5etree_qname *)lxml_malloc(__pyx_t_4, (sizeof(struct __pyx_t_4lxml_5etree_qname))));

    /* "lxml/etree.pyx":2834
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:             # <<<<<<<<<<<<<<
 *                 self._cached_doc = None
 *                 raise MemoryError()
 */
    __pyx_t_2 = (!(__pyx_v_self->_cached_tags != 0));
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":2835
 *             self._cached_tags = <qname*>python.lxml_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((PyObject *)__pyx_v_self->_cached_doc);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
      __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

      /* "lxml/etree.pyx":2836
 *             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_ERR(0, 2836, __pyx_L1_error)

      /* "lxml/etree.pyx":2834
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:             # <<<<<<<<<<<<<<
 *                 self._cached_doc = None
 *                 raise MemoryError()
 */
    }

    /* "lxml/etree.pyx":2832
 *             self._cached_size = dict_size
 *             return 0
 *         if not self._cached_tags:             # <<<<<<<<<<<<<<
 *             self._cached_tags = <qname*>python.lxml_malloc(len(self._py_tags), sizeof(qname))
 *             if not self._cached_tags:
 */
  }

  /* "lxml/etree.pyx":2838
 *                 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_3 = __pyx_v_self->_py_tags;
  __Pyx_INCREF(__pyx_t_3);

  /* "lxml/etree.pyx":2837
 *                 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_4 = __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(__pyx_v_doc->_c_doc, ((PyObject*)__pyx_t_3), __pyx_v_self->_cached_tags, __pyx_v_force_into_dict); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1L))) __PYX_ERR(0, 2837, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->_tag_count = ((size_t)__pyx_t_4);

  /* "lxml/etree.pyx":2839
 *         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((PyObject *)__pyx_v_self->_cached_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_cached_doc);
  __pyx_v_self->_cached_doc = __pyx_v_doc;

  /* "lxml/etree.pyx":2840
 *             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;

  /* "lxml/etree.pyx":2841
 *         self._cached_doc = doc
 *         self._cached_size = dict_size
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2819
 *                 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_3);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.cacheTags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":2843
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  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;

  /* "lxml/etree.pyx":2845
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
 *         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) {

    /* "lxml/etree.pyx":2846
 *         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;

    /* "lxml/etree.pyx":2845
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 */
  }

  /* "lxml/etree.pyx":2847
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":2848
 *             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;

      /* "lxml/etree.pyx":2849
 *         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);
      if (__pyx_t_1) {

        /* "lxml/etree.pyx":2850
 *             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;

        /* "lxml/etree.pyx":2849
 *         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
 */
      }
    }

    /* "lxml/etree.pyx":2847
 *         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):
 */
  }

  /* "lxml/etree.pyx":2851
 *                 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;

  /* "lxml/etree.pyx":2843
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2853
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name) noexcept:
 *         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;
  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;

  /* "lxml/etree.pyx":2856
 *                                   const_xmlChar* c_name) noexcept:
 *         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) {

    /* "lxml/etree.pyx":2857
 *         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;

    /* "lxml/etree.pyx":2856
 *                                   const_xmlChar* c_name) noexcept:
 *         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]:
 */
  }

  /* "lxml/etree.pyx":2858
 *         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;

    /* "lxml/etree.pyx":2859
 *             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);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":2860
 *         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;

      /* "lxml/etree.pyx":2859
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    }
  }

  /* "lxml/etree.pyx":2861
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2853
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name) noexcept:
 *         cdef qname* c_qname
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2863
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *         """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;
  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;

  /* "lxml/etree.pyx":2868
 *         """
 *         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;

    /* "lxml/etree.pyx":2869
 *         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);
    if (__pyx_t_4) {

      /* "lxml/etree.pyx":2870
 *         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;

      /* "lxml/etree.pyx":2869
 *         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
 */
    }
  }

  /* "lxml/etree.pyx":2871
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 * cdef class _ElementMatchIterator:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":2863
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *         """Attribute matches differ from Element matches in that they do
 *         not care about node types.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":2879
 * 
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher.__new__(_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", 1);

  /* "lxml/etree.pyx":2880
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tags)) __PYX_ERR(0, 2880, __pyx_L1_error);
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2880, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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;

  /* "lxml/etree.pyx":2879
 * 
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher.__new__(_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;
}

/* "lxml/etree.pyx":2882
 *         self._matcher = _MultiTagMatcher.__new__(_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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2883
 * 
 *     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;

  /* "lxml/etree.pyx":2882
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tags)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "lxml/etree.pyx":2886
 * 
 *     @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;
  xmlNode *__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", 1);

  /* "lxml/etree.pyx":2887
 *     @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 == ((int)-1))) __PYX_ERR(0, 2887, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2888
 *     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_t_3 = __pyx_v_self->_next_element(__pyx_v_node->_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2888, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_3;

  /* "lxml/etree.pyx":2889
 *         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_5 = (__pyx_v_c_node != NULL);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_c_node));
    __pyx_t_4 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_4) break;

    /* "lxml/etree.pyx":2890
 *         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_t_3 = __pyx_v_self->_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2890, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "lxml/etree.pyx":2892
 *             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
 * 
 */
  __pyx_t_4 = (__pyx_v_c_node != NULL);
  if (__pyx_t_4) {
    __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_ERR(0, 2892, __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;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2892, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_node);
  __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2893
 *         # 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;

  /* "lxml/etree.pyx":2886
 * 
 *     @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;
}

/* "lxml/etree.pyx":2895
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  int __pyx_error_without_exception = 0; /* StopIteration */
  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("__next__", 1);

  /* "lxml/etree.pyx":2896
 * 
 *     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;

  /* "lxml/etree.pyx":2897
 *     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);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2898
 *         cdef _Element current_node = self._node
 *         if current_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
 */
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2897
 *     def __next__(self):
 *         cdef _Element current_node = self._node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self._storeNext(current_node)
 */
  }

  /* "lxml/etree.pyx":2899
 *         if current_node is None:
 *             raise StopIteration
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(__pyx_v_self, __pyx_v_current_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2899, __pyx_L1_error)

  /* "lxml/etree.pyx":2900
 *             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;

  /* "lxml/etree.pyx":2895
 *         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);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "lxml/etree.pyx":2906
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2906, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2906, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2906, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2906, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_ERR(0, 2906, __pyx_L3_error)
    } else {
      __pyx_v_reversed = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2906, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 2906, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  xmlNode *__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__", 1);

  /* "lxml/etree.pyx":2908
 *     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 == ((int)-1))) __PYX_ERR(0, 2908, __pyx_L1_error)

  /* "lxml/etree.pyx":2909
 *         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_ERR(0, 2909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2910
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
 */
  if (__pyx_v_reversed) {

    /* "lxml/etree.pyx":2911
 *         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);

    /* "lxml/etree.pyx":2912
 *         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;

    /* "lxml/etree.pyx":2910
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2914
 *             self._next_element = _previousElement
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)
 */
  /*else*/ {
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "lxml/etree.pyx":2915
 *         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:;

  /* "lxml/etree.pyx":2916
 *             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 == ((int)-1))) __PYX_ERR(0, 2916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2917
 *             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_4 = (__pyx_v_c_node != NULL);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->__pyx_base._matcher, __pyx_v_c_node));
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_3) break;

    /* "lxml/etree.pyx":2918
 *         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_t_5 = __pyx_v_self->__pyx_base._next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2918, __pyx_L1_error)
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "lxml/etree.pyx":2920
 *             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):
 */
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
    __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_ERR(0, 2920, __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;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 2920, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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;

  /* "lxml/etree.pyx":2906
 *     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;
}

/* "lxml/etree.pyx":2928
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_preceding,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2928, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2928, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2928, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2928, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_ERR(0, 2928, __pyx_L3_error)
    } else {
      __pyx_v_preceding = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2928, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 2928, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "lxml/etree.pyx":2929
 *     """
 *     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 == ((int)-1))) __PYX_ERR(0, 2929, __pyx_L1_error)

  /* "lxml/etree.pyx":2930
 *     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_ERR(0, 2930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2931
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
  if (__pyx_v_preceding) {

    /* "lxml/etree.pyx":2932
 *         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;

    /* "lxml/etree.pyx":2931
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":2934
 *             self._next_element = _previousElement
 *         else:
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
  /*else*/ {
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":2935
 *         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 == ((int)-1))) __PYX_ERR(0, 2935, __pyx_L1_error)

  /* "lxml/etree.pyx":2928
 *     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;
}

/* "lxml/etree.pyx":2941
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2941, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2941, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2941, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2941, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 2941, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "lxml/etree.pyx":2942
 *     """
 *     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 == ((int)-1))) __PYX_ERR(0, 2942, __pyx_L1_error)

  /* "lxml/etree.pyx":2943
 *     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_ERR(0, 2943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":2944
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
  __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__parentElement;

  /* "lxml/etree.pyx":2945
 *         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 == ((int)-1))) __PYX_ERR(0, 2945, __pyx_L1_error)

  /* "lxml/etree.pyx":2941
 *     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;
}

/* "lxml/etree.pyx":2972
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_inclusive,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2972, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2972, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2972, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 2972, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_ERR(0, 2972, __pyx_L3_error)
    } else {
      __pyx_v_inclusive = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2972, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 2972, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "lxml/etree.pyx":2973
 *     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 == ((int)-1))) __PYX_ERR(0, 2973, __pyx_L1_error)

  /* "lxml/etree.pyx":2974
 *     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.__new__(_MultiTagMatcher, tag)
 */
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_top_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_top_node);
  __pyx_v_self->_top_node = __pyx_v_node;

  /* "lxml/etree.pyx":2975
 *         _assertValidNode(node)
 *         self._top_node  = node
 *         self._next_node = node             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._matcher.cacheTags(node._doc)
 */
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_next_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
  __pyx_v_self->_next_node = __pyx_v_node;

  /* "lxml/etree.pyx":2976
 *         self._top_node  = node
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher.__new__(_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_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag)) __PYX_ERR(0, 2976, __pyx_L1_error);
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_2, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2976, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF((PyObject *)__pyx_t_3);
  __Pyx_GOTREF((PyObject *)__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;

  /* "lxml/etree.pyx":2977
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher.__new__(_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 == ((int)-1))) __PYX_ERR(0, 2977, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":2978
 *         self._matcher = _MultiTagMatcher.__new__(_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_5 = (!__pyx_v_inclusive);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (!__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node));
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "lxml/etree.pyx":2980
 *         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_ERR(0, 2980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":2978
 *         self._matcher = _MultiTagMatcher.__new__(_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)
 */
  }

  /* "lxml/etree.pyx":2972
 *     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;
}

/* "lxml/etree.pyx":2982
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":2983
 * 
 *     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;

  /* "lxml/etree.pyx":2982
 *             next(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "lxml/etree.pyx":2985
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  int __pyx_error_without_exception = 0; /* StopIteration */
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  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("__next__", 1);

  /* "lxml/etree.pyx":2987
 *     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;

  /* "lxml/etree.pyx":2988
 *         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);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":2989
 *         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_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "lxml/etree.pyx":2988
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_node = current_node._c_node
 */
  }

  /* "lxml/etree.pyx":2990
 *         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_3 = __pyx_v_current_node->_c_node;
  __pyx_v_c_node = __pyx_t_3;

  /* "lxml/etree.pyx":2991
 *             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_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_1), NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 2991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":2992
 *         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_2 = (!(__pyx_v_self->_matcher->_tag_count != 0));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2995
 *             # 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);

    /* "lxml/etree.pyx":2992
 *         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
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":2997
 *             c_node = self._nextNodeAnyTag(c_node)
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._next_node = None
 */
  /*else*/ {
    __pyx_v_c_node = __pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(__pyx_v_self, __pyx_v_c_node);
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":2998
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":2999
 *             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((PyObject *)__pyx_v_self->_next_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
    __pyx_v_self->_next_node = ((struct LxmlElement *)Py_None);

    /* "lxml/etree.pyx":2998
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
 */
    goto __pyx_L5;
  }

  /* "lxml/etree.pyx":3001
 *             self._next_node = None
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
  /*else*/ {
    __pyx_t_1 = ((PyObject *)__pyx_v_current_node->_doc);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3001, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_next_node);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_next_node);
    __pyx_v_self->_next_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "lxml/etree.pyx":3002
 *         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;

  /* "lxml/etree.pyx":2985
 *         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_5);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "lxml/etree.pyx":3005
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "lxml/etree.pyx":3006
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         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;

  /* "lxml/etree.pyx":3007
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         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));
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3008
 *         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;

    /* "lxml/etree.pyx":3007
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:
 *         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)
 */
  }

  /* "lxml/etree.pyx":3009
 *         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);

  /* "lxml/etree.pyx":3010
 *             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) {

    /* "lxml/etree.pyx":3011
 *         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;

    /* "lxml/etree.pyx":3010
 *             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)
 */
  }

  /* "lxml/etree.pyx":3012
 *         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);

  /* "lxml/etree.pyx":3013
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3005
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3016
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;

  /* "lxml/etree.pyx":3017
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         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);

  /* "lxml/etree.pyx":3018
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3019
 *         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;

    /* "lxml/etree.pyx":3018
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:
 *         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)
 */
  }

  /* "lxml/etree.pyx":3020
 *         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);

  /* "lxml/etree.pyx":3021
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3016
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *         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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3036
 *     cdef object _events
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_tag,&__pyx_n_s_with_tail,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3036, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3036, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3036, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 3036, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_ERR(0, 3036, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3036, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3036, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  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("__cinit__", 1);

  /* "lxml/etree.pyx":3037
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 3037, __pyx_L1_error)

  /* "lxml/etree.pyx":3038
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = ("start", "comment", "pi", "end")
 *         else:
 */
  if (__pyx_v_with_tail) {

    /* "lxml/etree.pyx":3039
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = ("start",)
 */
    __Pyx_INCREF(__pyx_tuple__46);
    __pyx_v_events = __pyx_tuple__46;

    /* "lxml/etree.pyx":3038
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = ("start", "comment", "pi", "end")
 *         else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3041
 *             events = ("start", "comment", "pi", "end")
 *         else:
 *             events = ("start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_tuple__47);
    __pyx_v_events = __pyx_tuple__47;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3042
 *         else:
 *             events = ("start",)
 *         self._start_element = element             # <<<<<<<<<<<<<<
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
 */
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_start_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_start_element);
  __pyx_v_self->_start_element = __pyx_v_element;

  /* "lxml/etree.pyx":3043
 *             events = ("start",)
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_element))) __PYX_ERR(0, 3043, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_events, __pyx_v_events) < 0) __PYX_ERR(0, 3043, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tag, __pyx_v_tag) < 0) __PYX_ERR(0, 3043, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_iterwalk), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3043, __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_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":3036
 *     cdef object _events
 *     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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "lxml/etree.pyx":3045
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":3046
 * 
 *     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;

  /* "lxml/etree.pyx":3045
 *         self._events = iterwalk(element, events=events, tag=tag)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "lxml/etree.pyx":3048
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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("__next__", 1);

  /* "lxml/etree.pyx":3050
 *     def __next__(self):
 *         cdef _Element element
 *         result = None             # <<<<<<<<<<<<<<
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None;

  /* "lxml/etree.pyx":3051
 *         cdef _Element element
 *         result = None
 *         while result is None:             # <<<<<<<<<<<<<<
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_result == Py_None);
    if (!__pyx_t_1) break;

    /* "lxml/etree.pyx":3052
 *         result = None
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration             # <<<<<<<<<<<<<<
 *             if event == "start":
 *                 result = element.text
 */
    __pyx_t_2 = __pyx_v_self->_events;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyIter_Next(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3052, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3052, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3052, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3052, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 3052, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3052, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(0, 3052, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3053
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3053, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":3054
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "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_ERR(0, 3054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":3053
 *         while result is None:
 *             event, element = next(self._events)  # raises StopIteration
 *             if event == "start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
 */
      goto __pyx_L7;
    }

    /* "lxml/etree.pyx":3055
 *             if event == "start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
 */
    __pyx_t_1 = (__pyx_v_element != __pyx_v_self->_start_element);
    if (__pyx_t_1) {

      /* "lxml/etree.pyx":3056
 *                 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_ERR(0, 3056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "lxml/etree.pyx":3055
 *             if event == "start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
 */
    }
    __pyx_L7:;
  }

  /* "lxml/etree.pyx":3057
 *             elif element is not self._start_element:
 *                 result = element.tail
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3048
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         result = None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("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;
}

/* "lxml/etree.pyx":3060
 * 
 * 
 * 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;

  /* "lxml/etree.pyx":3062
 * 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);

  /* "lxml/etree.pyx":3063
 *     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) noexcept:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3060
 * 
 * 
 * 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:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3065
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     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;

  /* "lxml/etree.pyx":3067
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:
 *     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);

  /* "lxml/etree.pyx":3068
 *     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) noexcept:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3065
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3070
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     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;

  /* "lxml/etree.pyx":3072
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:
 *     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);

  /* "lxml/etree.pyx":3073
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3070
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3075
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     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;

  /* "lxml/etree.pyx":3077
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:
 *     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);

  /* "lxml/etree.pyx":3078
 *     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;

  /* "lxml/etree.pyx":3075
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "lxml/etree.pyx":3082
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7Element(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"Element", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7Element, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_6Element};
static PyObject *__pyx_pw_4lxml_5etree_7Element(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3082, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3082, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3082, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "Element") < 0)) __PYX_ERR(0, 3082, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Element", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 3082, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":3092
 *     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);

  /* "lxml/etree.pyx":3093
 *     """
 *     return _makeElement(_tag, NULL, None, None, None, None,
 *                         attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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_ERR(0, 3092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3082
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "lxml/etree.pyx":3096
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9Comment(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"Comment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9Comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Comment};
static PyObject *__pyx_pw_4lxml_5etree_9Comment(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3096, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "Comment") < 0)) __PYX_ERR(0, 3096, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Comment", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3096, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Comment", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "lxml/etree.pyx":3106
 *     cdef xmlDoc*   c_doc
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_1 = (__pyx_v_text == Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3107
 * 
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__12);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__12);

    /* "lxml/etree.pyx":3106
 *     cdef xmlDoc*   c_doc
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3109
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *         if b'--' in text or text.endswith(b'-'):
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3110
 *     else:
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):             # <<<<<<<<<<<<<<
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
 */
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__48, __pyx_v_text, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3110, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_b__3};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3110, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "lxml/etree.pyx":3111
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):
 *             raise ValueError("Comment may not contain '--' or end with '-'")             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _newXMLDoc()
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3111, __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_ERR(0, 3111, __pyx_L1_error)

      /* "lxml/etree.pyx":3110
 *     else:
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):             # <<<<<<<<<<<<<<
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
 */
    }
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3113
 *             raise ValueError("Comment may not contain '--' or end with '-'")
 * 
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
 */
  __pyx_t_7 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_7 == ((xmlDoc *)NULL))) __PYX_ERR(0, 3113, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_7;

  /* "lxml/etree.pyx":3114
 * 
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3115
 *     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));

  /* "lxml/etree.pyx":3116
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3117
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3096
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
 */

  /* 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.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;
}

/* "lxml/etree.pyx":3120
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11ProcessingInstruction(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"ProcessingInstruction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11ProcessingInstruction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10ProcessingInstruction};
static PyObject *__pyx_pw_4lxml_5etree_11ProcessingInstruction(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_text,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3120, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3120, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ProcessingInstruction") < 0)) __PYX_ERR(0, 3120, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ProcessingInstruction", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3120, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  xmlDoc *__pyx_t_8;
  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);

  /* "lxml/etree.pyx":3130
 *     cdef xmlDoc*   c_doc
 * 
 *     target = _utf8(target)             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3131
 * 
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)             # <<<<<<<<<<<<<<
 *     if target.lower() == b'xml':
 *         raise ValueError, f"Invalid PI name '{target}'"
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_target); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3131, __pyx_L1_error)

  /* "lxml/etree.pyx":3132
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_2 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_2 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_2, 0+__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_5 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_xml, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_5)) {

    /* "lxml/etree.pyx":3133
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':
 *         raise ValueError, f"Invalid PI name '{target}'"             # <<<<<<<<<<<<<<
 * 
 *     if text is None:
 */
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_7 = 127;
    __Pyx_INCREF(__pyx_kp_u_Invalid_PI_name);
    __pyx_t_6 += 17;
    __Pyx_GIVEREF(__pyx_kp_u_Invalid_PI_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_PI_name);
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
    __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_6 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3133, __pyx_L1_error)

    /* "lxml/etree.pyx":3132
 *     target = _utf8(target)
 *     _tagValidOrRaise(target)
 *     if target.lower() == b'xml':             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 */
  }

  /* "lxml/etree.pyx":3135
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_5 = (__pyx_v_text == Py_None);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":3136
 * 
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__12);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__12);

    /* "lxml/etree.pyx":3135
 *         raise ValueError, f"Invalid PI name '{target}'"
 * 
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
    goto __pyx_L4;
  }

  /* "lxml/etree.pyx":3138
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *         if b'?>' in text:
 *             raise ValueError, "PI text must not contain '?>'"
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3139
 *     else:
 *         text = _utf8(text)
 *         if b'?>' in text:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI text must not contain '?>'"
 * 
 */
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__33, __pyx_v_text, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3139, __pyx_L1_error)
    if (unlikely(__pyx_t_5)) {

      /* "lxml/etree.pyx":3140
 *         text = _utf8(text)
 *         if b'?>' in text:
 *             raise ValueError, "PI text must not contain '?>'"             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _newXMLDoc()
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_PI_text_must_not_contain, 0, 0);
      __PYX_ERR(0, 3140, __pyx_L1_error)

      /* "lxml/etree.pyx":3139
 *     else:
 *         text = _utf8(text)
 *         if b'?>' in text:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI text must not contain '?>'"
 * 
 */
    }
  }
  __pyx_L4:;

  /* "lxml/etree.pyx":3142
 *             raise ValueError, "PI text must not contain '?>'"
 * 
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 */
  __pyx_t_8 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_8 == ((xmlDoc *)NULL))) __PYX_ERR(0, 3142, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_8;

  /* "lxml/etree.pyx":3143
 * 
 *     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_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_ERR(0, 3143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3144
 *     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));

  /* "lxml/etree.pyx":3145
 *     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)
 * 
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3146
 *     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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3120
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
 */

  /* 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.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;
}

/* "lxml/etree.pyx":3166
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         _utf8_data = _utf8(data)
 *         if b']]>' in _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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3166, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 3166, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3166, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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) {
  PyObject *__pyx_v__utf8_data = NULL;
  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__", 1);

  /* "lxml/etree.pyx":3167
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):
 *         _utf8_data = _utf8(data)             # <<<<<<<<<<<<<<
 *         if b']]>' in _utf8_data:
 *             raise ValueError, "']]>' not allowed inside CDATA"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__utf8_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3168
 *     def __cinit__(self, data):
 *         _utf8_data = _utf8(data)
 *         if b']]>' in _utf8_data:             # <<<<<<<<<<<<<<
 *             raise ValueError, "']]>' not allowed inside CDATA"
 *         self._utf8_data = _utf8_data
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__50, __pyx_v__utf8_data, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3168, __pyx_L1_error)
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3169
 *         _utf8_data = _utf8(data)
 *         if b']]>' in _utf8_data:
 *             raise ValueError, "']]>' not allowed inside CDATA"             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8_data
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_not_allowed_inside_CDATA, 0, 0);
    __PYX_ERR(0, 3169, __pyx_L1_error)

    /* "lxml/etree.pyx":3168
 *     def __cinit__(self, data):
 *         _utf8_data = _utf8(data)
 *         if b']]>' in _utf8_data:             # <<<<<<<<<<<<<<
 *             raise ValueError, "']]>' not allowed inside CDATA"
 *         self._utf8_data = _utf8_data
 */
  }

  /* "lxml/etree.pyx":3170
 *         if b']]>' in _utf8_data:
 *             raise ValueError, "']]>' not allowed inside CDATA"
 *         self._utf8_data = _utf8_data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(__pyx_v__utf8_data);
  __Pyx_GIVEREF(__pyx_v__utf8_data);
  __Pyx_GOTREF(__pyx_v_self->_utf8_data);
  __Pyx_DECREF(__pyx_v_self->_utf8_data);
  __pyx_v_self->_utf8_data = __pyx_v__utf8_data;

  /* "lxml/etree.pyx":3166
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         _utf8_data = _utf8(data)
 *         if b']]>' in _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_XDECREF(__pyx_v__utf8_data);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3173
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13Entity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"Entity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13Entity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12Entity};
static PyObject *__pyx_pw_4lxml_5etree_13Entity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Entity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3173, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "Entity") < 0)) __PYX_ERR(0, 3173, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Entity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3173, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.Entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12Entity(__pyx_self, __pyx_v_name);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  xmlDoc *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Entity", 1);

  /* "lxml/etree.pyx":3185
 *     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_ERR(0, 3185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3186
 *     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);

  /* "lxml/etree.pyx":3187
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 */
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3188
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (unlikely(__pyx_t_2)) {

      /* "lxml/etree.pyx":3189
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"             # <<<<<<<<<<<<<<
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = 0;
      __pyx_t_4 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_character_reference);
      __pyx_t_3 += 30;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_character_reference);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_character_reference);
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_3 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 3189, __pyx_L1_error)

      /* "lxml/etree.pyx":3188
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
 */
    }

    /* "lxml/etree.pyx":3187
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3190
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()
 */
  __pyx_t_2 = (!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0));
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3191
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 127;
    __Pyx_INCREF(__pyx_kp_u_Invalid_entity_reference);
    __pyx_t_3 += 27;
    __Pyx_GIVEREF(__pyx_kp_u_Invalid_entity_reference);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_entity_reference);
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_3 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__25);
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3191, __pyx_L1_error)

    /* "lxml/etree.pyx":3190
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, f"Invalid character reference: '{name}'"
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()
 */
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3192
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, f"Invalid entity reference: '{name}'"
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_6 == ((xmlDoc *)NULL))) __PYX_ERR(0, 3192, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_6;

  /* "lxml/etree.pyx":3193
 *         raise ValueError, f"Invalid entity reference: '{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_ERR(0, 3193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3194
 *     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);

  /* "lxml/etree.pyx":3195
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node));

  /* "lxml/etree.pyx":3196
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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_ERR(0, 3196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3173
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "lxml/etree.pyx":3199
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15SubElement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"SubElement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15SubElement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14SubElement};
static PyObject *__pyx_pw_4lxml_5etree_15SubElement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};

    /* "lxml/etree.pyx":3200
 * 
 * def SubElement(_Element _parent not None, _tag,
 *                attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parent)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3199, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3199, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, 1); __PYX_ERR(0, 3199, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3199, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3199, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "SubElement") < 0)) __PYX_ERR(0, 3199, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 3199, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3199, __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);

  /* "lxml/etree.pyx":3199
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "lxml/etree.pyx":3206
 *     appends it to an existing element.
 *     """
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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_ERR(0, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3199
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """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;
}

/* "lxml/etree.pyx":3209
 * 
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """ElementTree(element=None, file=None, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17ElementTree(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"ElementTree", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17ElementTree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_16ElementTree};
static PyObject *__pyx_pw_4lxml_5etree_17ElementTree(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_file = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_file,&__pyx_n_s_parser,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct LxmlElement *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3209, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3209, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ElementTree") < 0)) __PYX_ERR(0, 3209, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ElementTree", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3209, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3209, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) __PYX_ERR(0, 3209, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  xmlDoc *__pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ElementTree", 1);

  /* "lxml/etree.pyx":3221
 *     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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3222
 * 
 *     if element is not None:
 *         doc  = element._doc             # <<<<<<<<<<<<<<
 *     elif file is not None:
 *         try:
 */
    __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;

    /* "lxml/etree.pyx":3221
 *     cdef _Document doc
 * 
 *     if element is not None:             # <<<<<<<<<<<<<<
 *         doc  = element._doc
 *     elif file is not None:
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3223
 *     if element is not None:
 *         doc  = element._doc
 *     elif file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(file, parser, None)
 */
  __pyx_t_1 = (__pyx_v_file != Py_None);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3224
 *         doc  = element._doc
 *     elif file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "lxml/etree.pyx":3225
 *     elif file is not None:
 *         try:
 *             doc = _parseDocument(file, parser, None)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult as result_container:
 *             return result_container.result
 */
        __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, __pyx_v_parser, Py_None)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3225, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "lxml/etree.pyx":3224
 *         doc  = element._doc
 *     elif file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 */
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3226
 *         try:
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             return result_container.result
 *     else:
 */
      __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3226, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_ErrRestore(__pyx_t_2, __pyx_t_6, __pyx_t_7);
      __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
      if (__pyx_t_9) {
        __Pyx_AddTraceback("lxml.etree.ElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_2) < 0) __PYX_ERR(0, 3226, __pyx_L6_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_v_result_container = __pyx_t_6;
        /*try:*/ {

          /* "lxml/etree.pyx":3227
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 *             return result_container.result             # <<<<<<<<<<<<<<
 *     else:
 *         c_doc = _newXMLDoc()
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3227, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = __pyx_t_8;
          __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L14_return;
        }

        /* "lxml/etree.pyx":3226
 *         try:
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             return result_container.result
 *     else:
 */
        /*finally:*/ {
          __pyx_L15_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
            __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_XGOTREF(__pyx_t_17);
            __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_15);
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
            }
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
            __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
            __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
            goto __pyx_L6_except_error;
          }
          __pyx_L14_return: {
            __pyx_t_17 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
            __pyx_r = __pyx_t_17;
            __pyx_t_17 = 0;
            goto __pyx_L7_except_return;
          }
        }
      }
      goto __pyx_L6_except_error;

      /* "lxml/etree.pyx":3224
 *         doc  = element._doc
 *     elif file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 */
      __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_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_L9_try_end:;
    }

    /* "lxml/etree.pyx":3223
 *     if element is not None:
 *         doc  = element._doc
 *     elif file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(file, parser, None)
 */
    goto __pyx_L3;
  }

  /* "lxml/etree.pyx":3229
 *             return result_container.result
 *     else:
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, parser)
 * 
 */
  /*else*/ {
    __pyx_t_18 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_18 == ((xmlDoc *)NULL))) __PYX_ERR(0, 3229, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_18;

    /* "lxml/etree.pyx":3230
 *     else:
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     return _elementTreeFactory(doc, element)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "lxml/etree.pyx":3232
 *         doc = _documentFactory(c_doc, parser)
 * 
 *     return _elementTreeFactory(doc, element)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, __pyx_v_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3209
 * 
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """ElementTree(element=None, file=None, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "lxml/etree.pyx":3235
 * 
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19HTML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"HTML", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_19HTML, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18HTML};
static PyObject *__pyx_pw_4lxml_5etree_19HTML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3235, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3235, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3235, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "HTML") < 0)) __PYX_ERR(0, 3235, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("HTML", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3235, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3235, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  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;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("HTML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3250
 *     """
 *     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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3251
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3252
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 */
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree_HTMLParser); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3253
 *         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));

      /* "lxml/etree.pyx":3252
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 */
    }

    /* "lxml/etree.pyx":3250
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 */
  }

  /* "lxml/etree.pyx":3254
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":3255
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3255, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3256
 *     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_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3256, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L9_try_return;

      /* "lxml/etree.pyx":3254
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    }
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3257
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3257, __pyx_L7_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_2, __pyx_t_7, __pyx_t_8);
    __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(0, 3257, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_result_container = __pyx_t_7;
      /*try:*/ {

        /* "lxml/etree.pyx":3258
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3258, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __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_L15_return;
      }

      /* "lxml/etree.pyx":3257
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
      /*finally:*/ {
        __pyx_L16_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_18);
            __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          }
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L7_except_error;
        }
        __pyx_L15_return: {
          __pyx_t_18 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_18;
          __pyx_t_18 = 0;
          goto __pyx_L8_except_return;
        }
      }
    }
    goto __pyx_L7_except_error;

    /* "lxml/etree.pyx":3254
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    __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;
  }

  /* "lxml/etree.pyx":3235
 * 
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
 */

  /* 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_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;
}

/* "lxml/etree.pyx":3261
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"XML", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XML, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20XML};
static PyObject *__pyx_pw_4lxml_5etree_21XML(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3261, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3261, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3261, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "XML") < 0)) __PYX_ERR(0, 3261, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XML", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3261, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3261, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  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;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3281
 *     """
 *     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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3282
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3283
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 */
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree_XMLParser); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3284
 *         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));

      /* "lxml/etree.pyx":3283
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 */
    }

    /* "lxml/etree.pyx":3281
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 */
  }

  /* "lxml/etree.pyx":3285
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":3286
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lxml/etree.pyx":3287
 *     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_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3287, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L9_try_return;

      /* "lxml/etree.pyx":3285
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    }
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "lxml/etree.pyx":3288
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3288, __pyx_L7_except_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_ErrRestore(__pyx_t_2, __pyx_t_7, __pyx_t_8);
    __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(0, 3288, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_result_container = __pyx_t_7;
      /*try:*/ {

        /* "lxml/etree.pyx":3289
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3289, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __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_L15_return;
      }

      /* "lxml/etree.pyx":3288
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
      /*finally:*/ {
        __pyx_L16_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_18);
            __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          }
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L7_except_error;
        }
        __pyx_L15_return: {
          __pyx_t_18 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_18;
          __pyx_t_18 = 0;
          goto __pyx_L8_except_return;
        }
      }
    }
    goto __pyx_L7_except_error;

    /* "lxml/etree.pyx":3285
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    __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;
  }

  /* "lxml/etree.pyx":3261
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
 */

  /* 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_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;
}

/* "lxml/etree.pyx":3292
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23fromstring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"fromstring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23fromstring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22fromstring};
static PyObject *__pyx_pw_4lxml_5etree_23fromstring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3292, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3292, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3292, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fromstring") < 0)) __PYX_ERR(0, 3292, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3292, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3292, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  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("fromstring", 1);

  /* "lxml/etree.pyx":3306
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":3307
 *     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_ERR(0, 3307, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3308
 *     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_ERR(0, 3308, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "lxml/etree.pyx":3306
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3309
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3309, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 3309, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":3310
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3310, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "lxml/etree.pyx":3309
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
      /*finally:*/ {
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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_7); __pyx_t_7 = 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_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          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_L5_except_error;
        }
        __pyx_L13_return: {
          __pyx_t_16 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_16;
          __pyx_t_16 = 0;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":3306
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
    __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;
  }

  /* "lxml/etree.pyx":3292
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("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;
}

/* "lxml/etree.pyx":3313
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25fromstringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"fromstringlist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_25fromstringlist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24fromstringlist};
static PyObject *__pyx_pw_4lxml_5etree_25fromstringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_strings = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strings,&__pyx_n_s_parser,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strings)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3313, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3313, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fromstringlist") < 0)) __PYX_ERR(0, 3313, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstringlist", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3313, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3313, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstringlist", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "lxml/etree.pyx":3323
 *     """
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):             # <<<<<<<<<<<<<<
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_strings); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyUnicode_Check(__pyx_v_strings); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "lxml/etree.pyx":3324
 *     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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3324, __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_ERR(0, 3324, __pyx_L1_error)

    /* "lxml/etree.pyx":3323
 *     """
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):             # <<<<<<<<<<<<<<
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 */
  }

  /* "lxml/etree.pyx":3326
 *         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);
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3327
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     feed = parser.feed
 *     for data in strings:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3327, __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;

    /* "lxml/etree.pyx":3326
 *         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
 */
  }

  /* "lxml/etree.pyx":3328
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed             # <<<<<<<<<<<<<<
 *     for data in strings:
 *         feed(data)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_feed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_feed = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3329
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
 */
  if (likely(PyList_CheckExact(__pyx_v_strings)) || PyTuple_CheckExact(__pyx_v_strings)) {
    __pyx_t_3 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3329, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3329, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 3329, __pyx_L1_error)
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3329, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 3329, __pyx_L1_error)
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3329, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF_SET(__pyx_v_data, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "lxml/etree.pyx":3330
 *     feed = parser.feed
 *     for data in strings:
 *         feed(data)             # <<<<<<<<<<<<<<
 *     return parser.close()
 * 
 */
    __Pyx_INCREF(__pyx_v_feed);
    __pyx_t_7 = __pyx_v_feed; __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_data};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "lxml/etree.pyx":3329
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":3331
 *     for data in strings:
 *         feed(data)
 *     return parser.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_9 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_9 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3313
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "lxml/etree.pyx":3334
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27iselement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"iselement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27iselement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26iselement};
static PyObject *__pyx_pw_4lxml_5etree_27iselement(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iselement (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3334, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iselement") < 0)) __PYX_ERR(0, 3334, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iselement", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3334, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.iselement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_26iselement(__pyx_self, __pyx_v_element);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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
  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("iselement", 1);

  /* "lxml/etree.pyx":3339
 *     Checks if an object appears to be a valid element object.
 *     """
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_element)->_c_node != NULL);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3334
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":3342
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_29indent(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_28indent, "indent(tree, space=\"  \", level=0)\n\n    Indent an XML document by inserting newlines and indentation space\n    after elements.\n\n    *tree* is the ElementTree or Element to modify.  The (root) element\n    itself will not be changed, but the tail text of all elements in its\n    subtree will be adapted.\n\n    *space* is the whitespace to insert for each indentation level, two\n    space characters by default.\n\n    *level* is the initial indentation level. Setting this to a higher\n    value than 0 can be used for indenting subtrees that are more deeply\n    nested inside of a document.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_29indent = {"indent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_29indent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_28indent};
static PyObject *__pyx_pw_4lxml_5etree_29indent(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_space = 0;
  Py_ssize_t __pyx_v_level;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("indent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_space,&__pyx_n_s_level,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_kp_u__52)));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3342, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_space);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3342, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3342, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "indent") < 0)) __PYX_ERR(0, 3342, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tree = values[0];
    __pyx_v_space = values[1];
    if (values[2]) {
      __pyx_v_level = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_level == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3342, __pyx_L3_error)
    } else {
      __pyx_v_level = ((Py_ssize_t)((Py_ssize_t)0));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("indent", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3342, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.indent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_28indent(__pyx_self, __pyx_v_tree, __pyx_v_space, __pyx_v_level);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_28indent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_space, Py_ssize_t __pyx_v_level) {
  struct LxmlElement *__pyx_v_root = NULL;
  PyObject *__pyx_v_indent = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("indent", 0);
  __Pyx_INCREF(__pyx_v_space);

  /* "lxml/etree.pyx":3359
 *     nested inside of a document.
 *     """
 *     root = _rootNodeOrRaise(tree)             # <<<<<<<<<<<<<<
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3360
 *     """
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
 */
  __pyx_t_2 = (__pyx_v_level < 0);
  if (unlikely(__pyx_t_2)) {

    /* "lxml/etree.pyx":3361
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")             # <<<<<<<<<<<<<<
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)
 */
    __pyx_t_1 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_level, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Initial_indentation_level_must_b, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_ERR(0, 3361, __pyx_L1_error)

    /* "lxml/etree.pyx":3360
 *     """
 *     root = _rootNodeOrRaise(tree)
 *     if level < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
 */
  }

  /* "lxml/etree.pyx":3362
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):             # <<<<<<<<<<<<<<
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__hasChild(__pyx_v_root->_c_node);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3363
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)             # <<<<<<<<<<<<<<
 *         indent = b"\n" + level * space
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3364
 *     if _hasChild(root._c_node):
 *         space = _utf8(space)
 *         indent = b"\n" + level * space             # <<<<<<<<<<<<<<
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])
 * 
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_space); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_kp_b__21, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_indent = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3365
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
 *         _indent_children(root._c_node, 1, space, [indent, indent + space])             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(PyBytes_CheckExact(__pyx_v_space))||((__pyx_v_space) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_space))) __PYX_ERR(0, 3365, __pyx_L1_error)
    __pyx_t_1 = PyNumber_Add(__pyx_v_indent, __pyx_v_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_indent);
    __Pyx_GIVEREF(__pyx_v_indent);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_indent)) __PYX_ERR(0, 3365, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 3365, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_f_4lxml_5etree__indent_children(__pyx_v_root->_c_node, 1, ((PyObject*)__pyx_v_space), ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "lxml/etree.pyx":3362
 *     if level < 0:
 *         raise ValueError(f"Initial indentation level must be >= 0, got {level}")
 *     if _hasChild(root._c_node):             # <<<<<<<<<<<<<<
 *         space = _utf8(space)
 *         indent = b"\n" + level * space
 */
  }

  /* "lxml/etree.pyx":3342
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=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_3);
  __Pyx_AddTraceback("lxml.etree.indent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_indent);
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3368
 * 
 * 
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:             # <<<<<<<<<<<<<<
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
 */

static int __pyx_f_4lxml_5etree__indent_children(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_level, PyObject *__pyx_v_one_space, PyObject *__pyx_v_indentations) {
  PyObject *__pyx_v_child_indentation = NULL;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next_child;
  int __pyx_r;
  __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_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_indent_children", 1);

  /* "lxml/etree.pyx":3370
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:             # <<<<<<<<<<<<<<
 *         indentations.append(indentations[-1] + one_space)
 * 
 */
  if (unlikely(__pyx_v_indentations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 3370, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_indentations); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3370, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 <= __pyx_v_level);
  if (__pyx_t_2) {

    /* "lxml/etree.pyx":3371
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
 *         indentations.append(indentations[-1] + one_space)             # <<<<<<<<<<<<<<
 * 
 *     # Start a new indentation level for the first child.
 */
    if (unlikely(__pyx_v_indentations == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 3371, __pyx_L1_error)
    }
    if (unlikely(__pyx_v_indentations == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 3371, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_indentations, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_one_space); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_indentations, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 3371, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3370
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:             # <<<<<<<<<<<<<<
 *         indentations.append(indentations[-1] + one_space)
 * 
 */
  }

  /* "lxml/etree.pyx":3374
 * 
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]             # <<<<<<<<<<<<<<
 *     if not _hasNonWhitespaceText(c_node):
 *         _setNodeText(c_node, child_indentation)
 */
  if (unlikely(__pyx_v_indentations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 3374, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indentations, __pyx_v_level, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_child_indentation = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":3375
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):             # <<<<<<<<<<<<<<
 *         _setNodeText(c_node, child_indentation)
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__hasNonWhitespaceText(__pyx_v_c_node, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3375, __pyx_L1_error)
  __pyx_t_6 = (!__pyx_t_2);
  if (__pyx_t_6) {

    /* "lxml/etree.pyx":3376
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):
 *         _setNodeText(c_node, child_indentation)             # <<<<<<<<<<<<<<
 * 
 *     # Recursively indent all children.
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_child_indentation); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3376, __pyx_L1_error)

    /* "lxml/etree.pyx":3375
 *     # Start a new indentation level for the first child.
 *     child_indentation = indentations[level]
 *     if not _hasNonWhitespaceText(c_node):             # <<<<<<<<<<<<<<
 *         _setNodeText(c_node, child_indentation)
 * 
 */
  }

  /* "lxml/etree.pyx":3379
 * 
 *     # Recursively indent all children.
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _hasChild(c_child):
 */
  __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

  /* "lxml/etree.pyx":3380
 *     # Recursively indent all children.
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)
 */
  while (1) {
    __pyx_t_6 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_6) break;

    /* "lxml/etree.pyx":3381
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:
 *         if _hasChild(c_child):             # <<<<<<<<<<<<<<
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__hasChild(__pyx_v_c_child);
    if (__pyx_t_6) {

      /* "lxml/etree.pyx":3382
 *     while c_child is not NULL:
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)             # <<<<<<<<<<<<<<
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__indent_children(__pyx_v_c_child, (__pyx_v_level + 1), __pyx_v_one_space, __pyx_v_indentations); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3382, __pyx_L1_error)

      /* "lxml/etree.pyx":3381
 *     cdef xmlNode* c_child = _findChildForwards(c_node, 0)
 *     while c_child is not NULL:
 *         if _hasChild(c_child):             # <<<<<<<<<<<<<<
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 */
    }

    /* "lxml/etree.pyx":3383
 *         if _hasChild(c_child):
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:
 */
    __pyx_v_c_next_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

    /* "lxml/etree.pyx":3384
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):             # <<<<<<<<<<<<<<
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__hasNonWhitespaceTail(__pyx_v_c_child); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 3384, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_6);
    if (__pyx_t_2) {

      /* "lxml/etree.pyx":3385
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:             # <<<<<<<<<<<<<<
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
 */
      __pyx_t_2 = (__pyx_v_c_next_child == NULL);
      if (__pyx_t_2) {

        /* "lxml/etree.pyx":3387
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]             # <<<<<<<<<<<<<<
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child
 */
        if (unlikely(__pyx_v_indentations == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 3387, __pyx_L1_error)
        }
        __pyx_t_1 = (__pyx_v_level - 1);
        __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indentations, __pyx_t_1, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_child_indentation, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "lxml/etree.pyx":3385
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):
 *             if c_next_child is NULL:             # <<<<<<<<<<<<<<
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
 */
      }

      /* "lxml/etree.pyx":3388
 *                 # Dedent after the last child.
 *                 child_indentation = indentations[level-1]
 *             _setTailText(c_child, child_indentation)             # <<<<<<<<<<<<<<
 *         c_child = c_next_child
 *     return 0
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_child, __pyx_v_child_indentation); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3388, __pyx_L1_error)

      /* "lxml/etree.pyx":3384
 *             _indent_children(c_child, level+1, one_space, indentations)
 *         c_next_child = _nextElement(c_child)
 *         if not _hasNonWhitespaceTail(c_child):             # <<<<<<<<<<<<<<
 *             if c_next_child is NULL:
 *                 # Dedent after the last child.
 */
    }

    /* "lxml/etree.pyx":3389
 *                 child_indentation = indentations[level-1]
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_child = __pyx_v_c_next_child;
  }

  /* "lxml/etree.pyx":3390
 *             _setTailText(c_child, child_indentation)
 *         c_child = c_next_child
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3368
 * 
 * 
 * cdef int _indent_children(xmlNode* c_node, Py_ssize_t level, bytes one_space, list indentations) except -1:             # <<<<<<<<<<<<<<
 *     # Reuse indentation strings for speed.
 *     if len(indentations) <= level:
 */

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

/* "lxml/etree.pyx":3393
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_31dump(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_30dump, "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_31dump = {"dump", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_31dump, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_30dump};
static PyObject *__pyx_pw_4lxml_5etree_31dump(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElement *__pyx_v_elem = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_pretty_print,&__pyx_n_s_with_tail,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_elem)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3393, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3393, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dump") < 0)) __PYX_ERR(0, 3393, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_ERR(0, 3393, __pyx_L3_error)
    } else {
      __pyx_v_pretty_print = ((int)((int)1));
    }
    if (values[2]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3393, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((int)1));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3393, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3393, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_30dump(__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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_30dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, int __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_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump", 1);

  /* "lxml/etree.pyx":3399
 *     should be used for debugging only.
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')             # <<<<<<<<<<<<<<
 *     if not pretty_print:
 *         xml += '\n'
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_elem);
  __Pyx_GIVEREF((PyObject *)__pyx_v_elem);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_elem))) __PYX_ERR(0, 3399, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_pretty_print); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pretty_print, __pyx_t_4) < 0) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_with_tail); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_with_tail, __pyx_t_4) < 0) __PYX_ERR(0, 3399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3399, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __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;

  /* "lxml/etree.pyx":3400
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         xml += '\n'
 *     sys.stdout.write(xml)
 */
  __pyx_t_5 = (!__pyx_v_pretty_print);
  if (__pyx_t_5) {

    /* "lxml/etree.pyx":3401
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:
 *         xml += '\n'             # <<<<<<<<<<<<<<
 *     sys.stdout.write(xml)
 * 
 */
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_xml, __pyx_kp_u__21); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_xml, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3400
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail, encoding='unicode')
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         xml += '\n'
 *     sys.stdout.write(xml)
 */
  }

  /* "lxml/etree.pyx":3402
 *     if not pretty_print:
 *         xml += '\n'
 *     sys.stdout.write(xml)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_xml};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":3393
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_33tostring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_32tostring, "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, inclusive_ns_prefixes=None,\n                 with_comments=True, strip_text=False,\n                 )\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 name ``'unicode'`` as encoding (or the ``str`` function\n    in Py3 or ``unicode`` in Py2).  This changes the return value from\n    a byte 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), 'c14n' or 'c14n2'.\n    Default is 'xml'.\n\n    With ``method=\"c14n\"`` (C14N version 1), the options ``exclusive``,\n    ``with_comments`` and ``inclusive_ns_prefixes`` request exclusive\n    C14N, include comments, and list the inclusive prefixes respectively.\n\n    With ``method=\"c14n2\"`` (C14N version 2), the ``with_comments`` and\n    ``strip_text`` options control the output of comments and text space\n    according to C14N 2.0.\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_33tostring = {"tostring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_33tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_32tostring};
static PyObject *__pyx_pw_4lxml_5etree_33tostring(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_v_with_comments;
  int __pyx_v_strip_text;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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_inclusive_ns_prefixes,&__pyx_n_s_with_comments,&__pyx_n_s_strip_text,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_n_u_xml)));

    /* "lxml/etree.pyx":3406
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":3407
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 */
    values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "lxml/etree.pyx":3409
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
 */
    values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_or_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3405, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3405, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tostring") < 0)) __PYX_ERR(0, 3405, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_ERR(0, 3406, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3406
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
 */
      __pyx_v_pretty_print = ((int)((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_ERR(0, 3406, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((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_ERR(0, 3409, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3409
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
 */
      __pyx_v_exclusive = ((int)((int)0));
    }
    __pyx_v_inclusive_ns_prefixes = values[9];
    if (values[10]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3411, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3411
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *              ):
 *     """tostring(element_or_tree, encoding=None, method="xml",
 */
      __pyx_v_with_comments = ((int)((int)1));
    }
    if (values[11]) {
      __pyx_v_strip_text = __Pyx_PyObject_IsTrue(values[11]); if (unlikely((__pyx_v_strip_text == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3411, __pyx_L3_error)
    } else {
      __pyx_v_strip_text = ((int)((int)0));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3405, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_32tostring(__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_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_strip_text);

  /* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_32tostring(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, PyObject *__pyx_v_inclusive_ns_prefixes, int __pyx_v_with_comments, int __pyx_v_strip_text) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_v_out = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_UCS4 __pyx_t_9;
  const char *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "lxml/etree.pyx":3464
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 */
  __Pyx_INCREF(__pyx_v_method);
  __pyx_t_1 = __pyx_v_method;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3464, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_c14n2, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3464, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3465
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 */
    __pyx_t_3 = (__pyx_v_encoding != Py_None);
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3466
 *     if method in ('c14n', 'c14n2'):
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3466, __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_ERR(0, 3466, __pyx_L1_error)

      /* "lxml/etree.pyx":3465
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 */
    }

    /* "lxml/etree.pyx":3467
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3467, __pyx_L1_error)
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3468
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         if method == 'c14n':
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3468, __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_ERR(0, 3468, __pyx_L1_error)

      /* "lxml/etree.pyx":3467
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
 */
    }

    /* "lxml/etree.pyx":3469
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
 */
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_c14n, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3469, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "lxml/etree.pyx":3470
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *         else:
 *             out = BytesIO()
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __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_1)) __PYX_ERR(0, 3470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "lxml/etree.pyx":3469
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
 */
    }

    /* "lxml/etree.pyx":3472
 *             return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *         else:
 *             out = BytesIO()             # <<<<<<<<<<<<<<
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
      __pyx_t_4 = __pyx_v_4lxml_5etree_BytesIO; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3472, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_v_out = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "lxml/etree.pyx":3474
 *             out = BytesIO()
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,             # <<<<<<<<<<<<<<
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)
 */
      __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
      __pyx_t_4 = __pyx_v_4lxml_5etree_utf8_writer; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_out};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3474, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "lxml/etree.pyx":3473
 *         else:
 *             out = BytesIO()
 *             target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 3473, __pyx_L1_error);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3475
 *             target = C14NWriterTarget(
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)             # <<<<<<<<<<<<<<
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
 */
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3475, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_with_comments); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3475, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_with_comments, __pyx_t_5) < 0) __PYX_ERR(0, 3475, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_strip_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3475, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_strip_text, __pyx_t_5) < 0) __PYX_ERR(0, 3475, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lxml/etree.pyx":3473
 *         else:
 *             out = BytesIO()
 *             target = C14NWriterTarget(             # <<<<<<<<<<<<<<
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)
 */
      __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget), __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "lxml/etree.pyx":3476
 *                 utf8_writer(out).write,
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)             # <<<<<<<<<<<<<<
 *             return out.getvalue()
 *     if not with_comments:
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__tree_to_target(__pyx_v_element_or_tree, ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "lxml/etree.pyx":3477
 *                 with_comments=with_comments, strip_text=strip_text)
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()             # <<<<<<<<<<<<<<
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3477, __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;
    }

    /* "lxml/etree.pyx":3464
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method in ('c14n', 'c14n2'):             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 */
  }

  /* "lxml/etree.pyx":3478
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
 */
  __pyx_t_3 = (!__pyx_v_with_comments);
  if (unlikely(__pyx_t_3)) {

    /* "lxml/etree.pyx":3479
 *             return out.getvalue()
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 3479, __pyx_L1_error)

    /* "lxml/etree.pyx":3478
 *             _tree_to_target(element_or_tree, target)
 *             return out.getvalue()
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
 */
  }

  /* "lxml/etree.pyx":3480
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 */
  if (unlikely(__pyx_v_strip_text)) {

    /* "lxml/etree.pyx":3481
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 3481, __pyx_L1_error)

    /* "lxml/etree.pyx":3480
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 */
  }

  /* "lxml/etree.pyx":3482
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
 */
  __pyx_t_2 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_encoding != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_unicode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3482, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3483
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3483, __pyx_L1_error)
    if (unlikely(__pyx_t_3)) {

      /* "lxml/etree.pyx":3484
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 "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_ERR(0, 3484, __pyx_L1_error)

      /* "lxml/etree.pyx":3483
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
 */
    }

    /* "lxml/etree.pyx":3486
 *             raise ValueError, \
 *                 "Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0             # <<<<<<<<<<<<<<
 *         encoding = unicode
 *     elif xml_declaration is None:
 */
    __pyx_v_write_declaration = 0;

    /* "lxml/etree.pyx":3487
 *                 "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((PyObject *)(&PyUnicode_Type));
    __Pyx_DECREF_SET(__pyx_v_encoding, ((PyObject *)(&PyUnicode_Type)));

    /* "lxml/etree.pyx":3482
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
 */
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":3488
 *         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_3 = (__pyx_v_xml_declaration == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3490
 *     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 \             # <<<<<<<<<<<<<<
 *                             ('ASCII', 'UTF-8', 'UTF8', 'US-ASCII')
 *     else:
 */
    __pyx_t_2 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_ASCII, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3490, __pyx_L1_error)
    if (__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_UTF_8, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3490, __pyx_L1_error)
    if (__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_UTF8, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3490, __pyx_L1_error)
    if (__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_US_ASCII, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3490, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_7;
    __pyx_L18_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __pyx_t_2;
    __pyx_t_3 = __pyx_t_7;
    __pyx_L16_bool_binop_done:;
    __pyx_v_write_declaration = __pyx_t_3;

    /* "lxml/etree.pyx":3488
 *         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 \
 */
    goto __pyx_L11;
  }

  /* "lxml/etree.pyx":3493
 *                             ('ASCII', 'UTF-8', 'UTF8', 'US-ASCII')
 *     else:
 *         write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *     if encoding is None:
 *         encoding = 'ASCII'
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3493, __pyx_L1_error)
    __pyx_v_write_declaration = __pyx_t_3;
  }
  __pyx_L11:;

  /* "lxml/etree.pyx":3494
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = 'ASCII'
 *     if standalone is None:
 */
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3495
 *         write_declaration = xml_declaration
 *     if encoding is None:
 *         encoding = 'ASCII'             # <<<<<<<<<<<<<<
 *     if standalone is None:
 *         is_standalone = -1
 */
    __Pyx_INCREF(__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);

    /* "lxml/etree.pyx":3494
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = 'ASCII'
 *     if standalone is None:
 */
  }

  /* "lxml/etree.pyx":3496
 *     if encoding is None:
 *         encoding = 'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
 */
  __pyx_t_3 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3497
 *         encoding = 'ASCII'
 *     if standalone is None:
 *         is_standalone = -1             # <<<<<<<<<<<<<<
 *     elif standalone:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = -1;

    /* "lxml/etree.pyx":3496
 *     if encoding is None:
 *         encoding = 'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
 */
    goto __pyx_L23;
  }

  /* "lxml/etree.pyx":3498
 *     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_ERR(0, 3498, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3499
 *         is_standalone = -1
 *     elif standalone:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 1
 *     else:
 */
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":3500
 *     elif standalone:
 *         write_declaration = 1
 *         is_standalone = 1             # <<<<<<<<<<<<<<
 *     else:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = 1;

    /* "lxml/etree.pyx":3498
 *     if standalone is None:
 *         is_standalone = -1
 *     elif standalone:             # <<<<<<<<<<<<<<
 *         write_declaration = 1
 *         is_standalone = 1
 */
    goto __pyx_L23;
  }

  /* "lxml/etree.pyx":3502
 *         is_standalone = 1
 *     else:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 0
 * 
 */
  /*else*/ {
    __pyx_v_write_declaration = 1;

    /* "lxml/etree.pyx":3503
 *     else:
 *         write_declaration = 1
 *         is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(element_or_tree, _Element):
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L23:;

  /* "lxml/etree.pyx":3505
 *         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_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_3) {

    /* "lxml/etree.pyx":3506
 * 
 *     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);

    /* "lxml/etree.pyx":3508
 *         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_5 = __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_5)) __PYX_ERR(0, 3506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3505
 *         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,
 */
  }

  /* "lxml/etree.pyx":3509
 *                          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_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (likely(__pyx_t_3)) {

    /* "lxml/etree.pyx":3510
 *                          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_5 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_5);

    /* "lxml/etree.pyx":3512
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Type '{python._fqtypename(element_or_tree).decode('utf8')}' cannot be serialized."
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_5), __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_ERR(0, 3510, __pyx_L1_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_L0;

    /* "lxml/etree.pyx":3509
 *                          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,
 */
  }

  /* "lxml/etree.pyx":3514
 *                          pretty_print, with_tail, is_standalone)
 *     else:
 *         raise TypeError, f"Type '{python._fqtypename(element_or_tree).decode('utf8')}' cannot be serialized."             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = 127;
    __Pyx_INCREF(__pyx_kp_u_Type);
    __pyx_t_8 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_Type);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Type);
    __pyx_t_10 = _fqtypename(__pyx_v_element_or_tree);
    __pyx_t_11 = __Pyx_ssize_strlen(__pyx_t_10); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3514, __pyx_L1_error)
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_10, 0, __pyx_t_11, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_9;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_kp_u_cannot_be_serialized);
    __pyx_t_8 += 23;
    __Pyx_GIVEREF(__pyx_kp_u_cannot_be_serialized);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_cannot_be_serialized);
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 3514, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="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_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "lxml/etree.pyx":3518
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_35tostringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_34tostringlist, "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_35tostringlist = {"tostringlist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_35tostringlist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_34tostringlist};
static PyObject *__pyx_pw_4lxml_5etree_35tostringlist(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_or_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3518, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, used_pos_args, "tostringlist") < 0)) __PYX_ERR(0, 3518, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_element_or_tree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostringlist", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 3518, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_34tostringlist(__pyx_self, __pyx_v_element_or_tree, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_34tostringlist(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", 1);

  /* "lxml/etree.pyx":3527
 *     single string wrapped in a list.
 *     """
 *     return [tostring(element_or_tree, *args, **kwargs)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_element_or_tree);
  __Pyx_GIVEREF(__pyx_v_element_or_tree);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree)) __PYX_ERR(0, 3527, __pyx_L1_error);
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3527, __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_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 3527, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3518
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_37tounicode(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_36tounicode, "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_37tounicode = {"tounicode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_37tounicode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_36tounicode};
static PyObject *__pyx_pw_4lxml_5etree_37tounicode(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_n_u_xml)));

    /* "lxml/etree.pyx":3531
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_or_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3530, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3530, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tounicode") < 0)) __PYX_ERR(0, 3530, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_ERR(0, 3530, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */
      __pyx_v_pretty_print = ((int)((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_ERR(0, 3531, __pyx_L3_error)
    } else {

      /* "lxml/etree.pyx":3531
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
      __pyx_v_with_tail = ((int)((int)1));
    }
    __pyx_v_doctype = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tounicode", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3530, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_36tounicode(__pyx_self, __pyx_v_element_or_tree, __pyx_v_method, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_doctype);

  /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_36tounicode(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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tounicode", 1);

  /* "lxml/etree.pyx":3553
 *     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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "lxml/etree.pyx":3554
 *     """
 *     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);

    /* "lxml/etree.pyx":3555
 *     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_2 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), ((PyObject *)(&PyUnicode_Type)), __pyx_v_doctype, __pyx_v_method, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "lxml/etree.pyx":3553
 *     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)
 */
  }

  /* "lxml/etree.pyx":3556
 *         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_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (likely(__pyx_t_1)) {

    /* "lxml/etree.pyx":3557
 *                           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_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_2);

    /* "lxml/etree.pyx":3559
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"Type '{type(element_or_tree)}' cannot be serialized."
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_2), ((PyObject *)(&PyUnicode_Type)), __pyx_v_doctype, __pyx_v_method, 0, 1, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3557, __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;

    /* "lxml/etree.pyx":3556
 *         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,
 */
  }

  /* "lxml/etree.pyx":3561
 *                          with_tail, -1)
 *     else:
 *         raise TypeError, f"Type '{type(element_or_tree)}' cannot be serialized."             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 127;
    __Pyx_INCREF(__pyx_kp_u_Type);
    __pyx_t_4 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_Type);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Type);
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element_or_tree)), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_5;
    __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_kp_u_cannot_be_serialized);
    __pyx_t_4 += 23;
    __Pyx_GIVEREF(__pyx_kp_u_cannot_be_serialized);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_cannot_be_serialized);
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3561, __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_ERR(0, 3561, __pyx_L1_error)
  }

  /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":3564
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_39parse(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_38parse, "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_39parse = {"parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_39parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_38parse};
static PyObject *__pyx_pw_4lxml_5etree_39parse(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_source)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3564, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3564, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3564, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parse") < 0)) __PYX_ERR(0, 3564, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3564, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(0, 3564, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_38parse(__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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_38parse(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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  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("parse", 1);

  /* "lxml/etree.pyx":3589
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "lxml/etree.pyx":3590
 *     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_ERR(0, 3590, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "lxml/etree.pyx":3591
 *     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_ERR(0, 3591, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "lxml/etree.pyx":3589
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "lxml/etree.pyx":3592
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3592, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 3592, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_result_container = __pyx_t_5;
      /*try:*/ {

        /* "lxml/etree.pyx":3593
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3593, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "lxml/etree.pyx":3592
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
      /*finally:*/ {
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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_7); __pyx_t_7 = 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_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          }
          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_L5_except_error;
        }
        __pyx_L13_return: {
          __pyx_t_16 = __pyx_r;
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_v_result_container); __pyx_v_result_container = 0;
          __pyx_r = __pyx_t_16;
          __pyx_t_16 = 0;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "lxml/etree.pyx":3589
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 */
    __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;
  }

  /* "lxml/etree.pyx":3564
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("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;
}

/* "lxml/etree.pyx":3596
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_41adopt_external_document(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_40adopt_external_document, "adopt_external_document(capsule, parser=None)\n\n    Unpack a libxml2 document pointer from a PyCapsule and wrap it in an\n    lxml ElementTree object.\n\n    This allows external libraries to build XML/HTML trees using libxml2\n    and then pass them efficiently into lxml for further processing.\n\n    If a ``parser`` is provided, it will be used for configuring the\n    lxml document.  No parsing will be done.\n\n    The capsule must have the name ``\"libxml2:xmlDoc\"`` and its pointer\n    value must reference a correct libxml2 document of type ``xmlDoc*``.\n    The creator of the capsule must take care to correctly clean up the\n    document using an appropriate capsule destructor.  By default, the\n    libxml2 document will be copied to let lxml safely own the memory\n    of the internal tree that it uses.\n\n    If the capsule context is non-NULL, it must point to a C string that\n    can be compared using ``strcmp()``.  If the context string equals\n    ``\"destructor:xmlFreeDoc\"``, the libxml2 document will not be copied\n    but the capsule invalidated instead by clearing its destructor and\n    name.  That way, lxml takes ownership of the libxml2 document in memory\n    without creating a copy first, and the capsule destructor will not be\n    called.  The document will then eventually be cleaned up by lxml using\n    the libxml2 API function ``xmlFreeDoc()`` once it is no longer used.\n\n    If no copy is made, later modifications of the tree outside of lxml\n    should not be attempted after transferring the ownership.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_41adopt_external_document = {"adopt_external_document", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_41adopt_external_document, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_40adopt_external_document};
static PyObject *__pyx_pw_4lxml_5etree_41adopt_external_document(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_capsule = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("adopt_external_document (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_capsule,&__pyx_n_s_parser,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_capsule)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3596, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3596, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "adopt_external_document") < 0)) __PYX_ERR(0, 3596, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_capsule = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("adopt_external_document", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3596, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.adopt_external_document", __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_ERR(0, 3596, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_40adopt_external_document(__pyx_self, __pyx_v_capsule, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_40adopt_external_document(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capsule, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_is_owned;
  struct LxmlDocument *__pyx_v_doc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  void *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("adopt_external_document", 1);

  /* "lxml/etree.pyx":3628
 *     """
 *     cdef xmlDoc* c_doc
 *     cdef bint is_owned = False             # <<<<<<<<<<<<<<
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 */
  __pyx_v_is_owned = 0;

  /* "lxml/etree.pyx":3629
 *     cdef xmlDoc* c_doc
 *     cdef bint is_owned = False
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)             # <<<<<<<<<<<<<<
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)
 */
  __pyx_t_1 = lxml_unpack_xmldoc_capsule(__pyx_v_capsule, (&__pyx_v_is_owned)); if (unlikely(__pyx_t_1 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 3629, __pyx_L1_error)
  __pyx_v_c_doc = ((xmlDoc *)__pyx_t_1);

  /* "lxml/etree.pyx":3630
 *     cdef bint is_owned = False
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)             # <<<<<<<<<<<<<<
 *     return _elementTreeFactory(doc, None)
 * 
 */
  __pyx_t_3.__pyx_n = 2;
  __pyx_t_3.parser = __pyx_v_parser;
  __pyx_t_3.is_owned = __pyx_v_is_owned;
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__adoptForeignDoc(__pyx_v_c_doc, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3631
 *     c_doc = <xmlDoc*> python.lxml_unpack_xmldoc_capsule(capsule, &is_owned)
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3596
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.adopt_external_document", __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;
}

/* "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "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;

  /* "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;

  /* "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;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """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", 1);

  /* "src/lxml/readonlytree.pxi":17
 *         """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));
  if (unlikely(__pyx_t_1)) {

    /* "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__54, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 18, __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_ERR(8, 18, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":17
 *         """This is our way of saying: this proxy is invalid!
 *         """
 *         if not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0
 */
  }

  /* "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;

  /* "src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError(f"Unsupported node type: {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", 1);

  /* "src/lxml/readonlytree.pxi":22
 * 
 *     cdef int _raise_unsupported_type(self) except -1:
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")             # <<<<<<<<<<<<<<
 * 
 *     cdef void free_after_use(self) noexcept:
 */
  __pyx_t_1 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_self->_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unsupported_node_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 22, __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_ERR(8, 22, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError(f"Unsupported node type: {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;
}

/* "src/lxml/readonlytree.pxi":24
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
 *     cdef void free_after_use(self) noexcept:             # <<<<<<<<<<<<<<
 *         """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) {

  /* "src/lxml/readonlytree.pxi":27
 *         """Should the xmlNode* be freed when releasing the proxy?
 *         """
 *         self._free_after_use = 1             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_v_self->_free_after_use = 1;

  /* "src/lxml/readonlytree.pxi":24
 *         raise TypeError(f"Unsupported node type: {self._c_node.type}")
 * 
 *     cdef void free_after_use(self) noexcept:             # <<<<<<<<<<<<<<
 *         """Should the xmlNode* be freed when releasing the proxy?
 *         """
 */

  /* function exit code */
}

/* "src/lxml/readonlytree.pxi":29
 *         self._free_after_use = 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         """Element tag
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":33
 *         """Element tag
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 33, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":34
 *         """
 *         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:
 */
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "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_ERR(8, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":34
 *         """
 *         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:
 */
    break;
    case XML_PI_NODE:

    /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "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:
 */
    break;
    case XML_COMMENT_NODE:

    /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "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:
 */
    break;
    case XML_ENTITY_REF_NODE:

    /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Entity); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "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:
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":43
 *             return Entity
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __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 == ((int)-1))) __PYX_ERR(8, 43, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":29
 *         self._free_after_use = 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tag(self):
 *         """Element tag
 */

  /* 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;
}

/* "src/lxml/readonlytree.pxi":45
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         """Text before the first subelement. This is either a string or
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __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("__get__", 1);

  /* "src/lxml/readonlytree.pxi":50
 *         the value None, if there was no text.
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 50, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":51
 *         """
 *         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,
 */
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "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_ERR(8, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":51
 *         """
 *         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,
 */
    break;
    case XML_PI_NODE:

    /* "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_COMMENT_NODE:

    /* "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);
    if (__pyx_t_3) {

      /* "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_u__12);
      __pyx_r = __pyx_kp_u__12;
      goto __pyx_L0;

      /* "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:
 */
    }

    /* "src/lxml/readonlytree.pxi":58
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return f'&{funicode(self._c_node.name)};'
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "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:
 */
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/readonlytree.pxi":60
 *                 return funicode(self._c_node.content)
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *             return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_5 = 127;
    __Pyx_INCREF(__pyx_kp_u__34);
    __pyx_t_4 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__34);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__34);
    __pyx_t_6 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_Unicode(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
    __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u__35);
    __pyx_t_4 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__35);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__35);
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 60, __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;

    /* "src/lxml/readonlytree.pxi":59
 *             else:
 *                 return funicode(self._c_node.content)
 *         elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *             return f'&{funicode(self._c_node.name)};'
 *         else:
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":62
 *             return f'&{funicode(self._c_node.name)};'
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __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 == ((int)-1))) __PYX_ERR(8, 62, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":45
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         """Text before the first subelement. This is either a string or
 */

  /* 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_XDECREF(__pyx_t_7);
  __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;
}

/* "src/lxml/readonlytree.pxi":64
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tail(self):
 *         """Text after this element's end tag, but before the next sibling
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":70
 *         there was no text.
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 70, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":71
 *         """
 *         self._assertNode()
 *         return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->next); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":64
 *             self._raise_unsupported_type()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tail(self):
 *         """Text after this element's end tag, but before the next sibling
 */

  /* 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;
}

/* "src/lxml/readonlytree.pxi":73
 *         return _collectText(self._c_node.next)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def sourceline(self):
 *         """Original line number as found by the parser or None if unknown.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":78
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 78, __pyx_L1_error)

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

  /* "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);
  if (__pyx_t_2) {

    /* "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_ERR(8, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":80
 *         self._assertNode()
 *         line = tree.xmlGetLineNo(self._c_node)
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             return line
 *         else:
 */
  }

  /* "src/lxml/readonlytree.pxi":83
 *             return line
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":73
 *         return _collectText(self._c_node.next)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def sourceline(self):
 *         """Original line number as found by the parser or None if unknown.
 */

  /* 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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  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("__repr__", 1);

  /* "src/lxml/readonlytree.pxi":86
 * 
 *     def __repr__(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<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 == ((int)-1))) __PYX_ERR(8, 86, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":87
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
  switch (__pyx_v_self->_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":88
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = 127;
    __Pyx_INCREF(__pyx_kp_u_Element);
    __pyx_t_3 += 9;
    __Pyx_GIVEREF(__pyx_kp_u_Element);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Element);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_kp_u_at_0x);
    __pyx_t_3 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_at_0x);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_at_0x);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_6, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_kp_u__29);
    __pyx_t_3 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__29);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__29);
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 88, __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;

    /* "src/lxml/readonlytree.pxi":87
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":90
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":89
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return "<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 */
    break;
    case XML_ENTITY_NODE:

    /* "src/lxml/readonlytree.pxi":92
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 92, __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;

    /* "src/lxml/readonlytree.pxi":91
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return "<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:             # <<<<<<<<<<<<<<
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":94
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text             # <<<<<<<<<<<<<<
 *             if text:
 *                 return "<?%s %s?>" % (self.target, text)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_text = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":95
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(8, 95, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "src/lxml/readonlytree.pxi":96
 *             text = self.text
 *             if text:
 *                 return "<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return "<?%s?>" % self.target
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_4 = 127;
      __Pyx_INCREF(__pyx_kp_u__32);
      __pyx_t_3 += 2;
      __Pyx_GIVEREF(__pyx_kp_u__32);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u__32);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__11);
      __pyx_t_3 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__11);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__11);
      __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_text), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__33);
      __pyx_t_3 += 2;
      __Pyx_GIVEREF(__pyx_kp_u__33);
      PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__33);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "src/lxml/readonlytree.pxi":95
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
 */
    }

    /* "src/lxml/readonlytree.pxi":98
 *                 return "<?%s %s?>" % (self.target, text)
 *             else:
 *                 return "<?%s?>" % self.target             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }

    /* "src/lxml/readonlytree.pxi":93
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return "&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             text = self.text
 *             if text:
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":100
 *                 return "<?%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 == ((int)-1))) __PYX_ERR(8, 100, __pyx_L1_error)
    break;
  }

  /* "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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_4__getitem__, "Returns the subelement at the given position or the requested\n        slice.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);

  /* "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;

  /* "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;

  /* "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 == ((int)-1))) __PYX_ERR(8, 111, __pyx_L1_error)

  /* "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); 
  if (__pyx_t_2) {

    /* "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_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(8, 114, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "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_ERR(8, 115, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "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)
 */
    }

    /* "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 == ((int)-1))) __PYX_ERR(8, 116, __pyx_L1_error)

    /* "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);
    if (__pyx_t_2) {

      /* "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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "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:
 */
    }

    /* "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);
    if (__pyx_t_2) {

      /* "src/lxml/readonlytree.pxi":120
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;

      /* "src/lxml/readonlytree.pxi":119
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/readonlytree.pxi":122
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
    /*else*/ {
      __pyx_v_step = (-__pyx_v_step);

      /* "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:;

    /* "src/lxml/readonlytree.pxi":124
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "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;

    /* "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_4 = (__pyx_v_c_node != NULL);
      if (__pyx_t_4) {
      } else {
        __pyx_t_2 = __pyx_t_4;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_4 = (__pyx_v_c < __pyx_v_slicelength);
      __pyx_t_2 = __pyx_t_4;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_2) break;

      /* "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_3 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(8, 127, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doc); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 128, __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__Document))))) __PYX_ERR(8, 128, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(8, 128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

      /* "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_7 = __pyx_v_step;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "src/lxml/readonlytree.pxi":131
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
        __pyx_t_8 = __pyx_v_next_element(__pyx_v_c_node); if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 131, __pyx_L1_error)
        __pyx_v_c_node = __pyx_t_8;
      }
    }

    /* "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;

    /* "src/lxml/readonlytree.pxi":112
 *         cdef list result
 *         self._assertNode()
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  }

  /* "src/lxml/readonlytree.pxi":135
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 */
  /*else*/ {
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(8, 135, __pyx_L1_error)
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_7);

    /* "src/lxml/readonlytree.pxi":136
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/readonlytree.pxi":137
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, "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_ERR(8, 137, __pyx_L1_error)

      /* "src/lxml/readonlytree.pxi":136
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
    }

    /* "src/lxml/readonlytree.pxi":138
 *             if c_node is NULL:
 *                 raise IndexError, "list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         """Returns the subelement at the given position or the requested
 *         slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Returns the number of subelements.
 *         """
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__len__, "Returns the number of subelements.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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;

  /* "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 == ((int)-1))) __PYX_ERR(8, 145, __pyx_L1_error)

  /* "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;

  /* "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;

  /* "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);
    if (!__pyx_t_3) break;

    /* "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);
    if (__pyx_t_3) {

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

      /* "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
 */
    }

    /* "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;
  }

  /* "src/lxml/readonlytree.pxi":152
 *                 c = c + 1
 *             c_node = c_node.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """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:;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__bool__(((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__bool__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":156
 *     def __bool__(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 == ((int)-1))) __PYX_ERR(8, 156, __pyx_L1_error)

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

  /* "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;

  /* "src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
 */

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

/* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__, "__deepcopy__(self, memo)");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 160, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(8, 160, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 160, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":162
 *     def __deepcopy__(self, memo):
 *         "__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_ERR(8, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__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;
}

/* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 164, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "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_6 = (__pyx_v_self->_c_node == NULL);
  if (__pyx_t_6) {

    /* "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;

    /* "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
 */
  }

  /* "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_7 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_c_node->doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_7 == ((xmlDoc *)NULL))) __PYX_ERR(8, 171, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_7;

  /* "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_ERR(8, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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_ERR(8, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "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_6 = (__pyx_v_root != Py_None);
  if (__pyx_t_6) {

    /* "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;

    /* "src/lxml/readonlytree.pxi":174
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  }

  /* "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_8 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_8;

  /* "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_9 = (__pyx_v_c_node != NULL);
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_c_node->type != __pyx_v_self->_c_node->type);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L7_bool_binop_done:;
    if (!__pyx_t_6) break;

    /* "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_8 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_8;
  }

  /* "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_6 = (__pyx_v_c_node == NULL);
  if (__pyx_t_6) {

    /* "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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "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)
 */
  }

  /* "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_ERR(8, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

  /* 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._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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__, "__copy__(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_13__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 164, __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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "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_ERR(8, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 185, __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;

  /* "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;
}

/* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren, "iterchildren(self, tag=None, reversed=False)\n\n        Iterate over the children of this element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_17iterchildren = {"iterchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 187, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 187, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iterchildren") < 0)) __PYX_ERR(8, 187, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterchildren", 0, 0, 1, __pyx_nargs); __PYX_ERR(8, 187, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_8genexpr9__pyx_v_el = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterchildren", 1);

  /* "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_ERR(8, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_children = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "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_3 = (__pyx_v_tag != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_kp_u__22, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 193, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "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]
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 194, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_v_children)) || PyTuple_CheckExact(__pyx_v_children)) {
        __pyx_t_4 = __pyx_v_children; __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_children); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 194, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 194, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 194, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(8, 194, __pyx_L8_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 194, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 194, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(8, 194, __pyx_L8_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 194, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(8, 194, __pyx_L8_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_el, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr9__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 194, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(8, 194, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(8, 194, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_2) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr9__pyx_v_el))) __PYX_ERR(8, 194, __pyx_L8_error)
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_el); __pyx_8genexpr9__pyx_v_el = 0;
      goto __pyx_L13_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_el); __pyx_8genexpr9__pyx_v_el = 0;
      goto __pyx_L1_error;
      __pyx_L13_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "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:
 */
  }

  /* "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_2 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(8, 195, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "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 = __Pyx_PyObject_GetItem(__pyx_v_children, __pyx_slice__55); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "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)
 */
  }

  /* "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_ERR(8, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
 */

  /* 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_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_children);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
 */

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlNode *__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("getchildren", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getchildren); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/readonlytree.pxi":205
 *         cdef xmlNode* c_node
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         result = []
 *         c_node = self._c_node.children
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(8, 205, __pyx_L1_error)

  /* "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_ERR(8, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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_6 = __pyx_v_self->_c_node->children;
  __pyx_v_c_node = __pyx_t_6;

  /* "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_7 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_7) break;

    /* "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_7 = _isElement(__pyx_v_c_node);
    if (__pyx_t_7) {

      /* "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_ERR(8, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(8, 210, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "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
 */
    }

    /* "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_6 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_6;
  }

  /* "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;

  /* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren, "Returns all subelements. The elements are returned in document\n        order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_19getchildren = {"getchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getchildren", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getchildren", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 199, __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;
}

/* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent, "Returns the parent of this element or None for the root element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_21getparent = {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getparent", 0))) return NULL;
  __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;
  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("getparent", 1);

  /* "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 == ((int)-1))) __PYX_ERR(8, 218, __pyx_L1_error)

  /* "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;

  /* "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_4 = (__pyx_v_c_parent == NULL);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (!_isElement(__pyx_v_c_parent));
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "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:
 */
  }

  /* "src/lxml/readonlytree.pxi":223
 *             return None
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_5), __pyx_v_c_parent)); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext, "Returns the following sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_23getnext = {"getnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getnext", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getnext", 0))) return NULL;
  __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", 1);

  /* "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 == ((int)-1))) __PYX_ERR(8, 229, __pyx_L1_error)

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

  /* "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);
  if (__pyx_t_2) {

    /* "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_ERR(8, 232, __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;

    /* "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
 */
  }

  /* "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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious, "Returns the preceding sibling of this element or None.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_25getprevious = {"getprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious};
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getprevious", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getprevious", 0))) return NULL;
  __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", 1);

  /* "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 == ((int)-1))) __PYX_ERR(8, 239, __pyx_L1_error)

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

  /* "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);
  if (__pyx_t_2) {

    /* "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_ERR(8, 242, __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;

    /* "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
 */
  }

  /* "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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":250
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
 *     """A read-only proxy for processing instructions (for internal use only!)"""
 *     @property             # <<<<<<<<<<<<<<
 *     def target(self):
 *         self._assertNode()
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":252
 *     @property
 *     def target(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 == ((int)-1))) __PYX_ERR(8, 252, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":253
 *     def target(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_ERR(8, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":250
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):
 *     """A read-only proxy for processing instructions (for internal use only!)"""
 *     @property             # <<<<<<<<<<<<<<
 *     def target(self):
 *         self._assertNode()
 */

  /* 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;
}

/* "src/lxml/readonlytree.pxi":260
 *     """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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "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_ERR(8, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":260
 *     """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;
}

/* "src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);

  /* "src/lxml/readonlytree.pxi":264
 * 
 *         def __set__(self, value):
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":265
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__34, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 265, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__35, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 265, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/readonlytree.pxi":266
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 */
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = 0;
    __pyx_t_5 = 127;
    __Pyx_INCREF(__pyx_kp_u_Invalid_entity_name);
    __pyx_t_4 += 21;
    __Pyx_GIVEREF(__pyx_kp_u_Invalid_entity_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_entity_name);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
    __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_4 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(8, 266, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":265
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  }

  /* "src/lxml/readonlytree.pxi":267
 *             if '&' in value or ';' in value:
 *                 raise ValueError(f"Invalid entity name '{value}'")
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if '&' in value or ';' in value:
 */

  /* 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._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;
}

/* "src/lxml/readonlytree.pxi":269
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         return f'&{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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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__", 1);

  /* "src/lxml/readonlytree.pxi":271
 *     @property
 *     def text(self):
 *         return f'&{funicode(self._c_node.name)};'             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__34);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__34);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__34);
  __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__35);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__35);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__35);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":269
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def text(self):
 *         return f'&{funicode(self._c_node.name)};'
 */

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

/* "src/lxml/readonlytree.pxi":278
 *     """The main read-only Element proxy class (for internal use only!)."""
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         self._assertNode()
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":280
 *     @property
 *     def attrib(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 == ((int)-1))) __PYX_ERR(8, 280, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":281
 *     def attrib(self):
 *         self._assertNode()
 *         return dict(_collectAttributes(self._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(8, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 281, __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;

  /* "src/lxml/readonlytree.pxi":278
 *     """The main read-only Element proxy class (for internal use only!)."""
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrib(self):
 *         self._assertNode()
 */

  /* 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;
}

/* "src/lxml/readonlytree.pxi":283
 *         return dict(_collectAttributes(self._c_node, 3))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":287
 *         """Namespace prefix or None.
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 287, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":288
 *         """
 *         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);
  if (__pyx_t_2) {

    /* "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);
    if (__pyx_t_2) {

      /* "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_ERR(8, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "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
 */
    }

    /* "src/lxml/readonlytree.pxi":288
 *         """
 *         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)
 */
  }

  /* "src/lxml/readonlytree.pxi":291
 *             if self._c_node.ns.prefix is not NULL:
 *                 return funicode(self._c_node.ns.prefix)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":283
 *         return dict(_collectAttributes(self._c_node, 3))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *         """Namespace prefix or None.
 */

  /* 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;
}

/* "src/lxml/readonlytree.pxi":293
 *         return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap___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_5nsmap___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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/readonlytree.pxi":301
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _build_nsmap(self._c_node)
 * 
 */
  __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 == ((int)-1))) __PYX_ERR(8, 301, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":302
 *         """
 *         self._assertNode()
 *         return _build_nsmap(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__build_nsmap(__pyx_v_self->__pyx_base._c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":293
 *         return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nsmap(self):
 *         """Namespace prefix->URI mapping known in the context of this
 */

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

/* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get, "Gets an element attribute.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_1get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 304, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 304, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(8, 304, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(8, 304, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/readonlytree.pxi":307
 *         """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 == ((int)-1))) __PYX_ERR(8, 307, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":308
 *         """
 *         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_ERR(8, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_3keys = {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) return NULL;
  __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", 1);

  /* "src/lxml/readonlytree.pxi":314
 *         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 == ((int)-1))) __PYX_ERR(8, 314, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":315
 *         """
 *         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_ERR(8, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values, "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_5values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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", 1);

  /* "src/lxml/readonlytree.pxi":321
 *         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 == ((int)-1))) __PYX_ERR(8, 321, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":322
 *         """
 *         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_ERR(8, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items, "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_7items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items};
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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", 1);

  /* "src/lxml/readonlytree.pxi":328
 *         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 == ((int)-1))) __PYX_ERR(8, 328, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":329
 *         """
 *         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_ERR(8, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":331
 *         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", 1);

  /* "src/lxml/readonlytree.pxi":334
 *     _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:
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":335
 *     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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 335, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(8, 335, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":334
 *     _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:
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":337
 *         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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 337, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(8, 337, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":336
 *     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,
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":338
 *     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_ENTITY_REF_NODE:

    /* "src/lxml/readonlytree.pxi":340
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 */
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 340, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":338
 *     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)
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":342
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_1 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unsupported_element_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 342, __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_ERR(8, 342, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":343
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":344
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":345
 *     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;

  /* "src/lxml/readonlytree.pxi":331
 *         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;
}

/* "src/lxml/readonlytree.pxi":347
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initReadOnlyProxy", 1);

  /* "src/lxml/readonlytree.pxi":349
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":350
 *                                _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((PyObject *)__pyx_v_el->_source_proxy);
    __Pyx_DECREF((PyObject *)__pyx_v_el->_source_proxy);
    __pyx_v_el->_source_proxy = __pyx_v_el;

    /* "src/lxml/readonlytree.pxi":351
 *     if source_proxy is None:
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]             # <<<<<<<<<<<<<<
 *     else:
 *         el._source_proxy = source_proxy
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF((PyObject *)__pyx_v_el);
    __Pyx_GIVEREF((PyObject *)__pyx_v_el);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_el))) __PYX_ERR(8, 351, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_el->_dependent_proxies);
    __Pyx_DECREF(__pyx_v_el->_dependent_proxies);
    __pyx_v_el->_dependent_proxies = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/readonlytree.pxi":349
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:             # <<<<<<<<<<<<<<
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":353
 *         el._dependent_proxies = [el]
 *     else:
 *         el._source_proxy = source_proxy             # <<<<<<<<<<<<<<
 *         source_proxy._dependent_proxies.append(el)
 * 
 */
  /*else*/ {
    __Pyx_INCREF((PyObject *)__pyx_v_source_proxy);
    __Pyx_GIVEREF((PyObject *)__pyx_v_source_proxy);
    __Pyx_GOTREF((PyObject *)__pyx_v_el->_source_proxy);
    __Pyx_DECREF((PyObject *)__pyx_v_el->_source_proxy);
    __pyx_v_el->_source_proxy = __pyx_v_source_proxy;

    /* "src/lxml/readonlytree.pxi":354
 *     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 '%.30s'", "append");
      __PYX_ERR(8, 354, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_source_proxy->_dependent_proxies, ((PyObject *)__pyx_v_el)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(8, 354, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":347
 *     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_2);
  __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;
}

/* "src/lxml/readonlytree.pxi":356
 *         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;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlNode *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_freeReadOnlyProxies", 1);

  /* "src/lxml/readonlytree.pxi":359
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":360
 *     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;

    /* "src/lxml/readonlytree.pxi":359
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:             # <<<<<<<<<<<<<<
 *         return
 *     if sourceProxy._dependent_proxies is None:
 */
  }

  /* "src/lxml/readonlytree.pxi":361
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
 */
  __pyx_t_1 = (__pyx_v_sourceProxy->_dependent_proxies == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":362
 *         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;

    /* "src/lxml/readonlytree.pxi":361
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
 */
  }

  /* "src/lxml/readonlytree.pxi":363
 *     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_ERR(8, 363, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_sourceProxy->_dependent_proxies; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 363, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(8, 363, __pyx_L1_error)
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ReadOnlyProxy))))) __PYX_ERR(8, 363, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_el, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "src/lxml/readonlytree.pxi":364
 *         return
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node             # <<<<<<<<<<<<<<
 *         el._c_node = NULL
 *         if el._free_after_use:
 */
    __pyx_t_5 = __pyx_v_el->_c_node;
    __pyx_v_c_node = __pyx_t_5;

    /* "src/lxml/readonlytree.pxi":365
 *     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;

    /* "src/lxml/readonlytree.pxi":366
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
 */
    if (__pyx_v_el->_free_after_use) {

      /* "src/lxml/readonlytree.pxi":367
 *         el._c_node = NULL
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *     del sourceProxy._dependent_proxies[:]
 * 
 */
      xmlFreeNode(__pyx_v_c_node);

      /* "src/lxml/readonlytree.pxi":366
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
 */
    }

    /* "src/lxml/readonlytree.pxi":363
 *     if sourceProxy._dependent_proxies is None:
 *         return
 *     for el in sourceProxy._dependent_proxies:             # <<<<<<<<<<<<<<
 *         c_node = el._c_node
 *         el._c_node = NULL
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":368
 *         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_ERR(8, 368, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_sourceProxy->_dependent_proxies, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(8, 368, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":356
 *         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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/readonlytree.pxi":378
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":379
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 *         raise TypeError, "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_ERR(8, 379, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":378
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, "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;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":384
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/readonlytree.pxi":387
 *         """This is our way of saying: this proxy is invalid!
 *         """
 *         assert self._c_node is not NULL, "Proxy invalidated!"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Proxy_invalidated, 0, 0);
      __PYX_ERR(8, 387, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(8, 387, __pyx_L1_error)
  #endif

  /* "src/lxml/readonlytree.pxi":388
 *         """
 *         assert self._c_node is not NULL, "Proxy invalidated!"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, other_element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":384
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         """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:;
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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", 1);

  /* "src/lxml/readonlytree.pxi":395
 *         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 == ((int)-1))) __PYX_ERR(8, 395, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":396
 *         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 == ((xmlNode *)NULL))) __PYX_ERR(8, 396, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":397
 *         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, "cannot append, document already has a root element"
 */
  __pyx_t_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_3) {

    /* "src/lxml/readonlytree.pxi":398
 *         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, "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);
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/readonlytree.pxi":399
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"             # <<<<<<<<<<<<<<
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_cannot_append_document_already_h, 0, 0);
      __PYX_ERR(8, 399, __pyx_L1_error)

      /* "src/lxml/readonlytree.pxi":398
 *         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, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 */
    }

    /* "src/lxml/readonlytree.pxi":397
 *         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, "cannot append, document already has a root element"
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":400
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, f"unsupported element type for top-level node: {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;
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/readonlytree.pxi":401
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 */
    __pyx_t_5 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_unsupported_element_type_for_top, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 401, __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_ERR(8, 401, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":400
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, "cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, f"unsupported element type for top-level node: {c_node.type}"
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 */
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":402
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, f"unsupported element type for top-level node: {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 == ((xmlNode *)NULL))) __PYX_ERR(8, 402, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":403
 *             raise TypeError, f"unsupported element type for top-level node: {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;

  /* "src/lxml/readonlytree.pxi":404
 *         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)
 * 
 */
  (void)(xmlAddChild(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_node));

  /* "src/lxml/readonlytree.pxi":405
 *         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);

  /* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append, "Append a copy of an Element to the list of children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_1append = {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append};
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_other_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_other_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 390, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "append") < 0)) __PYX_ERR(8, 390, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_other_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 390, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_other_element);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __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_ERR(8, 390, __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;
}

/* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend, "Append a copy of all Elements from a sequence to the list of\n        children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_3extend = {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend};
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elements,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_elements)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 407, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "extend") < 0)) __PYX_ERR(8, 407, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 407, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/readonlytree.pxi":411
 *         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 == ((int)-1))) __PYX_ERR(8, 411, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":412
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (likely(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_ERR(8, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 412, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 412, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(8, 412, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 412, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 412, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(8, 412, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 412, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(8, 412, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":413
 *         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_ERR(8, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":412
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":415
 *             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", 1);

  /* "src/lxml/readonlytree.pxi":417
 * 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:

    /* "src/lxml/readonlytree.pxi":418
 *     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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(((PyTypeObject *)__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 418, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)))) __PYX_ERR(8, 418, __pyx_L1_error)
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":417
 * 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:
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":420
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)             # <<<<<<<<<<<<<<
 *     node._c_node = c_node
 *     return node
 */
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(((PyTypeObject *)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 420, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
  }

  /* "src/lxml/readonlytree.pxi":421
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 *     node._c_node = c_node             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_v_node->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":422
 *         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;

  /* "src/lxml/readonlytree.pxi":415
 *             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;
}

/* "src/lxml/readonlytree.pxi":431
 *     """
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":432
 *     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 == ((int)-1))) __PYX_ERR(8, 432, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":433
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":434
 *             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_u__12);
    __pyx_r = __pyx_kp_u__12;
    goto __pyx_L0;

    /* "src/lxml/readonlytree.pxi":433
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  }

  /* "src/lxml/readonlytree.pxi":436
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  /*else*/ {
    __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_ERR(8, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/readonlytree.pxi":431
 *     """
 *     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;
}

/* "src/lxml/readonlytree.pxi":438
 *                 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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_value);

  /* "src/lxml/readonlytree.pxi":440
 *         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 == ((int)-1))) __PYX_ERR(8, 440, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":441
 *             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);
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":442
 *             self._assertNode()
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = ((const xmlChar *)NULL);

    /* "src/lxml/readonlytree.pxi":441
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":444
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/readonlytree.pxi":445
 *             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:;

  /* "src/lxml/readonlytree.pxi":446
 *                 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);

  /* "src/lxml/readonlytree.pxi":438
 *                 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_3);
  __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;
}

/* "src/lxml/readonlytree.pxi":455
 *     """
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":456
 *     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 == ((int)-1))) __PYX_ERR(8, 456, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":457
 *         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_ERR(8, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":455
 *     """
 *     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;
}

/* "src/lxml/readonlytree.pxi":459
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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);

  /* "src/lxml/readonlytree.pxi":460
 * 
 *         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 == ((int)-1))) __PYX_ERR(8, 460, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":461
 *         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_ERR(8, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":462
 *             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);

  /* "src/lxml/readonlytree.pxi":463
 *             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);

  /* "src/lxml/readonlytree.pxi":459
 *             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;
}

/* "src/lxml/readonlytree.pxi":470
 *     "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":471
 *     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_ERR(8, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":470
 *     "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;
}

/* "src/lxml/readonlytree.pxi":473
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert '&' not in value and ';' 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __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);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":474
 * 
 *         def __set__(self, value):
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":475
 *         def __set__(self, value):
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \             # <<<<<<<<<<<<<<
 *                 f"Invalid entity name '{value}'"
 *             c_text = _xcstr(value)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__34, __pyx_v_value, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 475, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__35, __pyx_v_value, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(8, 475, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {

      /* "src/lxml/readonlytree.pxi":476
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_entity_name);
      __pyx_t_4 += 21;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_entity_name);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_entity_name);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_4 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(8, 475, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(8, 475, __pyx_L1_error)
  #endif

  /* "src/lxml/readonlytree.pxi":477
 *             assert '&' not in value and ';' not in value, \
 *                 f"Invalid entity name '{value}'"
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":478
 *                 f"Invalid entity name '{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);

  /* "src/lxml/readonlytree.pxi":473
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert '&' not in value and ';' not in value, \
 */

  /* 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._ModifyContentOnlyEntityProxy.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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", 1);

  /* "src/lxml/readonlytree.pxi":492
 *         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 == ((int)-1))) __PYX_ERR(8, 492, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":493
 *         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 == ((xmlNode *)NULL))) __PYX_ERR(8, 493, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":494
 *         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 == ((xmlNode *)NULL))) __PYX_ERR(8, 494, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/readonlytree.pxi":495
 *         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;

  /* "src/lxml/readonlytree.pxi":496
 *         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)
 * 
 */
  (void)(xmlAddChild(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_node));

  /* "src/lxml/readonlytree.pxi":497
 *         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);

  /* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append, "Append a copy of an Element to the list of children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_1append = {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append};
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_other_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_other_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 487, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "append") < 0)) __PYX_ERR(8, 487, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_other_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 487, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_other_element);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __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_ERR(8, 487, __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;
}

/* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend, "Append a copy of all Elements from a sequence to the list of\n        children.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_3extend = {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend};
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_elements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elements,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_elements)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(8, 499, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "extend") < 0)) __PYX_ERR(8, 499, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_elements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 499, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_elements);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/readonlytree.pxi":503
 *         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 == ((int)-1))) __PYX_ERR(8, 503, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":504
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (likely(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_ERR(8, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 504, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 504, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(8, 504, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 504, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(8, 504, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(8, 504, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 504, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(8, 504, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":505
 *         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_ERR(8, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/readonlytree.pxi":504
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/readonlytree.pxi":511
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/readonlytree.pxi":512
 *         """
 *         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 == ((int)-1))) __PYX_ERR(8, 512, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":513
 *         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_ERR(8, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":511
 *         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;
}

/* "src/lxml/readonlytree.pxi":515
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/readonlytree.pxi":516
 * 
 *         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 == ((int)-1))) __PYX_ERR(8, 516, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":517
 *         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, __pyx_ptype_4lxml_5etree_QName); 
  if (__pyx_t_2) {

    /* "src/lxml/readonlytree.pxi":518
 *             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_ERR(8, 518, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(8, 518, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_decode_bytes(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/readonlytree.pxi":517
 *         def __set__(self, value):
 *             self._assertNode()
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
 */
  }

  /* "src/lxml/readonlytree.pxi":519
 *             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 == ((int)-1))) __PYX_ERR(8, 519, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":515
 *             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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/readonlytree.pxi":522
 * 
 * 
 * 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", 1);

  /* "src/lxml/readonlytree.pxi":525
 *     _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:
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/readonlytree.pxi":526
 *     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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 526, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(8, 526, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":525
 *     _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:
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/readonlytree.pxi":528
 *         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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 528, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(8, 528, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":527
 *     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:
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/readonlytree.pxi":530
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 */
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 530, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_1), __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) __PYX_ERR(8, 530, __pyx_L1_error)
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/readonlytree.pxi":529
 *     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:
 */
    break;
    default:

    /* "src/lxml/readonlytree.pxi":532
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_1 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unsupported_element_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 532, __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_ERR(8, 532, __pyx_L1_error)
    break;
  }

  /* "src/lxml/readonlytree.pxi":533
 *     else:
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "src/lxml/readonlytree.pxi":534
 *         raise TypeError(f"Unsupported element type: {c_node.type}")
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/readonlytree.pxi":535
 *     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;

  /* "src/lxml/readonlytree.pxi":522
 * 
 * 
 * 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;
}

/* "src/lxml/readonlytree.pxi":537
 *     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;
  xmlNode *__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("_roNodeOf", 1);

  /* "src/lxml/readonlytree.pxi":539
 * 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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":540
 *     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_2 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":539
 * cdef xmlNode* _roNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":541
 *     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_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_ptype_4lxml_5etree__ReadOnlyProxy); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":542
 *         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_2 = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":541
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":543
 *     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, __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":544
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":543
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":546
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_invalid_argument_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 546, __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_ERR(8, 546, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":548
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":549
 * 
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_invalid_element, 0, 0);
    __PYX_ERR(8, 549, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":548
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
 */
  }

  /* "src/lxml/readonlytree.pxi":550
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":537
 *     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_3);
  __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;
}

/* "src/lxml/readonlytree.pxi":552
 *     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;
  xmlNode *__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("_nonRoNodeOf", 1);

  /* "src/lxml/readonlytree.pxi":554
 * 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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":555
 *     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_2 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":554
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":556
 *     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_1 = __Pyx_TypeCheck(__pyx_v_element, __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy); 
  if (__pyx_t_1) {

    /* "src/lxml/readonlytree.pxi":557
 *         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_2 = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_element)->__pyx_base.__pyx_base._c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":556
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":558
 *     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, __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); 
  if (likely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":559
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_2;

    /* "src/lxml/readonlytree.pxi":558
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/readonlytree.pxi":561
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, f"invalid argument type {type(element)}"             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_element)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_invalid_argument_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 561, __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_ERR(8, 561, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/readonlytree.pxi":563
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/readonlytree.pxi":564
 * 
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_invalid_element, 0, 0);
    __PYX_ERR(8, 564, __pyx_L1_error)

    /* "src/lxml/readonlytree.pxi":563
 *         raise TypeError, f"invalid argument type {type(element)}"
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, "invalid element"
 *     return c_node
 */
  }

  /* "src/lxml/readonlytree.pxi":565
 *     if c_node is NULL:
 *         raise TypeError, "invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/readonlytree.pxi":552
 *     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_3);
  __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;
}

/* "src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11ElementBase___init__, "ElementBase(*children, attrib=None, nsmap=None, **_extra)\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return -1;
  __Pyx_GOTREF(__pyx_v__extra);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_children = __pyx_args;
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 0; index < 2 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 42, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, 0, "__init__") < 0)) __PYX_ERR(9, 42, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_attrib = values[0];
    __pyx_v_nsmap = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 0, __pyx_nargs); __PYX_ERR(9, 42, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_children);
  __Pyx_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_6 = NULL;
  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;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/classlookup.pxi":45
 *         """ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 *         cdef bint is_html = 0             # <<<<<<<<<<<<<<
 *         cdef _BaseParser parser
 *         cdef _Element last_child
 */
  __pyx_v_is_html = 0;

  /* "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_ERR(9, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__getattr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "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_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/classlookup.pxi":51
 *         _getattr = object.__getattribute__
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             namespace = None
 */
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_5 = __pyx_v__getattr; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_6, ((PyObject *)__pyx_v_self), __pyx_n_u_NAMESPACE};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 51, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 51, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_namespace = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "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_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_L8_try_end;
    __pyx_L3_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;

    /* "src/lxml/classlookup.pxi":52
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             namespace = None
 *         try:
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(9, 52, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "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_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "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_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_L8_try_end:;
  }

  /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/classlookup.pxi":55
 *             namespace = None
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))             # <<<<<<<<<<<<<<
 *             if ns is not None:
 *                 namespace = ns
 */
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_1 = __pyx_v__getattr; __pyx_t_5 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_n_u_TAG};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 55, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (likely(__pyx_t_1 != Py_None)) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(9, 55, __pyx_L11_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 55, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(9, 55, __pyx_L11_error)
      }
      __pyx_v_ns = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_tag = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "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);
      if (__pyx_t_8) {

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

        /* "src/lxml/classlookup.pxi":56
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:             # <<<<<<<<<<<<<<
 *                 namespace = ns
 *         except AttributeError:
 */
      }

      /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 */
    }
    __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_L16_try_end;
    __pyx_L11_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;

    /* "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_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(9, 58, __pyx_L13_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "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_INCREF(__pyx_v__getattr);
      __pyx_t_11 = __pyx_v__getattr; __pyx_t_12 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_12, ((PyObject *)__pyx_v_self), __pyx_n_u_class};
        __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(9, 59, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_11 = __pyx_v__getattr; __pyx_t_12 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_10, __pyx_n_u_name};
        __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(9, 59, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 59, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "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_8 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__4, __pyx_v_tag, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(9, 60, __pyx_L13_except_error)
      if (__pyx_t_8) {

        /* "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_11 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyBytes_Type_split, __pyx_v_tag, __pyx_kp_b__4); if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 61, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_11, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(9, 61, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "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_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;
      goto __pyx_L12_exception_handled;
    }
    goto __pyx_L13_except_error;

    /* "src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 */
    __pyx_L13_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_L12_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_L16_try_end:;
  }

  /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/classlookup.pxi":63
 *                 tag = tag.split(b'.')[-1]
 *         try:
 *             parser = _getattr(self, 'PARSER')             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             parser = None
 */
      __Pyx_INCREF(__pyx_v__getattr);
      __pyx_t_5 = __pyx_v__getattr; __pyx_t_1 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_n_u_PARSER};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 63, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(9, 63, __pyx_L21_error)
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 */
    }
    __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_L26_try_end;
    __pyx_L21_error:;
    __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;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/classlookup.pxi":64
 *         try:
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             parser = None
 *             for child in children:
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(9, 64, __pyx_L23_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_1);

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

      /* "src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 */
      __pyx_t_9 = __pyx_v_children; __Pyx_INCREF(__pyx_t_9);
      __pyx_t_13 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 66, __pyx_L23_except_error)
          #endif
          if (__pyx_t_13 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_11); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(9, 66, __pyx_L23_except_error)
        #else
        __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 66, __pyx_L23_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "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, __pyx_ptype_4lxml_5etree__Element); 
        if (__pyx_t_8) {

          /* "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;

          /* "src/lxml/classlookup.pxi":69
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 *                     break             # <<<<<<<<<<<<<<
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 */
          goto __pyx_L30_break;

          /* "src/lxml/classlookup.pxi":67
 *             parser = None
 *             for child in children:
 *                 if isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 */
        }

        /* "src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 */
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L32_for_end;
      __pyx_L30_break:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L32_for_end;
      __pyx_L32_for_end:;
      __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;
      goto __pyx_L22_exception_handled;
    }
    goto __pyx_L23_except_error;

    /* "src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 */
    __pyx_L23_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_L22_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_L26_try_end:;
  }

  /* "src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree_HTMLParser); 
  if (__pyx_t_8) {

    /* "src/lxml/classlookup.pxi":71
 *                     break
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1             # <<<<<<<<<<<<<<
 *         if namespace is None:
 *             try:
 */
    __pyx_v_is_html = 1;

    /* "src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
 */
  }

  /* "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);
  if (__pyx_t_8) {

    /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/classlookup.pxi":74
 *         if namespace is None:
 *             try:
 *                 is_html = _getattr(self, 'HTML')             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 pass
 */
        __Pyx_INCREF(__pyx_v__getattr);
        __pyx_t_5 = __pyx_v__getattr; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_6, ((PyObject *)__pyx_v_self), __pyx_n_u_HTML};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 74, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(9, 74, __pyx_L35_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_is_html = __pyx_t_8;

        /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
 */
      }
      __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_L40_try_end;
      __pyx_L35_error:;
      __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;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/classlookup.pxi":75
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_7) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L36_exception_handled;
      }
      goto __pyx_L37_except_error;

      /* "src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
 */
      __pyx_L37_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_L36_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_L40_try_end:;
    }

    /* "src/lxml/classlookup.pxi":72
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 *         if namespace is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 */
  }

  /* "src/lxml/classlookup.pxi":77
 *             except AttributeError:
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,             # <<<<<<<<<<<<<<
 *                         attrib, nsmap, _extra)
 *         last_child = None
 */
  __pyx_t_7 = __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_7 == ((int)-1))) __PYX_ERR(9, 77, __pyx_L1_error)

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

  /* "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_1 = __pyx_v_children; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_13 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 80, __pyx_L1_error)
      #endif
      if (__pyx_t_13 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(9, 80, __pyx_L1_error)
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "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_8 = _isString(__pyx_v_child);
    if (__pyx_t_8) {

      /* "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_8 = (((PyObject *)__pyx_v_last_child) == Py_None);
      if (__pyx_t_8) {

        /* "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_6 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->__pyx_base._c_node->children); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(9, 84, __pyx_L1_error)
        if (!__pyx_t_8) {
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_5 = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L45_bool_binop_done;
        }
        __Pyx_INCREF(__pyx_kp_u__12);
        __pyx_t_5 = __pyx_kp_u__12;
        __pyx_L45_bool_binop_done:;
        __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_child); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "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_7 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->__pyx_base._c_node, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 83, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "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)
 */
        goto __pyx_L44;
      }

      /* "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):
 */
      /*else*/ {

        /* "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_5 = __pyx_f_4lxml_5etree__collectText(__pyx_v_last_child->_c_node->next); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(9, 87, __pyx_L1_error)
        if (!__pyx_t_8) {
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = __pyx_t_5;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L47_bool_binop_done;
        }
        __Pyx_INCREF(__pyx_kp_u__12);
        __pyx_t_6 = __pyx_kp_u__12;
        __pyx_L47_bool_binop_done:;
        __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_child); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "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_7 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_last_child->_c_node, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 86, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_L44:;

      /* "src/lxml/classlookup.pxi":81
 *         last_child = None
 *         for child in children:
 *             if _isString(child):             # <<<<<<<<<<<<<<
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
 */
      goto __pyx_L43;
    }

    /* "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, __pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_8) {

      /* "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_ERR(9, 89, __pyx_L1_error)
      __pyx_t_5 = __pyx_v_child;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "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_7 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 90, __pyx_L1_error)

      /* "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)
 */
      goto __pyx_L43;
    }

    /* "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_14 = PyType_Check(__pyx_v_child); 
    if (__pyx_t_14) {
    } else {
      __pyx_t_8 = __pyx_t_14;
      goto __pyx_L49_bool_binop_done;
    }
    __pyx_t_14 = PyObject_IsSubclass(__pyx_v_child, ((PyObject *)__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(9, 91, __pyx_L1_error)
    __pyx_t_8 = __pyx_t_14;
    __pyx_L49_bool_binop_done:;
    if (likely(__pyx_t_8)) {

      /* "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_INCREF(__pyx_v_child);
      __pyx_t_6 = __pyx_v_child; __pyx_t_9 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(9, 92, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "src/lxml/classlookup.pxi":93
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(9, 93, __pyx_L1_error)

      /* "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)
 */
      goto __pyx_L43;
    }

    /* "src/lxml/classlookup.pxi":95
 *                 _appendChild(self, last_child)
 *             else:
 *                 raise TypeError, f"Invalid child type: {type(child)!r}"             # <<<<<<<<<<<<<<
 * 
 * cdef class CommentBase(_Comment):
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_child))), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_child_type, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 95, __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_ERR(9, 95, __pyx_L1_error)
    }
    __pyx_L43:;

    /* "src/lxml/classlookup.pxi":80
 *                         attrib, nsmap, _extra)
 *         last_child = None
 *         for child in children:             # <<<<<<<<<<<<<<
 *             if _isString(child):
 *                 if last_child is None:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """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_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 109, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 109, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 109, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__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("__init__", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":114
 *         cdef xmlDoc*   c_doc
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__12);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__12);

    /* "src/lxml/classlookup.pxi":113
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":116
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "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_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(9, 117, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "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_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

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

  /* "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_1 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "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_ERR(9, 121, __pyx_L1_error)

    /* "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)
 */
  }

  /* "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()
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "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_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 == ((int)-1))) __PYX_ERR(9, 123, __pyx_L1_error)

  /* "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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "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_2);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_text,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 139, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 139, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 139, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(9, 139, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  xmlDoc *__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("__init__", 0);
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);

  /* "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_ERR(9, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "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);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":145
 *         target = _utf8(target)
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__12);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__12);

    /* "src/lxml/classlookup.pxi":144
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":147
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "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_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(9, 148, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "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_ERR(9, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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_2 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "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_ERR(9, 152, __pyx_L1_error)

    /* "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)
 */
  }

  /* "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()
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "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_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 == ((int)-1))) __PYX_ERR(9, 154, __pyx_L1_error)

  /* "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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_5);
  __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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 169, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 169, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 169, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  xmlDoc *__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("__init__", 1);

  /* "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_ERR(9, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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, f"Invalid character reference: '{name}'"
 */
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":175
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/classlookup.pxi":176
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"             # <<<<<<<<<<<<<<
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = 0;
      __pyx_t_4 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_character_reference);
      __pyx_t_3 += 30;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_character_reference);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_character_reference);
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
      __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_3 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(9, 176, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":175
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
 */
    }

    /* "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, f"Invalid character reference: '{name}'"
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":177
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()
 */
  __pyx_t_2 = (!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/classlookup.pxi":178
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 127;
    __Pyx_INCREF(__pyx_kp_u_Invalid_entity_reference);
    __pyx_t_3 += 27;
    __Pyx_GIVEREF(__pyx_kp_u_Invalid_entity_reference);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_entity_reference);
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_3 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__25);
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(9, 178, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":177
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, f"Invalid character reference: '{name}'"
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()
 */
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":179
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, f"Invalid entity reference: '{name}'"
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_6 == ((xmlDoc *)NULL))) __PYX_ERR(9, 179, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_6;

  /* "src/lxml/classlookup.pxi":180
 *             raise ValueError, f"Invalid entity reference: '{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_ERR(9, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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);
  if (unlikely(__pyx_t_2)) {

    /* "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_ERR(9, 183, __pyx_L1_error)

    /* "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)
 */
  }

  /* "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()
 */
  (void)(xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node));

  /* "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_7 = __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_7 == ((int)-1))) __PYX_ERR(9, 185, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":186
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_XDECREF(__pyx_t_8);
  __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;
}

/* "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) {
  PyTypeObject *__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;
  Py_ssize_t __pyx_t_5;
  Py_UCS4 __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_validateNodeClass", 1);

  /* "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:
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "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 *)__pyx_ptype_4lxml_5etree_ElementBase);
    __pyx_v_expected = __pyx_ptype_4lxml_5etree_ElementBase;

    /* "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:
 */
    break;
    case XML_COMMENT_NODE:

    /* "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 *)__pyx_ptype_4lxml_5etree_CommentBase);
    __pyx_v_expected = __pyx_ptype_4lxml_5etree_CommentBase;

    /* "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:
 */
    break;
    case XML_ENTITY_REF_NODE:

    /* "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 *)__pyx_ptype_4lxml_5etree_EntityBase);
    __pyx_v_expected = __pyx_ptype_4lxml_5etree_EntityBase;

    /* "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:
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":197
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:
 *         expected = PIBase             # <<<<<<<<<<<<<<
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"
 */
    __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_PIBase);
    __pyx_v_expected = __pyx_ptype_4lxml_5etree_PIBase;

    /* "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:
 */
    break;
    default:

    /* "src/lxml/classlookup.pxi":199
 *         expected = PIBase
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(!0)) {
        __pyx_t_1 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_node_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(9, 199, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(9, 199, __pyx_L1_error)
    #endif
    break;
  }

  /* "src/lxml/classlookup.pxi":201
 *         assert False, f"Unknown node type: {c_node.type}"
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 */
  __pyx_t_4 = PyType_Check(__pyx_v_cls); 
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); __PYX_ERR(9, 201, __pyx_L1_error) }
  __pyx_t_4 = PyObject_IsSubclass(__pyx_v_cls, ((PyObject *)__pyx_v_expected)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(9, 201, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __pyx_t_4 = (!__pyx_t_3);
  if (unlikely(__pyx_t_4)) {

    /* "src/lxml/classlookup.pxi":203
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = 127;
    __Pyx_INCREF(__pyx_kp_u_result_of_class_lookup_must_be_s);
    __pyx_t_5 += 43;
    __Pyx_GIVEREF(__pyx_kp_u_result_of_class_lookup_must_be_s);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_result_of_class_lookup_must_be_s);
    if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); __PYX_ERR(9, 203, __pyx_L1_error) }
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_expected))), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_kp_u_got);
    __pyx_t_5 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_got);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_got);
    __pyx_t_1 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_cls)), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/classlookup.pxi":202
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 *     return 0
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 202, __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_ERR(9, 202, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":201
 *         assert False, f"Unknown node type: {c_node.type}"
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 */
  }

  /* "src/lxml/classlookup.pxi":204
 *         raise TypeError(
 *             f"result of class lookup must be subclass of {type(expected)}, got {type(cls)}")
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "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((PyObject *)__pyx_v_expected);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":230
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":232
 *     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;

  /* "src/lxml/classlookup.pxi":230
 *     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;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":234
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fallback,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fallback);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 234, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 234, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(9, 234, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(9, 234, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/classlookup.pxi":235
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_fallback) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":236
 *     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); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 236, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":235
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":238
 *             self._setFallback(fallback)
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):
 */
  /*else*/ {
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":234
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
 */

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

/* "src/lxml/classlookup.pxi":240
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         """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", 1);

  /* "src/lxml/classlookup.pxi":243
 *         """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((PyObject *)__pyx_v_self->fallback);
  __Pyx_DECREF((PyObject *)__pyx_v_self->fallback);
  __pyx_v_self->fallback = __pyx_v_lookup;

  /* "src/lxml/classlookup.pxi":244
 *         """
 *         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;

  /* "src/lxml/classlookup.pxi":245
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":246
 *         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;

    /* "src/lxml/classlookup.pxi":245
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:             # <<<<<<<<<<<<<<
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 */
  }

  /* "src/lxml/classlookup.pxi":240
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         """Sets the fallback scheme for this lookup method.
 *         """
 */

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

/* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback, "set_fallback(self, lookup)\n\n        Sets the fallback scheme for this lookup method.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_26FallbackElementClassLookup_5set_fallback = {"set_fallback", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback};
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_fallback (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lookup)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 248, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_fallback") < 0)) __PYX_ERR(9, 248, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_fallback", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 248, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.set_fallback", __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, 0, "lookup", 0))) __PYX_ERR(9, 248, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_fallback", 1);

  /* "src/lxml/classlookup.pxi":253
 *         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); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 253, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.set_fallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":228
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/classlookup.pxi":255
 *         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", 1);

  /* "src/lxml/classlookup.pxi":257
 * 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_ERR(9, 257, __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;

  /* "src/lxml/classlookup.pxi":255
 *         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;
}

/* "src/lxml/classlookup.pxi":275
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":276
 *     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;

  /* "src/lxml/classlookup.pxi":275
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":278
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_comment,&__pyx_n_s_pi,&__pyx_n_s_entity,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pi);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_entity);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 278, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 278, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, __pyx_nargs); __PYX_ERR(9, 278, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/classlookup.pxi":279
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":280
 *     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 *)__pyx_ptype_4lxml_5etree__Element);
    __Pyx_GIVEREF((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 *)__pyx_ptype_4lxml_5etree__Element);

    /* "src/lxml/classlookup.pxi":279
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:             # <<<<<<<<<<<<<<
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":281
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_element, ((PyObject *)__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 281, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":282
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "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;

    /* "src/lxml/classlookup.pxi":281
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":284
 *             self.element_class = element
 *         else:
 *             raise TypeError, "element class must be subclass of ElementBase"             # <<<<<<<<<<<<<<
 * 
 *         if comment is None:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_element_class_must_be_subclass_o, 0, 0);
    __PYX_ERR(9, 284, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":286
 *             raise TypeError, "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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":287
 * 
 *         if comment is None:
 *             self.comment_class = _Comment             # <<<<<<<<<<<<<<
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment
 */
    __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree__Comment);
    __Pyx_GIVEREF((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 *)__pyx_ptype_4lxml_5etree__Comment);

    /* "src/lxml/classlookup.pxi":286
 *             raise TypeError, "element class must be subclass of ElementBase"
 * 
 *         if comment is None:             # <<<<<<<<<<<<<<
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 */
    goto __pyx_L4;
  }

  /* "src/lxml/classlookup.pxi":288
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_comment, ((PyObject *)__pyx_ptype_4lxml_5etree_CommentBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 288, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":289
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "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;

    /* "src/lxml/classlookup.pxi":288
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/classlookup.pxi":291
 *             self.comment_class = comment
 *         else:
 *             raise TypeError, "comment class must be subclass of CommentBase"             # <<<<<<<<<<<<<<
 * 
 *         if entity is None:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_comment_class_must_be_subclass_o, 0, 0);
    __PYX_ERR(9, 291, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "src/lxml/classlookup.pxi":293
 *             raise TypeError, "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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":294
 * 
 *         if entity is None:
 *             self.entity_class = _Entity             # <<<<<<<<<<<<<<
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity
 */
    __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree__Entity);
    __Pyx_GIVEREF((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 *)__pyx_ptype_4lxml_5etree__Entity);

    /* "src/lxml/classlookup.pxi":293
 *             raise TypeError, "comment class must be subclass of CommentBase"
 * 
 *         if entity is None:             # <<<<<<<<<<<<<<
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 */
    goto __pyx_L5;
  }

  /* "src/lxml/classlookup.pxi":295
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_entity, ((PyObject *)__pyx_ptype_4lxml_5etree_EntityBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 295, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":296
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "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;

    /* "src/lxml/classlookup.pxi":295
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/classlookup.pxi":298
 *             self.entity_class = entity
 *         else:
 *             raise TypeError, "Entity class must be subclass of EntityBase"             # <<<<<<<<<<<<<<
 * 
 *         if pi is None:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Entity_class_must_be_subclass_of, 0, 0);
    __PYX_ERR(9, 298, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "src/lxml/classlookup.pxi":300
 *             raise TypeError, "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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":301
 * 
 *         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;

    /* "src/lxml/classlookup.pxi":300
 *             raise TypeError, "Entity class must be subclass of EntityBase"
 * 
 *         if pi is None:             # <<<<<<<<<<<<<<
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 */
    goto __pyx_L6;
  }

  /* "src/lxml/classlookup.pxi":302
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_pi, ((PyObject *)__pyx_ptype_4lxml_5etree_PIBase)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 302, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "src/lxml/classlookup.pxi":303
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "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;

    /* "src/lxml/classlookup.pxi":302
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/classlookup.pxi":305
 *             self.pi_class = pi
 *         else:
 *             raise TypeError, "PI class must be subclass of PIBase"             # <<<<<<<<<<<<<<
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_PI_class_must_be_subclass_of_PIB, 0, 0);
    __PYX_ERR(9, 305, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "src/lxml/classlookup.pxi":278
 *         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;
}

/* "src/lxml/classlookup.pxi":271
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/classlookup.pxi":272
 *     """
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/classlookup.pxi":273
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/classlookup.pxi":274
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/classlookup.pxi":307
 *             raise TypeError, "PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     "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;
  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("_lookupDefaultElementClass", 1);

  /* "src/lxml/classlookup.pxi":309
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     "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
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/classlookup.pxi":310
 *     "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);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":311
 *     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;

      /* "src/lxml/classlookup.pxi":310
 *     "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:
 */
    }

    /* "src/lxml/classlookup.pxi":313
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 *             return _Element             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree__Element);
      __pyx_r = ((PyObject *)__pyx_ptype_4lxml_5etree__Element);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":309
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     "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
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/classlookup.pxi":315
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":316
 *     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;

      /* "src/lxml/classlookup.pxi":315
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 */
    }

    /* "src/lxml/classlookup.pxi":318
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 *             return _Comment             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree__Comment);
      __pyx_r = ((PyObject *)__pyx_ptype_4lxml_5etree__Comment);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":314
 *         else:
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class
 */
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/classlookup.pxi":320
 *             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);
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":321
 *     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;

      /* "src/lxml/classlookup.pxi":320
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 */
    }

    /* "src/lxml/classlookup.pxi":323
 *             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:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree__Entity);
      __pyx_r = ((PyObject *)__pyx_ptype_4lxml_5etree__Entity);
      goto __pyx_L0;
    }

    /* "src/lxml/classlookup.pxi":319
 *         else:
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":325
 *             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) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class == Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/classlookup.pxi":327
 *         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_2 = (__pyx_v_c_node->name != NULL);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_c_node->content != NULL);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/classlookup.pxi":328
 *             # 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 *)((char const *)"xml-stylesheet")))) == 0);
        if (__pyx_t_1) {

          /* "src/lxml/classlookup.pxi":329
 *             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_2 = (xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)((char const *)"text/xsl")))) != NULL);
          if (!__pyx_t_2) {
          } else {
            __pyx_t_1 = __pyx_t_2;
            goto __pyx_L14_bool_binop_done;
          }

          /* "src/lxml/classlookup.pxi":330
 *                 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_2 = (xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)((char const *)"text/xml")))) != NULL);
          __pyx_t_1 = __pyx_t_2;
          __pyx_L14_bool_binop_done:;

          /* "src/lxml/classlookup.pxi":329
 *             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
 */
          if (__pyx_t_1) {

            /* "src/lxml/classlookup.pxi":331
 *                     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 *)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
            __pyx_r = ((PyObject *)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);
            goto __pyx_L0;

            /* "src/lxml/classlookup.pxi":329
 *             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
 */
          }

          /* "src/lxml/classlookup.pxi":328
 *             # 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:
 */
        }

        /* "src/lxml/classlookup.pxi":327
 *         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 \
 */
      }

      /* "src/lxml/classlookup.pxi":332
 *                            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 *)__pyx_ptype_4lxml_5etree__ProcessingInstruction);
      __pyx_r = ((PyObject *)__pyx_ptype_4lxml_5etree__ProcessingInstruction);
      goto __pyx_L0;

      /* "src/lxml/classlookup.pxi":325
 *             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:
 */
    }

    /* "src/lxml/classlookup.pxi":334
 *             return _ProcessingInstruction
 *         else:
 *             return (<ElementDefaultClassLookup>state).pi_class             # <<<<<<<<<<<<<<
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"
 */
    /*else*/ {
      __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;
    }

    /* "src/lxml/classlookup.pxi":324
 *         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
 */
    break;
    default:

    /* "src/lxml/classlookup.pxi":336
 *             return (<ElementDefaultClassLookup>state).pi_class
 *     else:
 *         assert False, f"Unknown node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(!0)) {
        __pyx_t_3 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_node_type, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_4, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(9, 336, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(9, 336, __pyx_L1_error)
    #endif
    break;
  }

  /* "src/lxml/classlookup.pxi":307
 *             raise TypeError, "PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     "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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/classlookup.pxi":359
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":360
 *     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;

  /* "src/lxml/classlookup.pxi":359
 *     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;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":362
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attribute_name,&__pyx_n_s_class_mapping,&__pyx_n_s_fallback,0};

    /* "src/lxml/classlookup.pxi":363
 * 
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 */
    values[2] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attribute_name)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 362, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_class_mapping)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 362, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); __PYX_ERR(9, 362, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fallback);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 362, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(9, 362, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, __pyx_nargs); __PYX_ERR(9, 362, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(9, 363, __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);

  /* "src/lxml/classlookup.pxi":362
 *         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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/classlookup.pxi":364
 *     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_ERR(9, 364, __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;

  /* "src/lxml/classlookup.pxi":365
 *                  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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(9, 365, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(9, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(9, 365, __pyx_L1_error)
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/classlookup.pxi":366
 *         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);
  if (__pyx_t_4) {

    /* "src/lxml/classlookup.pxi":367
 *         ns, name = self._pytag
 *         if ns is None:
 *             self._c_ns = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._c_ns = _xcstr(ns)
 */
    __pyx_v_self->_c_ns = NULL;

    /* "src/lxml/classlookup.pxi":366
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             self._c_ns = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":369
 *             self._c_ns = NULL
 *         else:
 *             self._c_ns = _xcstr(ns)             # <<<<<<<<<<<<<<
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)
 */
  /*else*/ {
    __pyx_v_self->_c_ns = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":370
 *         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);

  /* "src/lxml/classlookup.pxi":371
 *             self._c_ns = _xcstr(ns)
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)             # <<<<<<<<<<<<<<
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_class_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_class_mapping);
  __Pyx_DECREF(__pyx_v_self->_class_mapping);
  __pyx_v_self->_class_mapping = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":373
 *         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 *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_fallback)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 373, __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;

  /* "src/lxml/classlookup.pxi":362
 *         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;
}

/* "src/lxml/classlookup.pxi":375
 *         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", 1);

  /* "src/lxml/classlookup.pxi":379
 *     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;

  /* "src/lxml/classlookup.pxi":380
 * 
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":381
 *     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_ERR(9, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/classlookup.pxi":383
 *         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;

    /* "src/lxml/classlookup.pxi":384
 *             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);
    if (__pyx_t_2) {

      /* "src/lxml/classlookup.pxi":385
 *         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;

      /* "src/lxml/classlookup.pxi":386
 *         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 == ((int)-1))) __PYX_ERR(9, 386, __pyx_L1_error)

      /* "src/lxml/classlookup.pxi":387
 *             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;

      /* "src/lxml/classlookup.pxi":384
 *             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)
 */
    }

    /* "src/lxml/classlookup.pxi":380
 * 
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 */
  }

  /* "src/lxml/classlookup.pxi":388
 *             _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_ERR(9, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":375
 *         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;
}

/* "src/lxml/classlookup.pxi":398
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":399
 *     """
 *     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;

  /* "src/lxml/classlookup.pxi":398
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":401
 *         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;
  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("_parser_class_lookup", 1);

  /* "src/lxml/classlookup.pxi":402
 * 
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":403
 * 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);

    /* "src/lxml/classlookup.pxi":404
 *     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_2 = ((PyObject *)__pyx_v_doc->_parser->_class_lookup);
    __Pyx_INCREF(__pyx_t_2);

    /* "src/lxml/classlookup.pxi":403
 * 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_3 = __pyx_v_doc->_parser->_class_lookup->_lookup_function(__pyx_t_2, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 403, __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;

    /* "src/lxml/classlookup.pxi":402
 * 
 * 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)
 */
  }

  /* "src/lxml/classlookup.pxi":405
 *         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_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_state), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":401
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/classlookup.pxi":427
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":428
 *     """
 *     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;

  /* "src/lxml/classlookup.pxi":427
 *     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;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup, "lookup(self, type, doc, namespace, name)");
static PyMethodDef __pyx_mdef_4lxml_5etree_24CustomElementClassLookup_3lookup = {"lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup};
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_doc_2,&__pyx_n_s_namespace,&__pyx_n_s_name_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 430, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doc_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 430, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); __PYX_ERR(9, 430, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespace)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 430, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); __PYX_ERR(9, 430, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 430, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); __PYX_ERR(9, 430, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "lookup") < 0)) __PYX_ERR(9, 430, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, __pyx_nargs); __PYX_ERR(9, 430, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/classlookup.pxi":432
 *     def lookup(self, type, doc, namespace, name):
 *         "lookup(self, type, doc, namespace, name)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
 */

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

/* "src/lxml/classlookup.pxi":434
 *         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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_custom_class_lookup", 1);

  /* "src/lxml/classlookup.pxi":437
 *     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;

  /* "src/lxml/classlookup.pxi":439
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
  switch (__pyx_v_c_node->type) {
    case XML_ELEMENT_NODE:

    /* "src/lxml/classlookup.pxi":440
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = "element"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"
 */
    __Pyx_INCREF(__pyx_n_u_element);
    __pyx_v_element_type = __pyx_n_u_element;

    /* "src/lxml/classlookup.pxi":439
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
    break;
    case XML_COMMENT_NODE:

    /* "src/lxml/classlookup.pxi":442
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"
 */
    __Pyx_INCREF(__pyx_n_u_comment);
    __pyx_v_element_type = __pyx_n_u_comment;

    /* "src/lxml/classlookup.pxi":441
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = "element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 */
    break;
    case XML_PI_NODE:

    /* "src/lxml/classlookup.pxi":444
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = "entity"
 */
    __Pyx_INCREF(__pyx_n_u_PI);
    __pyx_v_element_type = __pyx_n_u_PI;

    /* "src/lxml/classlookup.pxi":443
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = "comment"
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 */
    break;
    case XML_ENTITY_REF_NODE:

    /* "src/lxml/classlookup.pxi":446
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = "entity"             # <<<<<<<<<<<<<<
 *     else:
 *         element_type = "element"
 */
    __Pyx_INCREF(__pyx_n_u_entity);
    __pyx_v_element_type = __pyx_n_u_entity;

    /* "src/lxml/classlookup.pxi":445
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = "PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         element_type = "entity"
 *     else:
 */
    break;
    default:

    /* "src/lxml/classlookup.pxi":448
 *         element_type = "entity"
 *     else:
 *         element_type = "element"             # <<<<<<<<<<<<<<
 *     if c_node.name is NULL:
 *         name = None
 */
    __Pyx_INCREF(__pyx_n_u_element);
    __pyx_v_element_type = __pyx_n_u_element;
    break;
  }

  /* "src/lxml/classlookup.pxi":449
 *     else:
 *         element_type = "element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
 */
  __pyx_t_2 = (__pyx_v_c_node->name == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":450
 *         element_type = "element"
 *     if c_node.name is NULL:
 *         name = None             # <<<<<<<<<<<<<<
 *     else:
 *         name = funicode(c_node.name)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_name = ((PyObject*)Py_None);

    /* "src/lxml/classlookup.pxi":449
 *     else:
 *         element_type = "element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":452
 *         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
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_name = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":453
 *     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);

  /* "src/lxml/classlookup.pxi":454
 *         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)
 */
  __pyx_t_2 = (__pyx_v_c_str != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 454, __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;

  /* "src/lxml/classlookup.pxi":456
 *     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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lookup), __pyx_n_s_lookup); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_v_element_type, ((PyObject *)__pyx_v_doc), __pyx_v_ns, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 4+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_cls = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":457
 * 
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/classlookup.pxi":458
 *     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_5 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(9, 458, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":459
 *     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;

    /* "src/lxml/classlookup.pxi":457
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
 */
  }

  /* "src/lxml/classlookup.pxi":460
 *         _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_ERR(9, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":434
 *         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;
}

/* "src/lxml/classlookup.pxi":509
 *     See https://lxml.de/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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/classlookup.pxi":510
 *     """
 *     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;

  /* "src/lxml/classlookup.pxi":509
 *     See https://lxml.de/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup, "lookup(self, doc, element)\n\n        Override this method to implement your own lookup scheme.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_24PythonElementClassLookup_3lookup = {"lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup};
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_doc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_element = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doc_2,&__pyx_n_s_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doc_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 512, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 512, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, 1); __PYX_ERR(9, 512, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "lookup") < 0)) __PYX_ERR(9, 512, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_doc = values[0];
    __pyx_v_element = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, __pyx_nargs); __PYX_ERR(9, 512, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/classlookup.pxi":517
 *         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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
 */

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

/* "src/lxml/classlookup.pxi":519
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy 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__ReadOnlyProxy *__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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_python_class_lookup", 1);

  /* "src/lxml/classlookup.pxi":522
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy 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;

  /* "src/lxml/classlookup.pxi":524
 *     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_ERR(9, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":525
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)             # <<<<<<<<<<<<<<
 *     _freeReadOnlyProxies(proxy)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lookup), __pyx_n_s_lookup); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_doc), ((PyObject *)__pyx_v_proxy)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_cls = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":526
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)             # <<<<<<<<<<<<<<
 * 
 *     if cls is not None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_proxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/classlookup.pxi":528
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
 */
  __pyx_t_5 = (__pyx_v_cls != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/classlookup.pxi":529
 * 
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(9, 529, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":530
 *     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;

    /* "src/lxml/classlookup.pxi":528
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
 */
  }

  /* "src/lxml/classlookup.pxi":531
 *         _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_ERR(9, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/classlookup.pxi":519
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyProxy 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;
}

/* "src/lxml/classlookup.pxi":539
 * 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);

  /* "src/lxml/classlookup.pxi":542
 *     _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);
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":543
 *     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));

    /* "src/lxml/classlookup.pxi":544
 *     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;

    /* "src/lxml/classlookup.pxi":542
 *     _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
 */
  }

  /* "src/lxml/classlookup.pxi":546
 *         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);

  /* "src/lxml/classlookup.pxi":547
 * 
 *     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;

  /* "src/lxml/classlookup.pxi":539
 * 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();
}

/* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_43set_element_class_lookup(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_42set_element_class_lookup, "set_element_class_lookup(lookup = None)\n\n    Set the global element class lookup method.\n\n    This defines the main entry point for looking up element implementations.\n    The standard implementation uses the :class:`ParserBasedElementClassLookup`\n    to delegate to different lookup schemes for each parser. \n\n    .. warning::\n\n        This should only be changed by applications, not by library packages.\n        In most cases, parser specific lookups should be preferred,\n        which can be configured via\n        :meth:`~lxml.etree.XMLParser.set_element_class_lookup`\n        (and the same for HTML parsers).\n\n        Globally replacing the element class lookup by something other than a\n        :class:`ParserBasedElementClassLookup` will prevent parser specific lookup\n        schemes from working. Several tools rely on parser specific lookups,\n        including :mod:`lxml.html` and :mod:`lxml.objectify`.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_43set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_43set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_42set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_43set_element_class_lookup(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lookup);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 549, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_element_class_lookup") < 0)) __PYX_ERR(9, 549, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(9, 549, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(9, 549, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_42set_element_class_lookup(__pyx_self, __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_42set_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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 1);

  /* "src/lxml/classlookup.pxi":571
 *         including :mod:`lxml.html` and :mod:`lxml.objectify`.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_lookup) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_lookup->_lookup_function == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/classlookup.pxi":572
 *     """
 *     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); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 572, __pyx_L1_error)

    /* "src/lxml/classlookup.pxi":571
 *         including :mod:`lxml.html` and :mod:`lxml.objectify`.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/classlookup.pxi":574
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)             # <<<<<<<<<<<<<<
 * 
 * # default setup: parser delegation
 */
  /*else*/ {
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_lookup->_lookup_function, ((PyObject *)__pyx_v_lookup)); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 574, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
 */

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

/* "src/lxml/nsclasses.pxi":19
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ns_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 19, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(12, 19, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 19, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "src/lxml/nsclasses.pxi":20
 *     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;

  /* "src/lxml/nsclasses.pxi":21
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":22
 *         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);

    /* "src/lxml/nsclasses.pxi":23
 *         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;

    /* "src/lxml/nsclasses.pxi":21
 *     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
 */
    goto __pyx_L3;
  }

  /* "src/lxml/nsclasses.pxi":25
 *             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 = {}
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __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_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":26
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)             # <<<<<<<<<<<<<<
 *         self._entries = {}
 * 
 */
    __pyx_t_2 = __pyx_v_self->_ns_uri_utf;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_self->_c_ns_uri_utf = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/nsclasses.pxi":27
 *             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_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":19
 *     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_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_3update = {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_class_dict_iterable = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_class_dict_iterable,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_class_dict_iterable)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 29, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(12, 29, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_class_dict_iterable = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 29, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_class_dict_iterable);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  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);

  /* "src/lxml/nsclasses.pxi":41
 *         This allows registrations at the module or class level using
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, 'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 */
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_class_dict_iterable, __pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(12, 41, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":42
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, '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_ERR(12, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_class_dict_iterable, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":41
 *         This allows registrations at the module or class level using
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, 'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 */
  }

  /* "src/lxml/nsclasses.pxi":43
 *         if hasattr(class_dict_iterable, '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 (likely(PyList_CheckExact(__pyx_v_class_dict_iterable)) || PyTuple_CheckExact(__pyx_v_class_dict_iterable)) {
    __pyx_t_2 = __pyx_v_class_dict_iterable; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_class_dict_iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 43, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(12, 43, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(12, 43, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 43, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(12, 43, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(12, 43, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 43, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(12, 43, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(12, 43, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(12, 43, __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_ERR(12, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      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_ERR(12, 43, __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_ERR(12, 43, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "src/lxml/nsclasses.pxi":44
 *             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_11 = (__pyx_v_name == Py_None);
    if (!__pyx_t_11) {
    } else {
      goto __pyx_L10_next_and;
    }
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u__56, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(12, 44, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_L10_next_and:;
    __pyx_t_11 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(12, 44, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":45
 *         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_ERR(12, 45, __pyx_L1_error)

      /* "src/lxml/nsclasses.pxi":44
 *             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
 * 
 */
    }

    /* "src/lxml/nsclasses.pxi":43
 *         if hasattr(class_dict_iterable, '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
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/nsclasses.pxi":47
 *                 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "src/lxml/nsclasses.pxi":48
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":49
 *     def __getitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         return self._get(name)
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":48
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
 */
  }

  /* "src/lxml/nsclasses.pxi":50
 *         if name is not None:
 *             name = _utf8(name)
 *         return self._get(name)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":47
 *                 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_2);
  __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;
}

/* "src/lxml/nsclasses.pxi":52
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "src/lxml/nsclasses.pxi":53
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":54
 *     def __delitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         del self._entries[name]
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":53
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
 */
  }

  /* "src/lxml/nsclasses.pxi":55
 *         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_ERR(12, 55, __pyx_L1_error)
  }
  if (unlikely((PyDict_DelItem(__pyx_v_self->_entries, __pyx_v_name) < 0))) __PYX_ERR(12, 55, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":52
 *         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_2);
  __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;
}

/* "src/lxml/nsclasses.pxi":57
 *         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", 1);

  /* "src/lxml/nsclasses.pxi":59
 *     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, "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;

  /* "src/lxml/nsclasses.pxi":60
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_2 = (__pyx_v_dict_result == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/nsclasses.pxi":61
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_Name_not_registered, 0, 0);
    __PYX_ERR(12, 61, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":60
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
 */
  }

  /* "src/lxml/nsclasses.pxi":62
 *         if dict_result is NULL:
 *             raise KeyError, "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;

  /* "src/lxml/nsclasses.pxi":57
 *         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;
}

/* "src/lxml/nsclasses.pxi":64
 *         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", 1);

  /* "src/lxml/nsclasses.pxi":66
 *     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, "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_ERR(12, 66, __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;

  /* "src/lxml/nsclasses.pxi":67
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_3 = (__pyx_v_dict_result == NULL);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/nsclasses.pxi":68
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, "Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_Name_not_registered, 0, 0);
    __PYX_ERR(12, 68, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":67
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Name not registered."
 *         return <object>dict_result
 */
  }

  /* "src/lxml/nsclasses.pxi":69
 *         if dict_result is NULL:
 *             raise KeyError, "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;

  /* "src/lxml/nsclasses.pxi":64
 *         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;
}

/* "src/lxml/nsclasses.pxi":71
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/nsclasses.pxi":72
 * 
 *     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_ERR(12, 72, __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;

  /* "src/lxml/nsclasses.pxi":71
 *         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;
}

/* "src/lxml/nsclasses.pxi":74
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_11items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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", 1);

  /* "src/lxml/nsclasses.pxi":75
 * 
 *     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 '%.30s'", "items");
    __PYX_ERR(12, 75, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 75, __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;

  /* "src/lxml/nsclasses.pxi":74
 *         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;
}

/* "src/lxml/nsclasses.pxi":77
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_13iteritems = {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) return NULL;
  __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", 1);

  /* "src/lxml/nsclasses.pxi":78
 * 
 *     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 '%.30s'", "items");
    __PYX_ERR(12, 78, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 78, __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;

  /* "src/lxml/nsclasses.pxi":77
 *         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;
}

/* "src/lxml/nsclasses.pxi":80
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_15clear = {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL;
  __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", 1);

  /* "src/lxml/nsclasses.pxi":81
 * 
 *     def clear(self):
 *         self._entries.clear()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, obj):
 */
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(12, 81, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->_entries); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(12, 81, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":80
 *         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;
}

/* "src/lxml/nsclasses.pxi":83
 *         self._entries.clear()
 * 
 *     def __call__(self, obj):             # <<<<<<<<<<<<<<
 *         # Usage as decorator:
 *         #   ns = lookup.get_namespace("...")
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 83, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(12, 83, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_obj = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 83, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_obj);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_16__call__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_obj) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/nsclasses.pxi":92
 *         #   class elementname(ElementBase): pass
 * 
 *         if obj is None or python._isString(obj):             # <<<<<<<<<<<<<<
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)
 */
  __pyx_t_2 = (__pyx_v_obj == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isString(__pyx_v_obj);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":94
 *         if obj is None or python._isString(obj):
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)             # <<<<<<<<<<<<<<
 *         # plain @ns decorator
 *         self[obj.__name__] = obj
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_NamespaceRegistry__deco); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_partial);
    __pyx_t_5 = __pyx_v_4lxml_5etree_partial; __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_obj};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":92
 *         #   class elementname(ElementBase): pass
 * 
 *         if obj is None or python._isString(obj):             # <<<<<<<<<<<<<<
 *             # @ns(None) or @ns('tag')
 *             return partial(self.__deco, obj)
 */
  }

  /* "src/lxml/nsclasses.pxi":96
 *             return partial(self.__deco, obj)
 *         # plain @ns decorator
 *         self[obj.__name__] = obj             # <<<<<<<<<<<<<<
 *         return obj
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_v_obj) < 0))) __PYX_ERR(12, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/nsclasses.pxi":97
 *         # plain @ns decorator
 *         self[obj.__name__] = obj
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     def __deco(self, name, obj):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":83
 *         self._entries.clear()
 * 
 *     def __call__(self, obj):             # <<<<<<<<<<<<<<
 *         # Usage as decorator:
 *         #   ns = lookup.get_namespace("...")
 */

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

/* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco = {"_NamespaceRegistry__deco", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_obj = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_NamespaceRegistry__deco (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,&__pyx_n_s_obj,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 99, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 99, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_NamespaceRegistry__deco", 1, 2, 2, 1); __PYX_ERR(12, 99, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_NamespaceRegistry__deco") < 0)) __PYX_ERR(12, 99, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_obj = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_NamespaceRegistry__deco", 1, 2, 2, __pyx_nargs); __PYX_ERR(12, 99, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._NamespaceRegistry__deco", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_name, __pyx_v_obj);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_18__deco(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_NamespaceRegistry__deco", 1);

  /* "src/lxml/nsclasses.pxi":100
 * 
 *     def __deco(self, name, obj):
 *         self[name] = obj             # <<<<<<<<<<<<<<
 *         return obj
 * 
 */
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_obj) < 0))) __PYX_ERR(12, 100, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":101
 *     def __deco(self, name, obj):
 *         self[name] = obj
 *         return obj             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
 */

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

/* "src/lxml/nsclasses.pxi":108
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not isinstance(item, type) 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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);

  /* "src/lxml/nsclasses.pxi":109
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 */
  __pyx_t_2 = PyType_Check(__pyx_v_item); 
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsSubclass(__pyx_v_item, ((PyObject *)__pyx_ptype_4lxml_5etree_ElementBase)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(12, 109, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/nsclasses.pxi":110
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_NamespaceRegistryError), __pyx_kp_u_Registered_element_classes_must, 0, 0);
    __PYX_ERR(12, 110, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":109
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not isinstance(item, type) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 */
  }

  /* "src/lxml/nsclasses.pxi":112
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":113
 *                 "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_ERR(12, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/nsclasses.pxi":112
 *             raise NamespaceRegistryError, \
 *                 "Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
 */
  }

  /* "src/lxml/nsclasses.pxi":114
 *         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_ERR(12, 114, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->__pyx_base._entries, __pyx_v_name, __pyx_v_item) < 0))) __PYX_ERR(12, 114, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":108
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     "Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not isinstance(item, type) 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;
}

/* "src/lxml/nsclasses.pxi":116
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/nsclasses.pxi":117
 * 
 *     def __repr__(self):
 *         return "Namespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Namespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":116
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "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;
}

/* "src/lxml/nsclasses.pxi":140
 *     """
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/nsclasses.pxi":141
 *     cdef dict _namespace_registries
 *     def __cinit__(self):
 *         self._namespace_registries = {}             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 141, __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;

  /* "src/lxml/nsclasses.pxi":140
 *     """
 *     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;
}

/* "src/lxml/nsclasses.pxi":143
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fallback,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fallback);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 143, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(12, 143, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(12, 143, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(12, 143, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/nsclasses.pxi":144
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 *         self._lookup_function = _find_nselement_class
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_fallback)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 144, __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;

  /* "src/lxml/nsclasses.pxi":145
 *     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;

  /* "src/lxml/nsclasses.pxi":143
 *         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;
}

/* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace = {"get_namespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace};
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_namespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ns_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 147, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_namespace") < 0)) __PYX_ERR(12, 147, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_namespace", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self), __pyx_v_ns_uri);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_namespace", 1);

  /* "src/lxml/nsclasses.pxi":154
 * 
 *         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_ERR(12, 154, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":155
 *         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_ERR(12, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ns_utf = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":154
 * 
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:             # <<<<<<<<<<<<<<
 *             ns_utf = _utf8(ns_uri)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/nsclasses.pxi":157
 *             ns_utf = _utf8(ns_uri)
 *         else:
 *             ns_utf = None             # <<<<<<<<<<<<<<
 *         try:
 *             return self._namespace_registries[ns_utf]
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_ns_utf = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/nsclasses.pxi":159
 *             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_ERR(12, 159, __pyx_L4_error)
      }
      __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 159, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8_try_return;

      /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 */
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/nsclasses.pxi":160
 *         try:
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 */
    __pyx_t_6 = __Pyx_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_ERR(12, 160, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/nsclasses.pxi":162
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *             return registry
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry), __pyx_v_ns_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 162, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_t_9);

      /* "src/lxml/nsclasses.pxi":161
 *             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_ERR(12, 161, __pyx_L6_except_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf, __pyx_t_9) < 0))) __PYX_ERR(12, 161, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/nsclasses.pxi":163
 *             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;
    }
    goto __pyx_L6_except_error;

    /* "src/lxml/nsclasses.pxi":158
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 */
    __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;
  }

  /* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """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_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;
}

/* "src/lxml/nsclasses.pxi":165
 *             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;
  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("_find_nselement_class", 1);

  /* "src/lxml/nsclasses.pxi":169
 *     cdef ElementNamespaceClassLookup lookup
 *     cdef _NamespaceRegistry registry
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_state == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":170
 *     cdef _NamespaceRegistry registry
 *     if state is None:
 *         return _lookupDefaultElementClass(None, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(Py_None, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":169
 *     cdef ElementNamespaceClassLookup lookup
 *     cdef _NamespaceRegistry registry
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 */
  }

  /* "src/lxml/nsclasses.pxi":172
 *         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_2 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":173
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":174
 *     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_2 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":173
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 */
  }

  /* "src/lxml/nsclasses.pxi":176
 *         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);

  /* "src/lxml/nsclasses.pxi":177
 * 
 *     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_1 = (__pyx_v_c_namespace_utf != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":179
 *     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_2 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_namespace_utf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/nsclasses.pxi":178
 *     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_2, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":177
 * 
 *     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)
 */
    goto __pyx_L5;
  }

  /* "src/lxml/nsclasses.pxi":181
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 */
  /*else*/ {

    /* "src/lxml/nsclasses.pxi":182
 *     else:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)             # <<<<<<<<<<<<<<
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 */
    __pyx_t_3 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/nsclasses.pxi":181
 *             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_3, Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "src/lxml/nsclasses.pxi":183
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
 */
  __pyx_t_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":184
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result             # <<<<<<<<<<<<<<
 *         classes = registry._entries
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_dict_result);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":185
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries             # <<<<<<<<<<<<<<
 * 
 *         if c_node.name is not NULL:
 */
    __pyx_t_3 = __pyx_v_registry->_entries;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_classes = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":187
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)
 */
    __pyx_t_1 = (__pyx_v_c_node->name != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":189
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)             # <<<<<<<<<<<<<<
 *         else:
 *             dict_result = NULL
 */
      __pyx_t_3 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_node->name)); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/nsclasses.pxi":188
 * 
 *         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_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/nsclasses.pxi":187
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)
 */
      goto __pyx_L7;
    }

    /* "src/lxml/nsclasses.pxi":191
 *                 classes, <unsigned char*>c_node.name)
 *         else:
 *             dict_result = NULL             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is NULL:
 */
    /*else*/ {
      __pyx_v_dict_result = NULL;
    }
    __pyx_L7:;

    /* "src/lxml/nsclasses.pxi":193
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 */
    __pyx_t_1 = (__pyx_v_dict_result == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":194
 * 
 *         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);

      /* "src/lxml/nsclasses.pxi":193
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 */
    }

    /* "src/lxml/nsclasses.pxi":196
 *             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_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/nsclasses.pxi":197
 * 
 *         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;

      /* "src/lxml/nsclasses.pxi":196
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    }

    /* "src/lxml/nsclasses.pxi":183
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
 */
  }

  /* "src/lxml/nsclasses.pxi":198
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *     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_ERR(12, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":165
 *             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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_45FunctionNamespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_44FunctionNamespace, "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.\n\n    Usage:\n\n    >>> ns_functions = FunctionNamespace(\"http://schema.org/Movie\")\n\n    >>> @ns_functions  # uses function name\n    ... def add2(x):\n    ...     return x + 2\n\n    >>> @ns_functions(\"add3\")  # uses explicit name\n    ... def add_three(x):\n    ...     return x + 3\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_45FunctionNamespace = {"FunctionNamespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_45FunctionNamespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_44FunctionNamespace};
static PyObject *__pyx_pw_4lxml_5etree_45FunctionNamespace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("FunctionNamespace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ns_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(12, 207, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "FunctionNamespace") < 0)) __PYX_ERR(12, 207, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("FunctionNamespace", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 207, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_44FunctionNamespace(__pyx_self, __pyx_v_ns_uri);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_44FunctionNamespace(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("FunctionNamespace", 1);

  /* "src/lxml/nsclasses.pxi":228
 *     ...     return x + 3
 *     """
 *     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_ERR(12, 228, __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_ERR(12, 228, __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;

  /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/nsclasses.pxi":230
 *     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_ERR(12, 230, __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)) __PYX_ERR(12, 230, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;

      /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/nsclasses.pxi":231
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 */
    __pyx_t_7 = __Pyx_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_ERR(12, 231, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "src/lxml/nsclasses.pxi":233
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *         return registry
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry), __pyx_v_ns_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 233, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_9);

      /* "src/lxml/nsclasses.pxi":232
 *         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_ERR(12, 232, __pyx_L5_except_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, __pyx_v_ns_utf, __pyx_t_9) < 0))) __PYX_ERR(12, 232, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/nsclasses.pxi":234
 *         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;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/nsclasses.pxi":229
 *     """
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 */
    __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;
  }

  /* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """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_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;
}

/* "src/lxml/nsclasses.pxi":238
 * @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/nsclasses.pxi":239
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 */
  __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(12, 239, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/nsclasses.pxi":240
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 "Registered functions must be callable."
 *         if not name:
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_NamespaceRegistryError), __pyx_kp_u_Registered_functions_must_be_cal, 0, 0);
    __PYX_ERR(12, 240, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":239
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 */
  }

  /* "src/lxml/nsclasses.pxi":242
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "extensions must have non empty names"
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(12, 242, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/nsclasses.pxi":243
 *                 "Registered functions must be callable."
 *         if not name:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 "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_ERR(12, 243, __pyx_L1_error)

    /* "src/lxml/nsclasses.pxi":242
 *             raise NamespaceRegistryError, \
 *                 "Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 "extensions must have non empty names"
 */
  }

  /* "src/lxml/nsclasses.pxi":245
 *             raise ValueError, \
 *                 "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_ERR(12, 245, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 245, __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_ERR(12, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/nsclasses.pxi":238
 * @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;
}

/* "src/lxml/nsclasses.pxi":247
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/nsclasses.pxi":248
 * 
 *     def __repr__(self):
 *         return "FunctionNamespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_FunctionNamespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/nsclasses.pxi":247
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "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;
}

/* "src/lxml/nsclasses.pxi":258
 *     property prefix:
 *         "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/nsclasses.pxi":259
 *         "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;

  /* "src/lxml/nsclasses.pxi":260
 *         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);

  /* "src/lxml/nsclasses.pxi":258
 *     property prefix:
 *         "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;
}

/* "src/lxml/nsclasses.pxi":261
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/nsclasses.pxi":262
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_1 = (__pyx_v_self->_prefix == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":263
 *         def __get__(self):
 *             if self._prefix is None:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._prefix
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_r = __pyx_kp_u__12;
    goto __pyx_L0;

    /* "src/lxml/nsclasses.pxi":262
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  }

  /* "src/lxml/nsclasses.pxi":265
 *                 return ''
 *             else:
 *                 return self._prefix             # <<<<<<<<<<<<<<
 *         def __set__(self, prefix):
 *             if prefix == '':
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_prefix);
    __pyx_r = __pyx_v_self->_prefix;
    goto __pyx_L0;
  }

  /* "src/lxml/nsclasses.pxi":261
 *             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;
}

/* "src/lxml/nsclasses.pxi":266
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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__", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "src/lxml/nsclasses.pxi":267
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_prefix, __pyx_kp_u__12, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(12, 267, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/nsclasses.pxi":268
 *         def __set__(self, prefix):
 *             if prefix == '':
 *                 prefix = None # empty prefix             # <<<<<<<<<<<<<<
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 *             self._prefix = prefix
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_prefix, Py_None);

    /* "src/lxml/nsclasses.pxi":267
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 */
  }

  /* "src/lxml/nsclasses.pxi":269
 *             if prefix == '':
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None             # <<<<<<<<<<<<<<
 *             self._prefix = prefix
 * 
 */
  __pyx_t_1 = (__pyx_v_prefix != Py_None);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 269, __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;
  }
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(12, 269, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
  __Pyx_DECREF(__pyx_v_self->_prefix_utf);
  __pyx_v_self->_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":270
 *                 prefix = None # empty prefix
 *             self._prefix_utf = _utf8(prefix) if prefix is not None else None
 *             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;

  /* "src/lxml/nsclasses.pxi":266
 *             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_2);
  __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;
}

/* "src/lxml/nsclasses.pxi":272
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     "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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_all_extension_prefixes", 1);

  /* "src/lxml/nsclasses.pxi":275
 *     "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_ERR(12, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":276
 *     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 '%.30s'", "itervalues");
    __PYX_ERR(12, 276, __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_ERR(12, 276, __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_ERR(12, 276, __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_ERR(12, 276, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_registry, ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/nsclasses.pxi":277
 *     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));
    if (__pyx_t_7) {

      /* "src/lxml/nsclasses.pxi":278
 *     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_7 = (__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf != ((PyObject*)Py_None));
      if (__pyx_t_7) {

        /* "src/lxml/nsclasses.pxi":280
 *             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_ERR(12, 280, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_registry->_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_registry->_prefix_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_registry->_prefix_utf)) __PYX_ERR(12, 280, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf)) __PYX_ERR(12, 280, __pyx_L1_error);

        /* "src/lxml/nsclasses.pxi":279
 *         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_8 = __Pyx_PyList_Append(__pyx_v_ns_prefixes, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(12, 279, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/nsclasses.pxi":278
 *     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))
 */
      }

      /* "src/lxml/nsclasses.pxi":277
 *     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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/nsclasses.pxi":281
 *                 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;

  /* "src/lxml/nsclasses.pxi":272
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     "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;
}

/* "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/docloader.pxi":20
 * 
 *     def __cinit__(self):
 *         self._type = PARSER_DATA_INVALID             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->_type = __pyx_e_4lxml_5etree_PARSER_DATA_INVALID;

  /* "src/lxml/docloader.pxi":19
 *     cdef bint _close_file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_1resolve = {"resolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_1resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_resolve};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_system_url = 0;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_system_url,&__pyx_n_s_public_id,&__pyx_n_s_context,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_system_url)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 25, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_public_id)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 25, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); __PYX_ERR(13, 25, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 25, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); __PYX_ERR(13, 25, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve") < 0)) __PYX_ERR(13, 25, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, __pyx_nargs); __PYX_ERR(13, 25, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
 */

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

/* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_3resolve_empty = {"resolve_empty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_2resolve_empty};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_empty (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 36, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve_empty") < 0)) __PYX_ERR(13, 36, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_context = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_empty", 1, 1, 1, __pyx_nargs); __PYX_ERR(13, 36, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__InputDocument)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 44, __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;

  /* "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;

  /* "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;

  /* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_5resolve_string = {"resolve_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_5resolve_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_4resolve_string};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_string = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_string_2,&__pyx_n_s_context,&__pyx_n_s_base_url,0};
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_string_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 48, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 48, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, 1); __PYX_ERR(13, 48, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 48, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve_string") < 0)) __PYX_ERR(13, 48, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_string = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, __pyx_nargs); __PYX_ERR(13, 48, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_string", 0);
  __Pyx_INCREF(__pyx_v_string);

  /* "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); 
  if (__pyx_t_1) {

    /* "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 '%.30s'", "encode");
      __PYX_ERR(13, 59, __pyx_L1_error)
    }
    __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_string)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_string, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/docloader.pxi":58
 *         """
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):             # <<<<<<<<<<<<<<
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
 */
    goto __pyx_L3;
  }

  /* "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_1 = PyBytes_Check(__pyx_v_string); 
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "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_u_argument_must_be_a_byte_string_o, 0, 0);
    __PYX_ERR(13, 61, __pyx_L1_error)

    /* "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_L3:;

  /* "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_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__InputDocument)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "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;

  /* "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) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_string))) __PYX_ERR(13, 64, __pyx_L1_error)
  __pyx_t_2 = __pyx_v_string;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __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_2);
  __pyx_t_2 = 0;

  /* "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_3 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_3) {

    /* "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_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "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
 */
  }

  /* "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;

  /* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_7resolve_filename = {"resolve_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_6resolve_filename};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_context,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 69, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 69, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, 1); __PYX_ERR(13, 69, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve_filename") < 0)) __PYX_ERR(13, 69, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_filename = values[0];
    __pyx_v_context = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, __pyx_nargs); __PYX_ERR(13, 69, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__InputDocument)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 78, __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;

  /* "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;

  /* "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_ERR(13, 80, __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;

  /* "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;

  /* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_8Resolver_9resolve_file = {"resolve_file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_9resolve_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_8resolve_file};
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_9resolve_file(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_v_close;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_context,&__pyx_n_s_base_url,&__pyx_n_s_close,0};
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 83, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 83, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, 1); __PYX_ERR(13, 83, __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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 83, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve_file") < 0)) __PYX_ERR(13, 83, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__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_ERR(13, 83, __pyx_L3_error)
    } else {
      __pyx_v_close = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, __pyx_nargs); __PYX_ERR(13, 83, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_file", 1);

  /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/docloader.pxi":98
 *         cdef _InputDocument doc_ref
 *         try:
 *             f.read             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             raise TypeError, "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_ERR(13, 98, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/docloader.pxi":99
 *         try:
 *             f.read
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 */
    __pyx_t_5 = __Pyx_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_ERR(13, 99, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/docloader.pxi":100
 *             f.read
 *         except AttributeError:
 *             raise TypeError, "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_ERR(13, 100, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
 */
    __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_L8_try_end:;
  }

  /* "src/lxml/docloader.pxi":101
 *         except AttributeError:
 *             raise TypeError, "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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__InputDocument)); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 101, __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;

  /* "src/lxml/docloader.pxi":102
 *             raise TypeError, "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;

  /* "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);
  if (__pyx_t_8) {

    /* "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_ERR(13, 104, __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;

    /* "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:
 */
    goto __pyx_L11;
  }

  /* "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
 */
  /*else*/ {
    __pyx_t_7 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_f); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 106, __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_L11:;

  /* "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;

  /* "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;

  /* "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;

  /* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_default_resolver,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default_resolver);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 116, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(13, 116, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, __pyx_nargs); __PYX_ERR(13, 116, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(13, 116, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "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_ERR(13, 117, __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;

  /* "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((PyObject *)__pyx_v_self->_default_resolver);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_default_resolver);
  __pyx_v_self->_default_resolver = __pyx_v_default_resolver;

  /* "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;
}

/* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_3add = {"add", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_2add};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_resolver,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_resolver)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 120, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(13, 120, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(13, 120, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resolver), __pyx_ptype_4lxml_5etree_Resolver, 0, "resolver", 0))) __PYX_ERR(13, 120, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_resolver);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 1);

  /* "src/lxml/docloader.pxi":131
 *         until the first match is found.
 *         """
 *         self._resolvers.add(resolver)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, resolver):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_resolvers, __pyx_n_s_add); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_resolver)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 131, __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;

  /* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove, "remove(self, resolver)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_5remove = {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_resolver = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_resolver,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_resolver)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 133, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove") < 0)) __PYX_ERR(13, 133, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_resolver = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, __pyx_nargs); __PYX_ERR(13, 133, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_resolver);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 1);

  /* "src/lxml/docloader.pxi":135
 *     def remove(self, resolver):
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ResolverRegistry _copy(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_resolvers, __pyx_n_s_discard); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_resolver};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 135, __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;

  /* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 1);

  /* "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 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry), ((PyObject *)__pyx_v_self->_default_resolver)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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_ERR(13, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 140, __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;

  /* "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;

  /* "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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy, "copy(self)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_7copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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", 1);

  /* "src/lxml/docloader.pxi":145
 *     def copy(self):
 *         "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_ERR(13, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve, "resolve(self, system_url, public_id, context)");
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ResolverRegistry_9resolve = {"resolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve};
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_system_url = 0;
  PyObject *__pyx_v_public_id = 0;
  PyObject *__pyx_v_context = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_system_url,&__pyx_n_s_public_id,&__pyx_n_s_context,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_system_url)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 147, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_public_id)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 147, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); __PYX_ERR(13, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 147, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); __PYX_ERR(13, 147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resolve") < 0)) __PYX_ERR(13, 147, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, __pyx_nargs); __PYX_ERR(13, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/docloader.pxi":149
 *     def resolve(self, system_url, public_id, context):
 *         "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 (likely(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_ERR(13, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 149, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(13, 149, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(13, 149, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 149, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(13, 149, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(13, 149, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 149, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 149, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_resolver, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/docloader.pxi":150
 *         "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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_resolver, __pyx_n_s_resolve); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 3+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "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_8 = (__pyx_v_result != Py_None);
    if (__pyx_t_8) {

      /* "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;

      /* "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:
 */
    }

    /* "src/lxml/docloader.pxi":149
 *     def resolve(self, system_url, public_id, context):
 *         "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:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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);
  if (__pyx_t_8) {

    /* "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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "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)
 */
  }

  /* "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_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_default_resolver), __pyx_n_s_resolve); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 3+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 155, __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;

  /* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/docloader.pxi":158
 * 
 *     def __repr__(self):
 *         return repr(self._resolvers)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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_ERR(13, 158, __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;

  /* "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;
}

/* "src/lxml/docloader.pxi":166
 *     cdef _TempStore _storage
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 */

static int __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/docloader.pxi":167
 * 
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)             # <<<<<<<<<<<<<<
 *         self._storage.clear()
 *         return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17_ExceptionContext_clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(13, 167, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":168
 *     cdef int clear(self) except -1:
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_TempStore_clear(__pyx_v_self->_storage); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(13, 168, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":169
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/docloader.pxi":166
 *     cdef _TempStore _storage
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 */

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

/* "src/lxml/docloader.pxi":172
 * 
 * 
 * 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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initResolverContext", 1);

  /* "src/lxml/docloader.pxi":174
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_resolvers) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/docloader.pxi":175
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 *         context._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 *     else:
 *         context._resolvers = resolvers
 */
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__pyx_v_context->_resolvers);
    __Pyx_DECREF((PyObject *)__pyx_v_context->_resolvers);
    __pyx_v_context->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/docloader.pxi":174
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/docloader.pxi":177
 *         context._resolvers = _ResolverRegistry()
 *     else:
 *         context._resolvers = resolvers             # <<<<<<<<<<<<<<
 *     context._storage = _TempStore()
 */
  /*else*/ {
    __Pyx_INCREF((PyObject *)__pyx_v_resolvers);
    __Pyx_GIVEREF((PyObject *)__pyx_v_resolvers);
    __Pyx_GOTREF((PyObject *)__pyx_v_context->_resolvers);
    __Pyx_DECREF((PyObject *)__pyx_v_context->_resolvers);
    __pyx_v_context->_resolvers = __pyx_v_resolvers;
  }
  __pyx_L3:;

  /* "src/lxml/docloader.pxi":178
 *     else:
 *         context._resolvers = resolvers
 *     context._storage = _TempStore()             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__TempStore)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_storage);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_storage);
  __pyx_v_context->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/docloader.pxi":172
 * 
 * 
 * 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_2);
  __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;
}

/* "src/lxml/parser.pxi":12
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_code,&__pyx_n_s_line_2,&__pyx_n_s_column_2,&__pyx_n_s_filename,0};
    values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); __PYX_ERR(2, 12, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_code)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); __PYX_ERR(2, 12, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_line_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); __PYX_ERR(2, 12, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_column_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); __PYX_ERR(2, 12, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename);
          if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(2, 12, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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];
    __pyx_v_filename = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, __pyx_nargs); __PYX_ERR(2, 12, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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, __pyx_v_filename);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_v_filename) {
  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("__init__", 1);

  /* "src/lxml/parser.pxi":13
 *     """
 *     def __init__(self, message, code, line, column, filename=None):
 *         super(_ParseError, self).__init__(message)             # <<<<<<<<<<<<<<
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__ParseError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__ParseError)) __PYX_ERR(2, 13, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self)) __PYX_ERR(2, 13, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 13, __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_ERR(2, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_message};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __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;

  /* "src/lxml/parser.pxi":14
 *     def __init__(self, message, code, line, column, filename=None):
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)             # <<<<<<<<<<<<<<
 *         self.code = code
 *         self.filename = filename
 */
  __pyx_t_1 = __pyx_v_line;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_column, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lineno, __pyx_t_1) < 0) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_offset, __pyx_t_2) < 0) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":15
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code             # <<<<<<<<<<<<<<
 *         self.filename = filename
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code, __pyx_v_code) < 0) __PYX_ERR(2, 15, __pyx_L1_error)

  /* "src/lxml/parser.pxi":16
 *         self.lineno, self.offset = (line, column - 1)
 *         self.code = code
 *         self.filename = filename             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_filename, __pyx_v_filename) < 0) __PYX_ERR(2, 16, __pyx_L1_error)

  /* "src/lxml/parser.pxi":12
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":18
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_3position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_3position = {"position", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_3position, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_3position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("position (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 18, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "position") < 0)) __PYX_ERR(2, 18, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("position", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 18, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError_2position(__pyx_self, __pyx_v_self);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

  /* "src/lxml/parser.pxi":20
 *     @property
 *     def position(self):
 *         return self.lineno, self.offset + 1             # <<<<<<<<<<<<<<
 * 
 *     @position.setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lineno); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 20, __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_ERR(2, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(2, 20, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(2, 20, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":18
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
 */

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

/* "src/lxml/parser.pxi":22
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_5position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_5position = {"position", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10ParseError_5position, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_5position(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_new_pos = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("position (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_new_pos,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 22, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_pos)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 22, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("position", 1, 2, 2, 1); __PYX_ERR(2, 22, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "position") < 0)) __PYX_ERR(2, 22, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_new_pos = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("position", 1, 2, 2, __pyx_nargs); __PYX_ERR(2, 22, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError_4position(__pyx_self, __pyx_v_self, __pyx_v_new_pos);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10ParseError_4position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_pos) {
  PyObject *__pyx_v_column = 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)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("position", 1);

  /* "src/lxml/parser.pxi":24
 *     @position.setter
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos             # <<<<<<<<<<<<<<
 *         self.offset = column - 1
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_new_pos))) || (PyList_CheckExact(__pyx_v_new_pos))) {
    PyObject* sequence = __pyx_v_new_pos;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(2, 24, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_new_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(2, 24, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(2, 24, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lineno, __pyx_t_1) < 0) __PYX_ERR(2, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_column = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":25
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 *         self.offset = column - 1             # <<<<<<<<<<<<<<
 * 
 * cdef object _ParseError = ParseError
 */
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_column, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_offset, __pyx_t_2) < 0) __PYX_ERR(2, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":22
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 */

  /* 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.ParseError.position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_column);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":55
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/parser.pxi":56
 * 
 *     def __cinit__(self):
 *         self._c_dict = NULL             # <<<<<<<<<<<<<<
 *         self._implied_parser_contexts = []
 * 
 */
  __pyx_v_self->_c_dict = NULL;

  /* "src/lxml/parser.pxi":57
 *     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_ERR(2, 57, __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;

  /* "src/lxml/parser.pxi":55
 *     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;
}

/* "src/lxml/parser.pxi":59
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":60
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_c_dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":61
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initMainParserContext(self) except -1:
 */
    xmlDictFree(__pyx_v_self->_c_dict);

    /* "src/lxml/parser.pxi":60
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 */
  }

  /* "src/lxml/parser.pxi":59
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
 */

  /* function exit code */
}

/* "src/lxml/parser.pxi":63
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef int initMainParserContext(self) except -1:             # <<<<<<<<<<<<<<
 *         """Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 */

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":66
 *         """Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/parser.pxi":67
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 */
  __pyx_t_1 = (__pyx_v_thread_dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":68
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)["_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_ERR(2, 68, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(((PyObject*)__pyx_v_thread_dict), __pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_self)) < 0))) __PYX_ERR(2, 68, __pyx_L1_error)

    /* "src/lxml/parser.pxi":67
 *         thread.  To be called once and only in the main thread."""
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 */
  }

  /* "src/lxml/parser.pxi":63
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef int initMainParserContext(self) except -1:             # <<<<<<<<<<<<<<
 *         """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 */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initMainParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":70
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
 */

static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_result;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__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("_findThreadParserContext", 1);

  /* "src/lxml/parser.pxi":73
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is NULL:
 *             return self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "src/lxml/parser.pxi":74
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":75
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 */
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":74
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         d = <dict>thread_dict
 */
  }

  /* "src/lxml/parser.pxi":76
 *         if thread_dict is NULL:
 *             return self
 *         d = <dict>thread_dict             # <<<<<<<<<<<<<<
 *         result = python.PyDict_GetItem(d, "_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;

  /* "src/lxml/parser.pxi":77
 *             return self
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             return <object>result
 */
  __pyx_v_result = PyDict_GetItem(__pyx_v_d, __pyx_n_u_ParserDictionaryContext);

  /* "src/lxml/parser.pxi":78
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 */
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":79
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:
 *             return <object>result             # <<<<<<<<<<<<<<
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_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_ERR(2, 79, __pyx_L1_error)
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)((PyObject *)__pyx_v_result));
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":78
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, "_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 */
  }

  /* "src/lxml/parser.pxi":80
 *         if result is not NULL:
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)             # <<<<<<<<<<<<<<
 *         d["_ParserDictionaryContext"] = context
 *         return context
 */
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ParserDictionaryContext), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 80, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":81
 *             return <object>result
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_ParserDictionaryContext"] = context             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 81, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_context)) < 0))) __PYX_ERR(2, 81, __pyx_L1_error)

  /* "src/lxml/parser.pxi":82
 *         context = <_ParserDictionaryContext>_ParserDictionaryContext.__new__(_ParserDictionaryContext)
 *         d["_ParserDictionaryContext"] = context
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":70
 *             (<dict>thread_dict)["_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         "Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":84
 *         return context
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 */

static int __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;
  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("setDefaultParser", 1);

  /* "src/lxml/parser.pxi":87
 *         "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_ERR(2, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":88
 *         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((PyObject *)__pyx_v_context->_default_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_default_parser);
  __pyx_v_context->_default_parser = __pyx_v_parser;

  /* "src/lxml/parser.pxi":84
 *         return context
 * 
 *     cdef int setDefaultParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 */

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

/* "src/lxml/parser.pxi":90
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         "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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getDefaultParser", 1);

  /* "src/lxml/parser.pxi":93
 *         "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_ERR(2, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":94
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":95
 *         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_2 = (((PyObject *)__pyx_v_self->_default_parser) == Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":96
 *         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_ERR(2, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__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;

      /* "src/lxml/parser.pxi":95
 *         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:
 */
    }

    /* "src/lxml/parser.pxi":97
 *             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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":98
 *                 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_ERR(2, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__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;

      /* "src/lxml/parser.pxi":97
 *             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
 */
    }

    /* "src/lxml/parser.pxi":94
 *         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()
 */
  }

  /* "src/lxml/parser.pxi":99
 *             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;

  /* "src/lxml/parser.pxi":90
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "src/lxml/parser.pxi":101
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         "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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getThreadDict", 1);

  /* "src/lxml/parser.pxi":104
 *         "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_ERR(2, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":105
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":107
 *         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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":108
 *             # 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;

      /* "src/lxml/parser.pxi":109
 *             if default is not NULL:
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)             # <<<<<<<<<<<<<<
 *                 return default
 *             if self._c_dict is NULL:
 */
      (void)(xmlDictReference(__pyx_v_default));

      /* "src/lxml/parser.pxi":110
 *                 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;

      /* "src/lxml/parser.pxi":107
 *         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)
 */
    }

    /* "src/lxml/parser.pxi":111
 *                 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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":112
 *                 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();

      /* "src/lxml/parser.pxi":111
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 *             if self._c_dict is NULL:             # <<<<<<<<<<<<<<
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 */
    }

    /* "src/lxml/parser.pxi":113
 *             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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":114
 *                 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);

      /* "src/lxml/parser.pxi":113
 *             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
 */
    }

    /* "src/lxml/parser.pxi":105
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":115
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
 */
  __pyx_r = __pyx_v_context->_c_dict;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":101
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         "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_AddTraceback("lxml.etree._ParserDictionaryContext._getThreadDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":117
 *         return context._c_dict
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:             # <<<<<<<<<<<<<<
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 */

static int __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;
  int __pyx_r;
  xmlDict *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":118
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
 *         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]);

  /* "src/lxml/parser.pxi":119
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)             # <<<<<<<<<<<<<<
 *         if c_dict is c_thread_dict:
 *             return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_self, __pyx_v_c_dict); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 119, __pyx_L1_error)
  __pyx_v_c_thread_dict = __pyx_t_1;

  /* "src/lxml/parser.pxi":120
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return 0
 *         if c_dict is not NULL:
 */
  __pyx_t_2 = (__pyx_v_c_dict == __pyx_v_c_thread_dict);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":121
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 *             return 0             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":120
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return 0
 *         if c_dict is not NULL:
 */
  }

  /* "src/lxml/parser.pxi":122
 *         if c_dict is c_thread_dict:
 *             return 0
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 */
  __pyx_t_2 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":123
 *             return 0
 *         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);

    /* "src/lxml/parser.pxi":122
 *         if c_dict is c_thread_dict:
 *             return 0
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 */
  }

  /* "src/lxml/parser.pxi":124
 *         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;

  /* "src/lxml/parser.pxi":125
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 */
  (void)(xmlDictReference(__pyx_v_c_thread_dict));

  /* "src/lxml/parser.pxi":117
 *         return context._c_dict
 * 
 *     cdef int initThreadDictRef(self, tree.xmlDict** c_dict_ref) except -1:             # <<<<<<<<<<<<<<
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 */

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

/* "src/lxml/parser.pxi":127
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":129
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 *         pctxt.dictNames = 1
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 129, __pyx_L1_error)

  /* "src/lxml/parser.pxi":130
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 *         pctxt.dictNames = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:
 */
  __pyx_v_pctxt->dictNames = 1;

  /* "src/lxml/parser.pxi":127
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef int initParserDict(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

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

/* "src/lxml/parser.pxi":132
 *         pctxt.dictNames = 1
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":134
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 134, __pyx_L1_error)

  /* "src/lxml/parser.pxi":132
 *         pctxt.dictNames = 1
 * 
 *     cdef int initXPathParserDict(self, xpath.xmlXPathContext* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         "Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

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

/* "src/lxml/parser.pxi":136
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:             # <<<<<<<<<<<<<<
 *         "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 int __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":141
 *         # 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_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_result->dict)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 141, __pyx_L1_error)

  /* "src/lxml/parser.pxi":136
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef int initDocDict(self, xmlDoc* result) except -1:             # <<<<<<<<<<<<<<
 *         "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_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.initDocDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         """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", 1);

  /* "src/lxml/parser.pxi":153
 * 
 *         # 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_ERR(2, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":154
 *         # 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) {

    /* "src/lxml/parser.pxi":155
 *         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_ERR(2, 155, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_context->_implied_parser_contexts, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 155, __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_ERR(2, 155, __pyx_L1_error)
    __pyx_v_implied_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/parser.pxi":156
 *         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;

    /* "src/lxml/parser.pxi":154
 *         # 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
 */
  }

  /* "src/lxml/parser.pxi":157
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/parser.pxi":159
 *         return None
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:
 */

static int __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) {
  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("pushImpliedContextFromParser", 1);

  /* "src/lxml/parser.pxi":161
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
 *         "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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":162
 *         "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_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_getParserContext(__pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":161
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:             # <<<<<<<<<<<<<<
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":164
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 *             self.pushImpliedContext(None)             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 164, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":159
 *         return None
 * 
 *     cdef int pushImpliedContextFromParser(self, _BaseParser parser) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object taken from the parser."
 *         if parser is not None:
 */

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

/* "src/lxml/parser.pxi":166
 *             self.pushImpliedContext(None)
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 */

static int __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;
  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("pushImpliedContext", 1);

  /* "src/lxml/parser.pxi":169
 *         "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_ERR(2, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":170
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.append(parser_context)             # <<<<<<<<<<<<<<
 * 
 *     cdef int popImpliedContext(self) except -1:
 */
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(2, 170, __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 == ((int)-1))) __PYX_ERR(2, 170, __pyx_L1_error)

  /* "src/lxml/parser.pxi":166
 *             self.pushImpliedContext(None)
 * 
 *     cdef int pushImpliedContext(self, _ParserContext parser_context) except -1:             # <<<<<<<<<<<<<<
 *         "Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 */

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

/* "src/lxml/parser.pxi":172
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef int popImpliedContext(self) except -1:             # <<<<<<<<<<<<<<
 *         "Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 */

static int __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;
  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("popImpliedContext", 1);

  /* "src/lxml/parser.pxi":175
 *         "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_ERR(2, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":176
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.pop()             # <<<<<<<<<<<<<<
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
 */
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(2, 176, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_context->_implied_parser_contexts); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":172
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef int popImpliedContext(self) except -1:             # <<<<<<<<<<<<<<
 *         "Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 */

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

/* "src/lxml/parser.pxi":188
 * cdef const_char* _PY_UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     """Sets _PY_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;
  Py_UNICODE __pyx_t_1[7];
  int __pyx_t_2;
  int __pyx_t_3;
  const char *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":197
 *     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;

  /* "src/lxml/parser.pxi":198
 *     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);

  /* "src/lxml/parser.pxi":200
 *     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_3 = ((__pyx_v_buffer[0]) == '<');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[1]) == '\x00');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":201
 *     # 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_3 = ((__pyx_v_buffer[2]) == 't');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[3]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parser.pxi":200
 *     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"
 */
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":202
 *     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 = ((const char *)"UTF-16LE");

    /* "src/lxml/parser.pxi":200
 *     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"
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":203
 *             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');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[1]) == '<');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":204
 *         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_3 = ((__pyx_v_buffer[2]) == '\x00');
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_buffer[3]) == 't');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;

  /* "src/lxml/parser.pxi":203
 *             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"
 */
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":205
 *     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 = ((const char *)"UTF-16BE");

    /* "src/lxml/parser.pxi":203
 *             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"
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":208
 *     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 :)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_4lxml_5etree__findEncodingName(__pyx_v_buffer, ((sizeof(Py_UNICODE)) * 7)); if (unlikely(__pyx_t_4 == ((const char *)NULL) && PyErr_Occurred())) __PYX_ERR(2, 208, __pyx_L1_error)
    __pyx_v_enc = __pyx_t_4;

    /* "src/lxml/parser.pxi":209
 *         # 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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":211
 *         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;

      /* "src/lxml/parser.pxi":209
 *         # 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_L3:;

  /* "src/lxml/parser.pxi":212
 *             # not my fault, it's YOUR broken system :)
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         global _PY_UNICODE_ENCODING
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_enc);

  /* "src/lxml/parser.pxi":213
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_t_2 = (__pyx_v_enchandler != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":215
 *     if enchandler is not NULL:
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         _PY_UNICODE_ENCODING = enc
 *     return 0
 */
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/parser.pxi":216
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _PY_UNICODE_ENCODING = enc             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING = __pyx_v_enc;

    /* "src/lxml/parser.pxi":213
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _PY_UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  }

  /* "src/lxml/parser.pxi":217
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _PY_UNICODE_ENCODING = enc
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":188
 * cdef const_char* _PY_UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     """Sets _PY_UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
 */

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

/* "src/lxml/parser.pxi":219
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":222
 *     "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:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 */
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_size);

  /* "src/lxml/parser.pxi":223
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 */
  switch (__pyx_v_enc) {
    case XML_CHAR_ENCODING_UTF16LE:

    /* "src/lxml/parser.pxi":224
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
 */
    __pyx_t_2 = (__pyx_v_size >= 4);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_buffer[0]) == ((const xmlChar)'\xFF'));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":225
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and             # <<<<<<<<<<<<<<
 *                           buffer[2] == 0 and buffer[3] == 0):
 *             return "UTF-32LE"  # according to BOM
 */
    __pyx_t_2 = ((__pyx_v_buffer[1]) == ((const xmlChar)'\xFE'));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":226
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):             # <<<<<<<<<<<<<<
 *             return "UTF-32LE"  # according to BOM
 *         else:
 */
    __pyx_t_2 = ((__pyx_v_buffer[2]) == 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_buffer[3]) == 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;

    /* "src/lxml/parser.pxi":224
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
 */
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":227
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
 *             return "UTF-32LE"  # according to BOM             # <<<<<<<<<<<<<<
 *         else:
 *             return "UTF-16LE"
 */
      __pyx_r = ((const char *)"UTF-32LE");
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":224
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and             # <<<<<<<<<<<<<<
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 *                           buffer[2] == 0 and buffer[3] == 0):
 */
    }

    /* "src/lxml/parser.pxi":229
 *             return "UTF-32LE"  # according to BOM
 *         else:
 *             return "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 */
    /*else*/ {
      __pyx_r = ((const char *)"UTF-16LE");
      goto __pyx_L0;
    }

    /* "src/lxml/parser.pxi":223
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         if size >= 4 and (buffer[0] == <const_xmlChar> b'\xFF' and
 *                           buffer[1] == <const_xmlChar> b'\xFE' and
 */
    break;
    case XML_CHAR_ENCODING_UTF16BE:

    /* "src/lxml/parser.pxi":231
 *             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 = ((const char *)"UTF-16BE");
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":230
 *         else:
 *             return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:             # <<<<<<<<<<<<<<
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 */
    break;
    case XML_CHAR_ENCODING_UCS4LE:

    /* "src/lxml/parser.pxi":233
 *         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 = ((const char *)"UCS-4LE");
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":232
 *     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:
 */
    break;
    case XML_CHAR_ENCODING_UCS4BE:

    /* "src/lxml/parser.pxi":235
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL
 */
    __pyx_r = ((const char *)"UCS-4BE");
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":234
 *     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:
 */
    break;
    case XML_CHAR_ENCODING_NONE:

    /* "src/lxml/parser.pxi":237
 *         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;

    /* "src/lxml/parser.pxi":236
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     else:
 */
    break;
    default:

    /* "src/lxml/parser.pxi":240
 *     else:
 *         # returns a constant char*, no need to free it
 *         return tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
 */
    __pyx_r = xmlGetCharEncodingName(__pyx_v_enc);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/parser.pxi":219
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):             # <<<<<<<<<<<<<<
 *     "Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":247
 * 
 * 
 * cdef unicode _find_PyUCS4EncodingName():             # <<<<<<<<<<<<<<
 *     """
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
 */

static PyObject *__pyx_f_4lxml_5etree__find_PyUCS4EncodingName(void) {
  PyObject *__pyx_v_ustring = NULL;
  xmlChar const *__pyx_v_buffer;
  Py_ssize_t __pyx_v_py_buffer_len;
  PyObject *__pyx_v_encoding_name = NULL;
  xmlCharEncoding __pyx_v_enc;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_c_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  Py_ssize_t __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_t_14;
  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("_find_PyUCS4EncodingName", 1);

  /* "src/lxml/parser.pxi":251
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
 *     """
 *     ustring = "<xml>\U0001F92A</xml>"             # <<<<<<<<<<<<<<
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
 */
  __Pyx_INCREF(__pyx_kp_u_xml_xml);
  __pyx_v_ustring = __pyx_kp_u_xml_xml;

  /* "src/lxml/parser.pxi":252
 *     """
 *     ustring = "<xml>\U0001F92A</xml>"
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
 * 
 */
  __pyx_v_buffer = ((xmlChar const *)PyUnicode_DATA(__pyx_v_ustring));

  /* "src/lxml/parser.pxi":253
 *     ustring = "<xml>\U0001F92A</xml>"
 *     cdef const xmlChar* buffer = <const xmlChar*> python.PyUnicode_DATA(ustring)
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)             # <<<<<<<<<<<<<<
 * 
 *     encoding_name = ''
 */
  __pyx_v_py_buffer_len = PyUnicode_GET_LENGTH(__pyx_v_ustring);

  /* "src/lxml/parser.pxi":255
 *     cdef Py_ssize_t py_buffer_len = python.PyUnicode_GET_LENGTH(ustring)
 * 
 *     encoding_name = ''             # <<<<<<<<<<<<<<
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 */
  __Pyx_INCREF(__pyx_kp_u__12);
  __pyx_v_encoding_name = __pyx_kp_u__12;

  /* "src/lxml/parser.pxi":256
 * 
 *     encoding_name = ''
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:
 */
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_py_buffer_len);

  /* "src/lxml/parser.pxi":257
 *     encoding_name = ''
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         try:
 */
  __pyx_v_enchandler = xmlGetCharEncodingHandler(__pyx_v_enc);

  /* "src/lxml/parser.pxi":258
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         try:
 *             if enchandler.name:
 */
  __pyx_t_1 = (__pyx_v_enchandler != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":259
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:
 *         try:             # <<<<<<<<<<<<<<
 *             if enchandler.name:
 *                 encoding_name = enchandler.name.decode('UTF-8')
 */
    /*try:*/ {

      /* "src/lxml/parser.pxi":260
 *     if enchandler is not NULL:
 *         try:
 *             if enchandler.name:             # <<<<<<<<<<<<<<
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
 */
      __pyx_t_1 = (__pyx_v_enchandler->name != 0);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":261
 *         try:
 *             if enchandler.name:
 *                 encoding_name = enchandler.name.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlCharEncCloseFunc(enchandler)
 */
        __pyx_t_2 = __pyx_v_enchandler->name;
        __pyx_t_3 = __Pyx_ssize_strlen(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 261, __pyx_L5_error)
        __pyx_t_4 = __Pyx_decode_c_string(__pyx_t_2, 0, __pyx_t_3, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 261, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/parser.pxi":260
 *     if enchandler is not NULL:
 *         try:
 *             if enchandler.name:             # <<<<<<<<<<<<<<
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
 */
      }
    }

    /* "src/lxml/parser.pxi":263
 *                 encoding_name = enchandler.name.decode('UTF-8')
 *         finally:
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
 */
    /*finally:*/ {
      /*normal exit:*/{
        (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));
        goto __pyx_L6;
      }
      __pyx_L5_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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;
        {
          (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));
        }
        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_L6:;
    }

    /* "src/lxml/parser.pxi":258
 *     cdef tree.xmlCharEncoding enc = tree.xmlDetectCharEncoding(buffer, py_buffer_len)
 *     enchandler = tree.xmlGetCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         try:
 *             if enchandler.name:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":265
 *             tree.xmlCharEncCloseFunc(enchandler)
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 *         if c_name:
 *             encoding_name = c_name.decode('UTF-8')
 */
  /*else*/ {
    __pyx_v_c_name = xmlGetCharEncodingName(__pyx_v_enc);

    /* "src/lxml/parser.pxi":266
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:             # <<<<<<<<<<<<<<
 *             encoding_name = c_name.decode('UTF-8')
 * 
 */
    __pyx_t_1 = (__pyx_v_c_name != 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":267
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:
 *             encoding_name = c_name.decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_3 = __Pyx_ssize_strlen(__pyx_v_c_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 267, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_c_name, 0, __pyx_t_3, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/parser.pxi":266
 *     else:
 *         c_name = tree.xmlGetCharEncodingName(enc)
 *         if c_name:             # <<<<<<<<<<<<<<
 *             encoding_name = c_name.decode('UTF-8')
 * 
 */
    }
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":270
 * 
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):             # <<<<<<<<<<<<<<
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_encoding_name); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(2, 270, __pyx_L1_error)
  if (__pyx_t_14) {
  } else {
    __pyx_t_1 = __pyx_t_14;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding_name, __pyx_n_s_endswith); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_15))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_15, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_n_u_LE};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  }
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(2, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_17 = (!__pyx_t_14);
  if (__pyx_t_17) {
  } else {
    __pyx_t_1 = __pyx_t_17;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding_name, __pyx_n_s_endswith); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_15))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_15, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_n_u_BE};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  }
  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(2, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_14 = (!__pyx_t_17);
  __pyx_t_1 = __pyx_t_14;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":271
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'             # <<<<<<<<<<<<<<
 *     return encoding_name or None
 * 
 */
    if (PY_BIG_ENDIAN) {
      __Pyx_INCREF(__pyx_n_u_BE);
      __pyx_t_4 = __pyx_n_u_BE;
    } else {
      __Pyx_INCREF(__pyx_n_u_LE);
      __pyx_t_4 = __pyx_n_u_LE;
    }
    __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_v_encoding_name, __pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_encoding_name, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "src/lxml/parser.pxi":270
 * 
 * 
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):             # <<<<<<<<<<<<<<
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None
 */
  }

  /* "src/lxml/parser.pxi":272
 *     if encoding_name and not encoding_name.endswith('LE') and not encoding_name.endswith('BE'):
 *         encoding_name += 'BE' if python.PY_BIG_ENDIAN else 'LE'
 *     return encoding_name or None             # <<<<<<<<<<<<<<
 * 
 * _pyucs4_encoding_name = _find_PyUCS4EncodingName()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding_name); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 272, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    if (!(likely(PyUnicode_CheckExact(__pyx_v_encoding_name))||((__pyx_v_encoding_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_encoding_name))) __PYX_ERR(2, 272, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_encoding_name);
    __pyx_t_15 = __pyx_v_encoding_name;
    goto __pyx_L15_bool_binop_done;
  }
  __Pyx_INCREF(Py_None);
  __pyx_t_15 = Py_None;
  __pyx_L15_bool_binop_done:;
  __pyx_r = ((PyObject*)__pyx_t_15);
  __pyx_t_15 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":247
 * 
 * 
 * cdef unicode _find_PyUCS4EncodingName():             # <<<<<<<<<<<<<<
 *     """
 *     Find a suitable encoding for Py_UCS4 PyUnicode strings in libxml2.
 */

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

/* "src/lxml/parser.pxi":293
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filelike)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 293, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 293, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 293, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_url)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 293, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 293, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 293, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_close_file);
          if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 293, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(2, 293, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        values[0] = __Pyx_Arg_VARARGS(__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_ERR(2, 293, __pyx_L3_error)
    } else {
      __pyx_v_close_file = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(2, 293, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 293, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "src/lxml/parser.pxi":294
 * 
 *     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_ERR(2, 294, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_exc_context;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/parser.pxi":295
 *     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;

  /* "src/lxml/parser.pxi":296
 *         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;

  /* "src/lxml/parser.pxi":297
 *         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;

  /* "src/lxml/parser.pxi":298
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":299
 *         self._encoding = encoding
 *         if url is None:
 *             self._c_url = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             url = _encodeFilename(url)
 */
    __pyx_v_self->_c_url = NULL;

    /* "src/lxml/parser.pxi":298
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
 *         if url is None:             # <<<<<<<<<<<<<<
 *             self._c_url = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":301
 *             self._c_url = NULL
 *         else:
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             self._c_url = _cstr(url)
 *         self._url = url
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/parser.pxi":302
 *         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:;

  /* "src/lxml/parser.pxi":303
 *             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;

  /* "src/lxml/parser.pxi":304
 *             self._c_url = _cstr(url)
 *         self._url = url
 *         self._bytes  = b''             # <<<<<<<<<<<<<<
 *         self._bytes_read = 0
 * 
 */
  __Pyx_INCREF(__pyx_kp_b__12);
  __Pyx_GIVEREF(__pyx_kp_b__12);
  __Pyx_GOTREF(__pyx_v_self->_bytes);
  __Pyx_DECREF(__pyx_v_self->_bytes);
  __pyx_v_self->_bytes = __pyx_kp_b__12;

  /* "src/lxml/parser.pxi":305
 *         self._url = url
 *         self._bytes  = b''
 *         self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _close_file(self):
 */
  __pyx_v_self->_bytes_read = 0;

  /* "src/lxml/parser.pxi":293
 *     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;
}

/* "src/lxml/parser.pxi":307
 *         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;
  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_file", 1);

  /* "src/lxml/parser.pxi":308
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  __pyx_t_2 = (__pyx_v_self->_filelike == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (!__pyx_v_self->_close_file_after_read);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":309
 *     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;

    /* "src/lxml/parser.pxi":308
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  }

  /* "src/lxml/parser.pxi":310
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/parser.pxi":311
 *             return
 *         try:
 *             close = self._filelike.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 311, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_v_close = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "src/lxml/parser.pxi":310
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/parser.pxi":312
 *         try:
 *             close = self._filelike.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(2, 312, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/parser.pxi":313
 *             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_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;
        goto __pyx_L10_exception_handled;
      }
      goto __pyx_L11_except_error;

      /* "src/lxml/parser.pxi":310
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
 */
      __pyx_L11_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_L7_error;
      __pyx_L10_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:;
    }
  }

  /* "src/lxml/parser.pxi":315
 *             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_L8;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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->_filelike);
        __Pyx_DECREF(__pyx_v_self->_filelike);
        __pyx_v_self->_filelike = 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_L8:;
  }

  /* "src/lxml/parser.pxi":316
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":317
 *             self._filelike = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 */
    __Pyx_INCREF(__pyx_v_close);
    __pyx_t_8 = __pyx_v_close; __pyx_t_6 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parser.pxi":316
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  }

  /* "src/lxml/parser.pxi":307
 *         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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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;
}

/* "src/lxml/parser.pxi":319
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
 */

static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInputBuffer *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":320
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)             # <<<<<<<<<<<<<<
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser
 */
  __pyx_v_c_buffer = xmlAllocParserInputBuffer(0);

  /* "src/lxml/parser.pxi":321
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
 */
  __pyx_t_1 = (__pyx_v_c_buffer != 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":322
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = <python.PyObject*> self
 *         return c_buffer
 */
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "src/lxml/parser.pxi":323
 *         if c_buffer:
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
 */
    __pyx_v_c_buffer->context = ((PyObject *)__pyx_v_self);

    /* "src/lxml/parser.pxi":321
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
 */
  }

  /* "src/lxml/parser.pxi":324
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*> self
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":319
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         if c_buffer:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":326
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 */

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;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":328
 *     cdef xmlparser.xmlParserInput* _createParserInput(
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         if not c_buffer:
 *             return NULL
 */
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "src/lxml/parser.pxi":329
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 */
  __pyx_t_1 = (!(__pyx_v_c_buffer != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":330
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 *             return NULL             # <<<<<<<<<<<<<<
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":329
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 */
  }

  /* "src/lxml/parser.pxi":331
 *         if not c_buffer:
 *             return NULL
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 */
  __pyx_r = xmlNewIOInputStream(__pyx_v_ctxt, __pyx_v_c_buffer, 0);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":326
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":333
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 */

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;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":334
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         if not c_buffer:
 *             return NULL
 */
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "src/lxml/parser.pxi":335
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
 */
  __pyx_t_1 = (!(__pyx_v_c_buffer != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":336
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 *             return NULL             # <<<<<<<<<<<<<<
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":335
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
 */
  }

  /* "src/lxml/parser.pxi":337
 *         if not c_buffer:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/parser.pxi":338
 *             return NULL
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:
 */
        __pyx_r = xmlIOParseDTD(NULL, __pyx_v_c_buffer, 0);
        goto __pyx_L4_return;
      }

      /* "src/lxml/parser.pxi":337
 *         if not c_buffer:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
      /*finally:*/ {
        __pyx_L4_return: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L0;
        }
      }
  }

  /* "src/lxml/parser.pxi":333
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer = self._createParserInputBuffer()
 *         if not c_buffer:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":340
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
 */

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;
  void *__pyx_v_c_callback_context;
  char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__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", 1);

  /* "src/lxml/parser.pxi":342
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self             # <<<<<<<<<<<<<<
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL
 * 
 */
  __pyx_v_c_callback_context = ((PyObject *)__pyx_v_self);

  /* "src/lxml/parser.pxi":343
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL             # <<<<<<<<<<<<<<
 * 
 *         orig_options = ctxt.options
 */
  __pyx_t_2 = (__pyx_v_self->_encoding != Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_self->_encoding;
    __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_encoding = __pyx_t_1;

  /* "src/lxml/parser.pxi":345
 *         cdef char* c_encoding = _cstr(self._encoding) if self._encoding is not None else NULL
 * 
 *         orig_options = ctxt.options             # <<<<<<<<<<<<<<
 *         with nogil:
 *             if ctxt.html:
 */
  __pyx_t_4 = __pyx_v_ctxt->options;
  __pyx_v_orig_options = __pyx_t_4;

  /* "src/lxml/parser.pxi":346
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/parser.pxi":347
 *         orig_options = ctxt.options
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 */
        if (__pyx_v_ctxt->html) {

          /* "src/lxml/parser.pxi":348
 *         with nogil:
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 */
          __pyx_v_result = htmlCtxtReadIO(__pyx_v_ctxt, __pyx_f_4lxml_5etree__readFilelikeParser, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);

          /* "src/lxml/parser.pxi":351
 *                         ctxt, _readFilelikeParser, 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);
          if (__pyx_t_2) {

            /* "src/lxml/parser.pxi":352
 *                         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);
            if (__pyx_t_2) {

              /* "src/lxml/parser.pxi":353
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                         result = NULL
 *             else:
 */
              xmlFreeDoc(__pyx_v_result);

              /* "src/lxml/parser.pxi":354
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(
 */
              __pyx_v_result = NULL;

              /* "src/lxml/parser.pxi":352
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL
 */
            }

            /* "src/lxml/parser.pxi":351
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:             # <<<<<<<<<<<<<<
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 */
          }

          /* "src/lxml/parser.pxi":347
 *         orig_options = ctxt.options
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, _readFilelikeParser, NULL, c_callback_context,
 */
          goto __pyx_L6;
        }

        /* "src/lxml/parser.pxi":356
 *                         result = NULL
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 */
        /*else*/ {

          /* "src/lxml/parser.pxi":358
 *                 result = xmlparser.xmlCtxtReadIO(
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)             # <<<<<<<<<<<<<<
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 */
          __pyx_v_result = xmlCtxtReadIO(__pyx_v_ctxt, __pyx_f_4lxml_5etree__readFilelikeParser, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);
        }
        __pyx_L6:;
      }

      /* "src/lxml/parser.pxi":346
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "src/lxml/parser.pxi":359
 *                     ctxt, _readFilelikeParser, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 *         ctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_v_ctxt->options = __pyx_v_orig_options;

  /* "src/lxml/parser.pxi":361
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/parser.pxi":362
 * 
 *         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_ERR(2, 362, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/parser.pxi":361
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
 */
      }
      __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_L17_try_end;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":363
 *         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_ERR(2, 363, __pyx_L14_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/parser.pxi":364
 *             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_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;
        goto __pyx_L13_exception_handled;
      }

      /* "src/lxml/parser.pxi":361
 *         ctxt.options = orig_options # work around libxml2 problem
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
 */
      __pyx_L14_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_L10_error;
      __pyx_L13_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_L17_try_end:;
    }
  }

  /* "src/lxml/parser.pxi":366
 *             self._exc_context._store_raised()
 *         finally:
 *             return result  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_result;
      goto __pyx_L0;
    }
    __pyx_L10_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_L20_return;
      }
      __pyx_L20_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;
    }
  }

  /* "src/lxml/parser.pxi":340
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options) noexcept:             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef void* c_callback_context = <python.PyObject*> self
 */

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

/* "src/lxml/parser.pxi":368
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copyToBuffer", 1);

  /* "src/lxml/parser.pxi":369
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:
 *         cdef int c_byte_count = 0             # <<<<<<<<<<<<<<
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 */
  __pyx_v_c_byte_count = 0;

  /* "src/lxml/parser.pxi":372
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":373
 *         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;

    /* "src/lxml/parser.pxi":372
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
 */
  }

  /* "src/lxml/parser.pxi":374
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/parser.pxi":375
 *             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;

        /* "src/lxml/parser.pxi":376
 *         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);

        /* "src/lxml/parser.pxi":377
 *             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);
          if (!__pyx_t_1) break;

          /* "src/lxml/parser.pxi":378
 *             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;

          /* "src/lxml/parser.pxi":379
 *             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
 */
          (void)(memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_remaining));

          /* "src/lxml/parser.pxi":380
 *                 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);

          /* "src/lxml/parser.pxi":381
 *                 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);

          /* "src/lxml/parser.pxi":382
 *                 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);

          /* "src/lxml/parser.pxi":384
 *                 c_requested -= remaining
 * 
 *                 self._bytes = self._filelike.read(c_requested)             # <<<<<<<<<<<<<<
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_read); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 384, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_c_requested); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 384, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = NULL;
          __pyx_t_9 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_9 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
            __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 384, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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;

          /* "src/lxml/parser.pxi":385
 * 
 *                 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_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_1 = PyBytes_Check(__pyx_t_5); 
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_10 = (!__pyx_t_1);
          if (__pyx_t_10) {

            /* "src/lxml/parser.pxi":386
 *                 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_5 = __pyx_v_self->_bytes;
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_10 = PyUnicode_Check(__pyx_t_5); 
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (likely(__pyx_t_10)) {

              /* "src/lxml/parser.pxi":387
 *                 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_10 = (__pyx_v_self->_encoding == Py_None);
              if (__pyx_t_10) {

                /* "src/lxml/parser.pxi":388
 *                     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 '%.30s'", "encode");
                  __PYX_ERR(2, 388, __pyx_L7_error)
                }
                __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_self->_bytes)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 388, __pyx_L7_error)
                __Pyx_GOTREF(__pyx_t_5);
                __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;

                /* "src/lxml/parser.pxi":387
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:             # <<<<<<<<<<<<<<
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 */
                goto __pyx_L17;
              }

              /* "src/lxml/parser.pxi":390
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 */
              /*else*/ {

                /* "src/lxml/parser.pxi":391
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 *                                 self._bytes, _cstr(self._encoding), NULL)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._close_file()
 */
                __pyx_t_5 = __pyx_v_self->_bytes;
                __Pyx_INCREF(__pyx_t_5);
                __pyx_t_6 = __pyx_v_self->_encoding;
                __Pyx_INCREF(__pyx_t_6);

                /* "src/lxml/parser.pxi":390
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 */
                __pyx_t_7 = PyUnicode_AsEncodedString(__pyx_t_5, PyBytes_AS_STRING(__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 390, __pyx_L7_error)
                __Pyx_GOTREF(__pyx_t_7);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                __Pyx_GIVEREF(__pyx_t_7);
                __Pyx_GOTREF(__pyx_v_self->_bytes);
                __Pyx_DECREF(__pyx_v_self->_bytes);
                __pyx_v_self->_bytes = __pyx_t_7;
                __pyx_t_7 = 0;
              }
              __pyx_L17:;

              /* "src/lxml/parser.pxi":386
 *                 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')
 */
              goto __pyx_L16;
            }

            /* "src/lxml/parser.pxi":393
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 *                         self._close_file()             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "reading from file-like objects must return byte strings or unicode strings"
 */
            /*else*/ {
              __pyx_t_7 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 393, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

              /* "src/lxml/parser.pxi":394
 *                     else:
 *                         self._close_file()
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "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_ERR(2, 394, __pyx_L7_error)
            }
            __pyx_L16:;

            /* "src/lxml/parser.pxi":385
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):             # <<<<<<<<<<<<<<
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
 */
          }

          /* "src/lxml/parser.pxi":397
 *                             "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_7 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_7);
          __pyx_v_remaining = PyBytes_GET_SIZE(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "src/lxml/parser.pxi":398
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
 */
          __pyx_t_10 = (__pyx_v_remaining == 0);
          if (__pyx_t_10) {

            /* "src/lxml/parser.pxi":399
 *                 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 = -1L;

            /* "src/lxml/parser.pxi":400
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 *                     self._close_file()             # <<<<<<<<<<<<<<
 *                     return c_byte_count
 *                 self._bytes_read = 0
 */
            __pyx_t_7 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 400, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "src/lxml/parser.pxi":401
 *                     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;

            /* "src/lxml/parser.pxi":398
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
 */
          }

          /* "src/lxml/parser.pxi":402
 *                     self._close_file()
 *                     return c_byte_count
 *                 self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *             if c_requested > 0:
 */
          __pyx_v_self->_bytes_read = 0;
        }

        /* "src/lxml/parser.pxi":404
 *                 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_10 = (__pyx_v_c_requested > 0);
        if (__pyx_t_10) {

          /* "src/lxml/parser.pxi":405
 * 
 *             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_7 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_7);
          __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_7) + __pyx_v_self->_bytes_read);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "src/lxml/parser.pxi":406
 *             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
 */
          (void)(memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_c_requested));

          /* "src/lxml/parser.pxi":407
 *                 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);

          /* "src/lxml/parser.pxi":408
 *                 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);

          /* "src/lxml/parser.pxi":404
 *                 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)
 */
        }

        /* "src/lxml/parser.pxi":374
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 */
      }
      __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_L12_try_end;
      __pyx_L7_error:;
      __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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/parser.pxi":409
 *                 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_7, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(2, 409, __pyx_L9_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "src/lxml/parser.pxi":410
 *                 self._bytes_read += c_requested
 *         except:
 *             c_byte_count = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             try:
 */
        __pyx_v_c_byte_count = -1;

        /* "src/lxml/parser.pxi":411
 *         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);

        /* "src/lxml/parser.pxi":412
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
 */
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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:*/ {

            /* "src/lxml/parser.pxi":413
 *             self._exc_context._store_raised()
 *             try:
 *                 self._close_file()             # <<<<<<<<<<<<<<
 *             except:
 *                 self._exc_context._store_raised()
 */
            __pyx_t_8 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 413, __pyx_L22_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "src/lxml/parser.pxi":412
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
 */
          }
          __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_L29_try_end;
          __pyx_L22_error:;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "src/lxml/parser.pxi":414
 *             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_8, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(2, 414, __pyx_L24_except_error)
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);

            /* "src/lxml/parser.pxi":415
 *                 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_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            goto __pyx_L23_exception_handled;
          }

          /* "src/lxml/parser.pxi":412
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
 */
          __pyx_L24_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_L9_except_error;
          __pyx_L23_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_L29_try_end:;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }

      /* "src/lxml/parser.pxi":374
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 */
      __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_L12_try_end:;
    }
  }

  /* "src/lxml/parser.pxi":417
 *                 self._exc_context._store_raised()
 *         finally:
 *             return c_byte_count  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
      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_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __pyx_r = __pyx_v_c_byte_count;
        goto __pyx_L32_return;
      }
      __pyx_L32_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
      }
      __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_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
    __pyx_L4_return: {
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":368
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested) noexcept:             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count = 0
 *         cdef char* c_start
 */

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

/* "src/lxml/parser.pxi":419
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept 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;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif

  /* "src/lxml/parser.pxi":420
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) noexcept 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;

  /* "src/lxml/parser.pxi":419
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) noexcept with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "src/lxml/parser.pxi":422
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) noexcept 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;

  /* "src/lxml/parser.pxi":423
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) noexcept 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;

  /* "src/lxml/parser.pxi":422
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return stdio.fread(c_buffer, 1,  c_size, <stdio.FILE*>ctxt)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":429
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) noexcept 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;
  PyObject *__pyx_v_filename = NULL;
  char *__pyx_v_c_filename;
  xmlParserInput *__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;
  int __pyx_t_9;
  const xmlChar *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_local_resolver", 0);

  /* "src/lxml/parser.pxi":438
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":439
 *     # 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;

    /* "src/lxml/parser.pxi":438
 *     # 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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":441
 *         context = <_ResolverContext>c_context._private
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *     if context is None:
 */
  /*else*/ {
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 441, __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:;

  /* "src/lxml/parser.pxi":443
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":444
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
 */
    __pyx_t_1 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":445
 *     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;

      /* "src/lxml/parser.pxi":444
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
 */
    }

    /* "src/lxml/parser.pxi":446
 *         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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":448
 *         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);
        }

        /* "src/lxml/parser.pxi":446
 *         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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/parser.pxi":449
 *             # 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;

    /* "src/lxml/parser.pxi":443
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 * 
 *     if context is None:             # <<<<<<<<<<<<<<
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 */
  }

  /* "src/lxml/parser.pxi":451
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parser.pxi":452
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_url == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":453
 *     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;

        /* "src/lxml/parser.pxi":452
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
 */
        goto __pyx_L15;
      }

      /* "src/lxml/parser.pxi":456
 *         else:
 *             # 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_2 = __pyx_f_4lxml_5etree__decodeFilename(((const xmlChar *)__pyx_v_c_url)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 456, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_url = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L15:;

      /* "src/lxml/parser.pxi":457
 *             # 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_1 = (__pyx_v_c_pubid == NULL);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":458
 *             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 = ((PyObject*)Py_None);

        /* "src/lxml/parser.pxi":457
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:             # <<<<<<<<<<<<<<
 *             pubid = None
 *         else:
 */
        goto __pyx_L16;
      }

      /* "src/lxml/parser.pxi":460
 *             pubid = None
 *         else:
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8             # <<<<<<<<<<<<<<
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 */
      /*else*/ {
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)__pyx_v_c_pubid)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 460, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_pubid = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
      }
      __pyx_L16:;

      /* "src/lxml/parser.pxi":462
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._store_raised()
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context->_resolvers), __pyx_n_s_resolve); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 462, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_url, __pyx_v_pubid, ((PyObject *)__pyx_v_context)};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 3+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 462, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__InputDocument))))) __PYX_ERR(2, 462, __pyx_L9_error)
      __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/parser.pxi":451
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
 */
    }
    __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_L9_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;

    /* "src/lxml/parser.pxi":463
 * 
 *         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_2, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 463, __pyx_L11_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/parser.pxi":464
 *         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));

      /* "src/lxml/parser.pxi":465
 *     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_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L12_except_return;
    }

    /* "src/lxml/parser.pxi":451
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
 */
    __pyx_L11_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_L12_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_L14_try_end:;
  }

  /* "src/lxml/parser.pxi":467
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":468
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 */
    switch (__pyx_v_doc_ref->_type) {
      case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

      /* "src/lxml/parser.pxi":469
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes             # <<<<<<<<<<<<<<
 *             filename = doc_ref._filename
 *             if not filename:
 */
      __pyx_t_7 = __pyx_v_doc_ref->_data_bytes;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_data = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "src/lxml/parser.pxi":470
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename             # <<<<<<<<<<<<<<
 *             if not filename:
 *                 filename = None
 */
      __pyx_t_7 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_filename = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "src/lxml/parser.pxi":471
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 *             if not filename:             # <<<<<<<<<<<<<<
 *                 filename = None
 *             elif not isinstance(filename, bytes):
 */
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 471, __pyx_L1_error)
      __pyx_t_9 = (!__pyx_t_1);
      if (__pyx_t_9) {

        /* "src/lxml/parser.pxi":472
 *             filename = doc_ref._filename
 *             if not filename:
 *                 filename = None             # <<<<<<<<<<<<<<
 *             elif not isinstance(filename, bytes):
 *                 # most likely a text URL
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

        /* "src/lxml/parser.pxi":471
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 *             if not filename:             # <<<<<<<<<<<<<<
 *                 filename = None
 *             elif not isinstance(filename, bytes):
 */
        goto __pyx_L20;
      }

      /* "src/lxml/parser.pxi":473
 *             if not filename:
 *                 filename = None
 *             elif not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 */
      __pyx_t_9 = PyBytes_Check(__pyx_v_filename); 
      __pyx_t_1 = (!__pyx_t_9);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":475
 *             elif not isinstance(filename, bytes):
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')             # <<<<<<<<<<<<<<
 *                 if not isinstance(filename, bytes):
 *                     filename = None
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 475, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = NULL;
        __pyx_t_8 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
            __pyx_t_8 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_n_u_utf8};
          __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 475, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/parser.pxi":476
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                     filename = None
 * 
 */
        __pyx_t_1 = PyBytes_Check(__pyx_v_filename); 
        __pyx_t_9 = (!__pyx_t_1);
        if (__pyx_t_9) {

          /* "src/lxml/parser.pxi":477
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):
 *                     filename = None             # <<<<<<<<<<<<<<
 * 
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

          /* "src/lxml/parser.pxi":476
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 *                 if not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                     filename = None
 * 
 */
        }

        /* "src/lxml/parser.pxi":473
 *             if not filename:
 *                 filename = None
 *             elif not isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *                 # most likely a text URL
 *                 filename = filename.encode('utf8')
 */
      }
      __pyx_L20:;

      /* "src/lxml/parser.pxi":479
 *                     filename = None
 * 
 *             c_input = xmlparser.xmlNewInputStream(c_context)             # <<<<<<<<<<<<<<
 *             if c_input is not NULL:
 *                 if filename is not None:
 */
      __pyx_v_c_input = xmlNewInputStream(__pyx_v_c_context);

      /* "src/lxml/parser.pxi":480
 * 
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                 if filename is not None:
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 */
      __pyx_t_9 = (__pyx_v_c_input != NULL);
      if (__pyx_t_9) {

        /* "src/lxml/parser.pxi":481
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 *                 if filename is not None:             # <<<<<<<<<<<<<<
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                 c_input.base = _xcstr(data)
 */
        __pyx_t_9 = (__pyx_v_filename != Py_None);
        if (__pyx_t_9) {

          /* "src/lxml/parser.pxi":482
 *             if c_input is not NULL:
 *                 if filename is not None:
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))             # <<<<<<<<<<<<<<
 *                 c_input.base = _xcstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 */
          __pyx_v_c_input->filename = ((char *)xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_filename)));

          /* "src/lxml/parser.pxi":481
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 *                 if filename is not None:             # <<<<<<<<<<<<<<
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                 c_input.base = _xcstr(data)
 */
        }

        /* "src/lxml/parser.pxi":483
 *                 if filename is not None:
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                 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);

        /* "src/lxml/parser.pxi":484
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 *                 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);

        /* "src/lxml/parser.pxi":485
 *                 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_10 = __pyx_v_c_input->base;
        __pyx_v_c_input->cur = __pyx_t_10;

        /* "src/lxml/parser.pxi":486
 *                 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);

        /* "src/lxml/parser.pxi":480
 * 
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                 if filename is not None:
 *                     c_input.filename = <char *>tree.xmlStrdup(_xcstr(filename))
 */
      }

      /* "src/lxml/parser.pxi":468
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             filename = doc_ref._filename
 */
      break;
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

      /* "src/lxml/parser.pxi":488
 *                 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;

      /* "src/lxml/parser.pxi":489
 *         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_7 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/parser.pxi":490
 *             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;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {

            /* "src/lxml/parser.pxi":492
 *             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);
          }

          /* "src/lxml/parser.pxi":490
 *             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
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L26;
            }
            __pyx_L26:;
          }
      }

      /* "src/lxml/parser.pxi":487
 *                 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)
 */
      break;
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

      /* "src/lxml/parser.pxi":496
 *         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_7 = __Pyx_PyBool_FromLong(__pyx_v_doc_ref->_close_file); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "src/lxml/parser.pxi":495
 *                     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_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_doc_ref->_file);
      __Pyx_GIVEREF(__pyx_v_doc_ref->_file);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_doc_ref->_file)) __PYX_ERR(2, 495, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_context);
      __Pyx_GIVEREF((PyObject *)__pyx_v_context);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_context))) __PYX_ERR(2, 495, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_url);
      __Pyx_GIVEREF(__pyx_v_url);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_url)) __PYX_ERR(2, 495, __pyx_L1_error);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, Py_None)) __PYX_ERR(2, 495, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_7)) __PYX_ERR(2, 495, __pyx_L1_error);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FileReaderContext), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/parser.pxi":497
 *             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);

      /* "src/lxml/parser.pxi":498
 *                                               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);

      /* "src/lxml/parser.pxi":494
 *                 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)
 */
      break;
      default:

      /* "src/lxml/parser.pxi":500
 *             data = file_context
 *         else:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_input = NULL
 * 
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_data = Py_None;

      /* "src/lxml/parser.pxi":501
 *         else:
 *             data = None
 *             c_input = NULL             # <<<<<<<<<<<<<<
 * 
 *         if data is not None:
 */
      __pyx_v_c_input = NULL;
      break;
    }

    /* "src/lxml/parser.pxi":503
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
 */
    __pyx_t_9 = (__pyx_v_data != Py_None);
    if (__pyx_t_9) {

      /* "src/lxml/parser.pxi":504
 * 
 *         if data is not None:
 *             context._storage.add(data)             # <<<<<<<<<<<<<<
 *         if c_input is not NULL:
 *             return c_input
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_context->_storage, __pyx_v_data); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(2, 504, __pyx_L1_error)

      /* "src/lxml/parser.pxi":503
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
 */
    }

    /* "src/lxml/parser.pxi":505
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
 */
    __pyx_t_9 = (__pyx_v_c_input != NULL);
    if (__pyx_t_9) {

      /* "src/lxml/parser.pxi":506
 *             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;

      /* "src/lxml/parser.pxi":505
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
 */
    }

    /* "src/lxml/parser.pxi":467
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 */
  }

  /* "src/lxml/parser.pxi":508
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  __pyx_t_9 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
  if (__pyx_t_9) {

    /* "src/lxml/parser.pxi":509
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":508
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  }

  /* "src/lxml/parser.pxi":511
 *         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;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/parser.pxi":513
 *     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);
      }

      /* "src/lxml/parser.pxi":511
 *         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
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L32;
        }
        __pyx_L32:;
      }
  }

  /* "src/lxml/parser.pxi":514
 *         # 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;

  /* "src/lxml/parser.pxi":429
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) noexcept with gil:
 *     cdef _ResolverContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._local_resolver", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 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_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "src/lxml/parser.pxi":520
 * 
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)
 */

static xmlExternalEntityLoader __pyx_f_4lxml_5etree__register_document_loader(void) {
  xmlExternalEntityLoader __pyx_v_old;
  xmlExternalEntityLoader __pyx_r;

  /* "src/lxml/parser.pxi":521
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)
 *     return old
 */
  __pyx_v_old = xmlGetExternalEntityLoader();

  /* "src/lxml/parser.pxi":522
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)             # <<<<<<<<<<<<<<
 *     return old
 * 
 */
  xmlSetExternalEntityLoader(((xmlExternalEntityLoader)__pyx_f_4lxml_5etree__local_resolver));

  /* "src/lxml/parser.pxi":523
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)
 *     return old             # <<<<<<<<<<<<<<
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:
 */
  __pyx_r = __pyx_v_old;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":520
 * 
 * 
 * cdef xmlparser.xmlExternalEntityLoader _register_document_loader() noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlExternalEntityLoader old = xmlparser.xmlGetExternalEntityLoader()
 *     xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":525
 *     return old
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(old)
 * 
 */

static void __pyx_f_4lxml_5etree__reset_document_loader(xmlExternalEntityLoader __pyx_v_old) {

  /* "src/lxml/parser.pxi":526
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:
 *     xmlparser.xmlSetExternalEntityLoader(old)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xmlSetExternalEntityLoader(__pyx_v_old);

  /* "src/lxml/parser.pxi":525
 *     return old
 * 
 * cdef void _reset_document_loader(xmlparser.xmlExternalEntityLoader old) noexcept nogil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSetExternalEntityLoader(old)
 * 
 */

  /* function exit code */
}

/* "src/lxml/parser.pxi":544
 *     cdef bint _collect_ids
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = NULL
 *         self._collect_ids = True
 */

/* 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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/parser.pxi":545
 * 
 *     def __cinit__(self):
 *         self._c_ctxt = NULL             # <<<<<<<<<<<<<<
 *         self._collect_ids = True
 *         if not config.ENABLE_THREADING:
 */
  __pyx_v_self->_c_ctxt = NULL;

  /* "src/lxml/parser.pxi":546
 *     def __cinit__(self):
 *         self._c_ctxt = NULL
 *         self._collect_ids = True             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL
 */
  __pyx_v_self->_collect_ids = 1;

  /* "src/lxml/parser.pxi":547
 *         self._c_ctxt = NULL
 *         self._collect_ids = True
 *         if not config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         else:
 */
  __pyx_t_1 = (!ENABLE_THREADING);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":548
 *         self._collect_ids = True
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 */
    __pyx_v_self->_lock = NULL;

    /* "src/lxml/parser.pxi":547
 *         self._c_ctxt = NULL
 *         self._collect_ids = True
 *         if not config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":550
 *             self._lock = NULL
 *         else:
 *             self._lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
  /*else*/ {
    __pyx_v_self->_lock = PyThread_allocate_lock();
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":551
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/parser.pxi":544
 *     cdef bint _collect_ids
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = NULL
 *         self._collect_ids = True
 */

  /* 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;
}

/* "src/lxml/parser.pxi":553
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":554
 * 
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 */
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":555
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
 */
    PyThread_free_lock(__pyx_v_self->_lock);

    /* "src/lxml/parser.pxi":556
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:
 */
    __pyx_v_self->_lock = NULL;

    /* "src/lxml/parser.pxi":554
 * 
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 */
  }

  /* "src/lxml/parser.pxi":557
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if <void*>self._validator is not NULL and self._validator is not None:
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 */
  __pyx_t_1 = (__pyx_v_self->_c_ctxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":558
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:             # <<<<<<<<<<<<<<
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 *                 # and the schema validator wasn't freed and cleaned up yet, the libxml2 SAX
 */
    __pyx_t_2 = (((void *)__pyx_v_self->_validator) != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":564
 *                 # crash when trying to xmlFree() a static SAX handler.
 *                 # Thus, make sure we disconnect the handler interceptor here at the latest.
 *                 self._validator.disconnect()             # <<<<<<<<<<<<<<
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 */
      __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self->_validator);

      /* "src/lxml/parser.pxi":558
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:
 *             if <void*>self._validator is not NULL and self._validator is not None:             # <<<<<<<<<<<<<<
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 *                 # and the schema validator wasn't freed and cleaned up yet, the libxml2 SAX
 */
    }

    /* "src/lxml/parser.pxi":565
 *                 # Thus, make sure we disconnect the handler interceptor here at the latest.
 *                 self._validator.disconnect()
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
    xmlFreeParserCtxt(__pyx_v_self->_c_ctxt);

    /* "src/lxml/parser.pxi":557
 *             python.PyThread_free_lock(self._lock)
 *             self._lock = NULL
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if <void*>self._validator is not NULL and self._validator is not None:
 *                 # If the parser was not closed correctly (e.g. interrupted iterparse()),
 */
  }

  /* "src/lxml/parser.pxi":553
 *         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 */
}

/* "src/lxml/parser.pxi":567
 *             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;
  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("_copy", 1);

  /* "src/lxml/parser.pxi":569
 *     cdef _ParserContext _copy(self):
 *         cdef _ParserContext context
 *         context = self.__class__()             # <<<<<<<<<<<<<<
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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__ParserContext))))) __PYX_ERR(2, 569, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":570
 *         cdef _ParserContext context
 *         context = self.__class__()
 *         context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 */
  __pyx_t_5 = __pyx_v_self->_collect_ids;
  __pyx_v_context->_collect_ids = __pyx_t_5;

  /* "src/lxml/parser.pxi":571
 *         context = self.__class__()
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()             # <<<<<<<<<<<<<<
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(__pyx_v_self->_validator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_context->_validator);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_validator);
  __pyx_v_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":572
 *         context._collect_ids = self._collect_ids
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(__pyx_v_self->__pyx_base._resolvers)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __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;

  /* "src/lxml/parser.pxi":573
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":567
 *             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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":575
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         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) {

  /* "src/lxml/parser.pxi":576
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         self._c_ctxt = c_ctxt             # <<<<<<<<<<<<<<
 *         c_ctxt._private = <void*>self
 * 
 */
  __pyx_v_self->_c_ctxt = __pyx_v_c_ctxt;

  /* "src/lxml/parser.pxi":577
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetParserContext(self) noexcept:
 */
  __pyx_v_c_ctxt->_private = ((void *)__pyx_v_self);

  /* "src/lxml/parser.pxi":575
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self
 */

  /* function exit code */
}

/* "src/lxml/parser.pxi":579
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":580
 * 
 *     cdef void _resetParserContext(self) noexcept:
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":581
 *     cdef void _resetParserContext(self) noexcept:
 *         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
 */
    if (__pyx_v_self->_c_ctxt->html) {

      /* "src/lxml/parser.pxi":582
 *         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
 *             else:
 */
      htmlCtxtReset(__pyx_v_self->_c_ctxt);

      /* "src/lxml/parser.pxi":583
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2             # <<<<<<<<<<<<<<
 *             else:
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 */
      __pyx_v_self->_c_ctxt->disableSAX = 0;

      /* "src/lxml/parser.pxi":581
 *     cdef void _resetParserContext(self) noexcept:
 *         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
 */
      goto __pyx_L4;
    }

    /* "src/lxml/parser.pxi":585
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             else:
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 *                 # work around bug in libxml2 [2.9.10 .. 2.9.14]:
 *                 # https://gitlab.gnome.org/GNOME/libxml2/-/issues/378
 */
    /*else*/ {
      xmlClearParserCtxt(__pyx_v_self->_c_ctxt);

      /* "src/lxml/parser.pxi":588
 *                 # work around bug in libxml2 [2.9.10 .. 2.9.14]:
 *                 # https://gitlab.gnome.org/GNOME/libxml2/-/issues/378
 *                 self._c_ctxt.nsNr = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int prepare(self, bint set_document_loader=True) except -1:
 */
      __pyx_v_self->_c_ctxt->nsNr = 0;
    }
    __pyx_L4:;

    /* "src/lxml/parser.pxi":580
 * 
 *     cdef void _resetParserContext(self) noexcept:
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 */
  }

  /* "src/lxml/parser.pxi":579
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 */

  /* function exit code */
}

/* "src/lxml/parser.pxi":590
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) 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, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args) {
  int __pyx_v_set_document_loader = ((int)1);
  int __pyx_v_result;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlExternalEntityLoader __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_set_document_loader = __pyx_optional_args->set_document_loader;
    }
  }

  /* "src/lxml/parser.pxi":592
 *     cdef int prepare(self, bint set_document_loader=True) 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) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":593
 *         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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":594
 *         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);
        }

        /* "src/lxml/parser.pxi":593
 *         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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/parser.pxi":596
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
 */
    __pyx_t_1 = (__pyx_v_result == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/parser.pxi":597
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise ParserError, "parser locking failed"             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 *         self._doc = None
 */
      __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_ParserError), __pyx_kp_u_parser_locking_failed, 0, 0);
      __PYX_ERR(2, 597, __pyx_L1_error)

      /* "src/lxml/parser.pxi":596
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
 */
    }

    /* "src/lxml/parser.pxi":592
 *     cdef int prepare(self, bint set_document_loader=True) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 */
  }

  /* "src/lxml/parser.pxi":598
 *             if result == 0:
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 *         self._doc = None
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
  __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_ERR(2, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":599
 *                 raise ParserError, "parser locking failed"
 *         self._error_log.clear()
 *         self._doc = None             # <<<<<<<<<<<<<<
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/parser.pxi":601
 *         self._doc = None
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError             # <<<<<<<<<<<<<<
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:
 */
  __pyx_v_self->_c_ctxt->sax->serror = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveParserError);

  /* "src/lxml/parser.pxi":602
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)
 */
  if (__pyx_v_set_document_loader) {
    __pyx_t_4 = __pyx_f_4lxml_5etree__register_document_loader();
  } else {
    __pyx_t_4 = NULL;
  }
  __pyx_v_self->_orig_loader = __pyx_t_4;

  /* "src/lxml/parser.pxi":603
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":604
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         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_5 = __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_5 == ((int)-1))) __PYX_ERR(2, 604, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":603
 *         self._c_ctxt.sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *         self._orig_loader = _register_document_loader() if set_document_loader else NULL
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0
 */
  }

  /* "src/lxml/parser.pxi":605
 *         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;

  /* "src/lxml/parser.pxi":590
 *                 self._c_ctxt.nsNr = 0
 * 
 *     cdef int prepare(self, bint set_document_loader=True) 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;
}

/* "src/lxml/parser.pxi":607
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
 */

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;
  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("cleanup", 1);

  /* "src/lxml/parser.pxi":608
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:             # <<<<<<<<<<<<<<
 *             _reset_document_loader(self._orig_loader)
 *         try:
 */
  __pyx_t_1 = (__pyx_v_self->_orig_loader != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":609
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)             # <<<<<<<<<<<<<<
 *         try:
 *             if self._validator is not None:
 */
    __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_self->_orig_loader);

    /* "src/lxml/parser.pxi":608
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._orig_loader is not NULL:             # <<<<<<<<<<<<<<
 *             _reset_document_loader(self._orig_loader)
 *         try:
 */
  }

  /* "src/lxml/parser.pxi":610
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
 *         try:             # <<<<<<<<<<<<<<
 *             if self._validator is not None:
 *                 self._validator.disconnect()
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":611
 *             _reset_document_loader(self._orig_loader)
 *         try:
 *             if self._validator is not None:             # <<<<<<<<<<<<<<
 *                 self._validator.disconnect()
 *             self._resetParserContext()
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":612
 *         try:
 *             if self._validator is not None:
 *                 self._validator.disconnect()             # <<<<<<<<<<<<<<
 *             self._resetParserContext()
 *             self.clear()
 */
      __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self->_validator);

      /* "src/lxml/parser.pxi":611
 *             _reset_document_loader(self._orig_loader)
 *         try:
 *             if self._validator is not None:             # <<<<<<<<<<<<<<
 *                 self._validator.disconnect()
 *             self._resetParserContext()
 */
    }

    /* "src/lxml/parser.pxi":613
 *             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);

    /* "src/lxml/parser.pxi":614
 *                 self._validator.disconnect()
 *             self._resetParserContext()
 *             self.clear()             # <<<<<<<<<<<<<<
 *             self._doc = None
 *             self._c_ctxt.sax.serror = NULL
 */
    __pyx_t_2 = ((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)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 614, __pyx_L5_error)

    /* "src/lxml/parser.pxi":615
 *             self._resetParserContext()
 *             self.clear()
 *             self._doc = None             # <<<<<<<<<<<<<<
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
    __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

    /* "src/lxml/parser.pxi":616
 *             self.clear()
 *             self._doc = None
 *             self._c_ctxt.sax.serror = NULL             # <<<<<<<<<<<<<<
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:
 */
    __pyx_v_self->_c_ctxt->sax->serror = NULL;
  }

  /* "src/lxml/parser.pxi":618
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 0
 */
  /*finally:*/ {
    /*normal exit:*/{
      if (ENABLE_THREADING) {
      } else {
        __pyx_t_1 = ENABLE_THREADING;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_self->_lock != NULL);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":619
 *         finally:
 *             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);

        /* "src/lxml/parser.pxi":618
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 0
 */
      }
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 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;
      {
        if (ENABLE_THREADING) {
        } else {
          __pyx_t_1 = ENABLE_THREADING;
          goto __pyx_L14_bool_binop_done;
        }
        __pyx_t_3 = (__pyx_v_self->_lock != NULL);
        __pyx_t_1 = __pyx_t_3;
        __pyx_L14_bool_binop_done:;
        if (__pyx_t_1) {

          /* "src/lxml/parser.pxi":619
 *         finally:
 *             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);

          /* "src/lxml/parser.pxi":618
 *             self._c_ctxt.sax.serror = NULL
 *         finally:
 *             if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_release_lock(self._lock)
 *         return 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_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/parser.pxi":620
 *             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;

  /* "src/lxml/parser.pxi":607
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._orig_loader is not NULL:
 *             _reset_document_loader(self._orig_loader)
 */

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

/* "src/lxml/parser.pxi":622
 *         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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 1);

  /* "src/lxml/parser.pxi":624
 *     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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":625
 *                                    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_3 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->_doc->_c_doc == __pyx_v_c_doc);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":626
 *         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;

    /* "src/lxml/parser.pxi":625
 *                                    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:
 */
  }

  /* "src/lxml/parser.pxi":628
 *             return self._doc
 *         else:
 *             return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":622
 *         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_4);
  __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;
}

/* "src/lxml/parser.pxi":630
 *             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;
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":632
 *     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);

  /* "src/lxml/parser.pxi":635
 *         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);

  /* "src/lxml/parser.pxi":633
 *                                        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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 633, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":630
 *             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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":637
 *                                   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", 1);

  /* "src/lxml/parser.pxi":640
 *                         _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_ERR(2, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":641
 *                         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);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":642
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept 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);

    /* "src/lxml/parser.pxi":641
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *         context._initParserContext(c_ctxt)
 * 
 */
  }

  /* "src/lxml/parser.pxi":637
 *                                   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;
}

/* "src/lxml/parser.pxi":644
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 */

static void __pyx_f_4lxml_5etree__forwardParserError(xmlParserCtxt *__pyx_v__parser_context, xmlError const *__pyx_v_error) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif

  /* "src/lxml/parser.pxi":645
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 */
  __pyx_t_1 = __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); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 645, __pyx_L1_error)

  /* "src/lxml/parser.pxi":644
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._forwardParserError", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/parser.pxi":647
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept 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 const *__pyx_v_error) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parser.pxi":649
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:             # <<<<<<<<<<<<<<
 *             _forwardError(NULL, error)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_c_context == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((xmlParserCtxt *)__pyx_v_c_context)->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":650
 *     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);

    /* "src/lxml/parser.pxi":649
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:             # <<<<<<<<<<<<<<
 *             _forwardError(NULL, error)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":652
 *             _forwardError(NULL, error)
 *         else:
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)             # <<<<<<<<<<<<<<
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 */
  /*else*/ {
    __pyx_f_4lxml_5etree__forwardParserError(((xmlParserCtxt *)__pyx_v_c_context), __pyx_v_error);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":647
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
 */

  /* function exit code */
}

/* "src/lxml/parser.pxi":654
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except -1:
 *     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;
  const xmlChar *__pyx_t_3;
  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;
  char *__pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_UCS4 __pyx_t_14;
  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("_raiseParseError", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "src/lxml/parser.pxi":656
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 */
  __pyx_t_2 = (__pyx_v_filename != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":657
 *                           _ErrorLog error_log) except -1:
 *     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);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parser.pxi":656
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 */
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":658
 *     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_1 = PyBytes_Check(__pyx_v_filename); 
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":660
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.message is not NULL:
 *             try:
 */
      if (unlikely(__pyx_v_filename == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(2, 660, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyBytes_AsUString(__pyx_v_filename); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(2, 660, __pyx_L1_error)
      if (unlikely(__pyx_v_filename == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(2, 660, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 660, __pyx_L1_error)

      /* "src/lxml/parser.pxi":659
 *            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_5 = __pyx_f_4lxml_5etree__decodeFilenameWithLength(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":658
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 */
    }

    /* "src/lxml/parser.pxi":661
 *             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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":662
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/parser.pxi":663
 *         if ctxt.lastError.message is not NULL:
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play it safe
 */
          __pyx_t_9 = __pyx_v_ctxt->lastError.message;
          __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 663, __pyx_L8_error)
          __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 663, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_message = __pyx_t_5;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/parser.pxi":662
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
 */
        }
        __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_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/parser.pxi":664
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')
 */
        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_10) {
          __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_12) < 0) __PYX_ERR(2, 664, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);

          /* "src/lxml/parser.pxi":666
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')             # <<<<<<<<<<<<<<
 *             message = f"Error reading file '{filename}': {message.strip()}"
 *         else:
 */
          __pyx_t_9 = __pyx_v_ctxt->lastError.message;
          __pyx_t_4 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 666, __pyx_L10_except_error)
          __pyx_t_13 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 666, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L9_exception_handled;
        }
        goto __pyx_L10_except_error;

        /* "src/lxml/parser.pxi":662
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = ctxt.lastError.message.decode('utf-8')
 *             except UnicodeDecodeError:
 */
        __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_L13_try_end:;
      }

      /* "src/lxml/parser.pxi":667
 *                 # the filename may be in there => play it safe
 *                 message = ctxt.lastError.message.decode('iso8859-1')
 *             message = f"Error reading file '{filename}': {message.strip()}"             # <<<<<<<<<<<<<<
 *         else:
 *             message = f"Error reading '{filename}'"
 */
      __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_4 = 0;
      __pyx_t_14 = 127;
      __Pyx_INCREF(__pyx_kp_u_Error_reading_file);
      __pyx_t_4 += 20;
      __Pyx_GIVEREF(__pyx_kp_u_Error_reading_file);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u_Error_reading_file);
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_14;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_INCREF(__pyx_kp_u__57);
      __pyx_t_4 += 3;
      __Pyx_GIVEREF(__pyx_kp_u__57);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u__57);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_13 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
        __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_14;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, __pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":661
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 message = ctxt.lastError.message.decode('utf-8')
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":669
 *             message = f"Error reading file '{filename}': {message.strip()}"
 *         else:
 *             message = f"Error reading '{filename}'"             # <<<<<<<<<<<<<<
 *         raise IOError, message
 *     elif error_log:
 */
    /*else*/ {
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_14 = 127;
      __Pyx_INCREF(__pyx_kp_u_Error_reading);
      __pyx_t_4 += 15;
      __Pyx_GIVEREF(__pyx_kp_u_Error_reading);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Error_reading);
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_14;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_4 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__25);
      __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_message = __pyx_t_12;
      __pyx_t_12 = 0;
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":670
 *         else:
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message             # <<<<<<<<<<<<<<
 *     elif error_log:
 *         raise error_log._buildParseException(
 */
    __Pyx_Raise(__pyx_builtin_IOError, __pyx_v_message, 0, 0);
    __PYX_ERR(2, 670, __pyx_L1_error)

    /* "src/lxml/parser.pxi":656
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 */
  }

  /* "src/lxml/parser.pxi":671
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_error_log)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 671, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":673
 *     elif error_log:
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")             # <<<<<<<<<<<<<<
 *     elif ctxt.lastError.message is not NULL:
 *         message = ctxt.lastError.message.strip()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "src/lxml/parser.pxi":672
 *         raise IOError, message
 *     elif error_log:
 *         raise error_log._buildParseException(             # <<<<<<<<<<<<<<
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
 */
    __pyx_t_5 = __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_5)) __PYX_ERR(2, 672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(2, 672, __pyx_L1_error)

    /* "src/lxml/parser.pxi":671
 *             message = f"Error reading '{filename}'"
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
 */
  }

  /* "src/lxml/parser.pxi":674
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "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);
  if (likely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":675
 *             XMLSyntaxError, "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_12 = __Pyx_PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_strip); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 675, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __pyx_v_message = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":676
 *     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_10 = __pyx_v_ctxt->lastError.code;
    __pyx_v_code = __pyx_t_10;

    /* "src/lxml/parser.pxi":677
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line             # <<<<<<<<<<<<<<
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 */
    __pyx_t_10 = __pyx_v_ctxt->lastError.line;
    __pyx_v_line = __pyx_t_10;

    /* "src/lxml/parser.pxi":678
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"
 */
    __pyx_t_10 = __pyx_v_ctxt->lastError.int2;
    __pyx_v_column = __pyx_t_10;

    /* "src/lxml/parser.pxi":679
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)
 */
    __pyx_t_1 = (__pyx_v_ctxt->lastError.line > 0);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":680
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"             # <<<<<<<<<<<<<<
 *         raise XMLSyntaxError(message, code, line, column, filename)
 *     else:
 */
      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_14 = 127;
      __Pyx_INCREF(__pyx_kp_u_line_3);
      __pyx_t_4 += 5;
      __Pyx_GIVEREF(__pyx_kp_u_line_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_line_3);
      __pyx_t_11 = __Pyx_PyUnicode_From_int(__pyx_v_line, 0, ' ', 'd'); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_INCREF(__pyx_kp_u__20);
      __pyx_t_4 += 2;
      __Pyx_GIVEREF(__pyx_kp_u__20);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__20);
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_14;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "src/lxml/parser.pxi":679
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)
 */
    }

    /* "src/lxml/parser.pxi":681
 *         if ctxt.lastError.line > 0:
 *             message = f"line {line}: {message}"
 *         raise XMLSyntaxError(message, code, line, column, filename)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_column); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_16, __pyx_v_message, __pyx_t_12, __pyx_t_13, __pyx_t_15, __pyx_v_filename};
      __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 5+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_Raise(__pyx_t_11, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(2, 681, __pyx_L1_error)

    /* "src/lxml/parser.pxi":674
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, "Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *         message = ctxt.lastError.message.strip()
 *         code = ctxt.lastError.code
 */
  }

  /* "src/lxml/parser.pxi":683
 *         raise XMLSyntaxError(message, code, line, column, filename)
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,             # <<<<<<<<<<<<<<
 *                              filename)
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyInt_From_xmlParserErrors(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);

    /* "src/lxml/parser.pxi":684
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                              filename)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,
 */
    __pyx_t_13 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_13, Py_None, __pyx_t_15, __pyx_int_0, __pyx_int_0, __pyx_v_filename};
      __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 5+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_Raise(__pyx_t_11, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(2, 683, __pyx_L1_error)
  }

  /* "src/lxml/parser.pxi":654
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except -1:
 *     if filename is not None and \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":686
 *                              filename)
 * 
 * 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;
  PyObject *__pyx_9genexpr10__pyx_v_error = 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;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 1);

  /* "src/lxml/parser.pxi":691
 *                                 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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":692
 *     cdef bint well_formed
 *     if result is not NULL:
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 * 
 *     if c_ctxt.myDoc is not NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)

    /* "src/lxml/parser.pxi":691
 *                                 bint recover, bint free_doc) except NULL:
 *     cdef bint well_formed
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 */
  }

  /* "src/lxml/parser.pxi":694
 *         __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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":695
 * 
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":696
 *     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_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_c_ctxt->myDoc); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)

      /* "src/lxml/parser.pxi":697
 *         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);

      /* "src/lxml/parser.pxi":695
 * 
 *     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)
 */
    }

    /* "src/lxml/parser.pxi":698
 *             __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;

    /* "src/lxml/parser.pxi":694
 *         __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)
 */
  }

  /* "src/lxml/parser.pxi":700
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":701
 * 
 *     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_3 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":702
 *     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 (not c_ctxt.wellFormed and not c_ctxt.html and
 */
    __pyx_t_3 = (!__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->_validator));
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;

    /* "src/lxml/parser.pxi":701
 * 
 *     if result is not NULL:
 *         if (context._validator is not None and             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 */
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":703
 *         if (context._validator is not None and
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...             # <<<<<<<<<<<<<<
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 */
      __pyx_v_well_formed = 0;

      /* "src/lxml/parser.pxi":701
 * 
 *     if result is not NULL:
 *         if (context._validator is not None and             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":704
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
 */
    __pyx_t_3 = (!__pyx_v_c_ctxt->wellFormed);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_3 = (!__pyx_v_c_ctxt->html);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":705
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and             # <<<<<<<<<<<<<<
 *                 [1 for error in context._error_log
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
 */
    __pyx_t_3 = (__pyx_v_c_ctxt->charset == XML_CHAR_ENCODING_8859_1);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":706
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log             # <<<<<<<<<<<<<<
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
 *             # An encoding error occurred and libxml2 switched from UTF-8
 */
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 706, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(((PyObject *)__pyx_v_context->_error_log))) || PyTuple_CheckExact(((PyObject *)__pyx_v_context->_error_log))) {
        __pyx_t_5 = ((PyObject *)__pyx_v_context->_error_log); __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_context->_error_log)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 706, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 706, __pyx_L16_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 706, __pyx_L16_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(2, 706, __pyx_L16_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 706, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 706, __pyx_L16_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(2, 706, __pyx_L16_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 706, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_8);
            #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(2, 706, __pyx_L16_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_error, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/parser.pxi":707
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):             # <<<<<<<<<<<<<<
 *             # An encoding error occurred and libxml2 switched from UTF-8
 *             # input to (undecoded) Latin-1, at some arbitrary point in the
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr10__pyx_v_error, __pyx_n_s_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 707, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 707, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ERR_INVALID_CHAR); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 707, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 707, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 707, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_int_1))) __PYX_ERR(2, 706, __pyx_L16_error)
        }

        /* "src/lxml/parser.pxi":706
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log             # <<<<<<<<<<<<<<
 *                  if error.type == ErrorTypes.ERR_INVALID_CHAR]):
 *             # An encoding error occurred and libxml2 switched from UTF-8
 */
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_error); __pyx_9genexpr10__pyx_v_error = 0;
      goto __pyx_L21_exit_scope;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_error); __pyx_9genexpr10__pyx_v_error = 0;
      goto __pyx_L1_error;
      __pyx_L21_exit_scope:;
    } /* exit inner scope */
    __pyx_t_3 = (PyList_GET_SIZE(__pyx_t_4) != 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L10_bool_binop_done:;

    /* "src/lxml/parser.pxi":704
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
 */
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":712
 *             # document.  Better raise an error than allowing for a broken
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0             # <<<<<<<<<<<<<<
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 */
      __pyx_v_well_formed = 0;

      /* "src/lxml/parser.pxi":704
 *                 not context._validator.isvalid()):
 *             well_formed = 0  # actually not 'valid', but anyway ...
 *         elif (not c_ctxt.wellFormed and not c_ctxt.html and             # <<<<<<<<<<<<<<
 *                 c_ctxt.charset == tree.XML_CHAR_ENCODING_8859_1 and
 *                 [1 for error in context._error_log
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":713
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 */
    if (!__pyx_v_recover) {
    } else {
      __pyx_t_1 = __pyx_v_recover;
      goto __pyx_L22_bool_binop_done;
    }
    if (__pyx_v_c_ctxt->wellFormed) {
    } else {
      __pyx_t_1 = __pyx_v_c_ctxt->wellFormed;
      goto __pyx_L22_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":714
 *             well_formed = 0
 *         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);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L22_bool_binop_done:;

    /* "src/lxml/parser.pxi":713
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 */
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":715
 *         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;

      /* "src/lxml/parser.pxi":713
 *             # tree with mixed encodings. This is fixed in libxml2 2.12.
 *             well_formed = 0
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":716
 *                          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);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L25_bool_binop_done;
    }

    /* "src/lxml/parser.pxi":717
 *             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_3 = (!__pyx_v_c_ctxt->validate);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L25_bool_binop_done:;

    /* "src/lxml/parser.pxi":716
 *                          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
 */
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":719
 *                  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_ERR(2, 719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      __pyx_t_2 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_2 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_2, 0+__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 719, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 719, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(2, 719, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 719, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 719, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(2, 719, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 719, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_7(__pyx_t_5);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(2, 719, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_error, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/parser.pxi":720
 *             # 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 720, __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_ERR(2, 720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 720, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 720, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {
        } else {
          __pyx_t_1 = __pyx_t_3;
          goto __pyx_L31_bool_binop_done;
        }

        /* "src/lxml/parser.pxi":721
 *             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_ERR(2, 721, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 721, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 721, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 721, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(2, 721, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_1 = __pyx_t_3;
        __pyx_L31_bool_binop_done:;

        /* "src/lxml/parser.pxi":720
 *             # 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
 */
        if (__pyx_t_1) {

          /* "src/lxml/parser.pxi":722
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_v_well_formed = 0;

          /* "src/lxml/parser.pxi":723
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 well_formed = 1
 */
          goto __pyx_L29_break;

          /* "src/lxml/parser.pxi":720
 *             # 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
 */
        }

        /* "src/lxml/parser.pxi":719
 *                  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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L33_for_else;
      __pyx_L29_break:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L34_for_end;
      /*else*/ {
        __pyx_L33_for_else:;

        /* "src/lxml/parser.pxi":725
 *                     break
 *             else:
 *                 well_formed = 1             # <<<<<<<<<<<<<<
 *         else:
 *             well_formed = 0
 */
        __pyx_v_well_formed = 1;
      }
      __pyx_L34_for_end:;

      /* "src/lxml/parser.pxi":716
 *                          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
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":727
 *                 well_formed = 1
 *         else:
 *             well_formed = 0             # <<<<<<<<<<<<<<
 * 
 *         if not well_formed:
 */
    /*else*/ {
      __pyx_v_well_formed = 0;
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":729
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    __pyx_t_1 = (!__pyx_v_well_formed);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":730
 * 
 *         if not well_formed:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      if (__pyx_v_free_doc) {

        /* "src/lxml/parser.pxi":731
 *         if not well_formed:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 * 
 */
        xmlFreeDoc(__pyx_v_result);

        /* "src/lxml/parser.pxi":730
 * 
 *         if not well_formed:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      }

      /* "src/lxml/parser.pxi":732
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 * 
 *     if context is not None and context._has_raised():
 */
      __pyx_v_result = NULL;

      /* "src/lxml/parser.pxi":729
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    }

    /* "src/lxml/parser.pxi":700
 *         c_ctxt.myDoc = NULL
 * 
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         if (context._validator is not None and
 *                 not context._validator.isvalid()):
 */
  }

  /* "src/lxml/parser.pxi":734
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             if free_doc:
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L38_bool_binop_done;
  }
  __pyx_t_3 = ((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)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 734, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L38_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":735
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    __pyx_t_1 = (__pyx_v_result != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":736
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      if (__pyx_v_free_doc) {

        /* "src/lxml/parser.pxi":737
 *         if result is not NULL:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 *         context._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_result);

        /* "src/lxml/parser.pxi":736
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      }

      /* "src/lxml/parser.pxi":738
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 *         context._raise_if_stored()
 * 
 */
      __pyx_v_result = NULL;

      /* "src/lxml/parser.pxi":735
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    }

    /* "src/lxml/parser.pxi":739
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 *         context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if result is NULL:
 */
    __pyx_t_2 = ((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_2 == ((int)-1))) __PYX_ERR(2, 739, __pyx_L1_error)

    /* "src/lxml/parser.pxi":734
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             if free_doc:
 */
  }

  /* "src/lxml/parser.pxi":741
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 */
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":742
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":743
 *     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_2 = __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_2 == ((int)-1))) __PYX_ERR(2, 743, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/parser.pxi":742
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 */
      goto __pyx_L43;
    }

    /* "src/lxml/parser.pxi":745
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)             # <<<<<<<<<<<<<<
 *     else:
 *         if result.URL is NULL and filename is not None:
 */
    /*else*/ {
      __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 745, __pyx_L1_error)
    }
    __pyx_L43:;

    /* "src/lxml/parser.pxi":741
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 */
    goto __pyx_L42;
  }

  /* "src/lxml/parser.pxi":747
 *             _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:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_result->URL == NULL);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L45_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_filename != Py_None);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L45_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":748
 *     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));

      /* "src/lxml/parser.pxi":747
 *             _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:
 */
    }

    /* "src/lxml/parser.pxi":749
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":750
 *             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 *)((char const *)"UTF-8"))));

      /* "src/lxml/parser.pxi":749
 *         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_L42:;

  /* "src/lxml/parser.pxi":752
 *             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_3 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L49_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":753
 * 
 *     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_1 = __pyx_v_context->_validator->_add_default_attributes;
  __pyx_L49_bool_binop_done:;

  /* "src/lxml/parser.pxi":752
 *             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
 */
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":757
 *         # 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);

    /* "src/lxml/parser.pxi":752
 *             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
 */
  }

  /* "src/lxml/parser.pxi":759
 *         context._validator.inject_default_attributes(result)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":686
 *                              filename)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_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_XDECREF(__pyx_9genexpr10__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":761
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept 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;

  /* "src/lxml/parser.pxi":763
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept 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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":764
 *     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;

    /* "src/lxml/parser.pxi":763
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node = c_doc.children
 */
  }

  /* "src/lxml/parser.pxi":765
 *     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;

  /* "src/lxml/parser.pxi":766
 *         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);

  /* "src/lxml/parser.pxi":767
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":768
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":769
 *     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;

      /* "src/lxml/parser.pxi":768
 *     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)
 */
    }

    /* "src/lxml/parser.pxi":767
 *     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
 */
  }

  /* "src/lxml/parser.pxi":770
 *         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);

  /* "src/lxml/parser.pxi":771
 *             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;

  /* "src/lxml/parser.pxi":761
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) noexcept nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":773
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) noexcept 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;

  /* "src/lxml/parser.pxi":780
 *     """
 *     cdef xmlNode* c_node
 *     if not c_doc:             # <<<<<<<<<<<<<<
 *         return 0
 *     if not c_start_node:
 */
  __pyx_t_1 = (!(__pyx_v_c_doc != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":781
 *     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;

    /* "src/lxml/parser.pxi":780
 *     """
 *     cdef xmlNode* c_node
 *     if not c_doc:             # <<<<<<<<<<<<<<
 *         return 0
 *     if not c_start_node:
 */
  }

  /* "src/lxml/parser.pxi":782
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":783
 *         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;

    /* "src/lxml/parser.pxi":782
 *     if not c_doc:
 *         return 0
 *     if not c_start_node:             # <<<<<<<<<<<<<<
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
 */
  }

  /* "src/lxml/parser.pxi":784
 *     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;

  /* "src/lxml/parser.pxi":785
 *         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);

  /* "src/lxml/parser.pxi":786
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":787
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":788
 *     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;

      /* "src/lxml/parser.pxi":787
 *     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)
 */
    }

    /* "src/lxml/parser.pxi":786
 *     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
 */
  }

  /* "src/lxml/parser.pxi":789
 *         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);

  /* "src/lxml/parser.pxi":790
 *             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;

  /* "src/lxml/parser.pxi":773
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) noexcept nogil:
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":792
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) noexcept 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;

  /* "src/lxml/parser.pxi":795
 *                                       xmlNode* c_node) noexcept 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);

  /* "src/lxml/parser.pxi":796
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":797
 *     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;

    /* "src/lxml/parser.pxi":796
 *     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:
 */
  }

  /* "src/lxml/parser.pxi":798
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":799
 *         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));

    /* "src/lxml/parser.pxi":800
 *     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;

    /* "src/lxml/parser.pxi":798
 *     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
 */
  }

  /* "src/lxml/parser.pxi":801
 *         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);

  /* "src/lxml/parser.pxi":802
 *         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);
    if (!__pyx_t_1) break;

    /* "src/lxml/parser.pxi":803
 *     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);

    /* "src/lxml/parser.pxi":804
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":805
 *         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;

      /* "src/lxml/parser.pxi":804
 *     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:
 */
    }

    /* "src/lxml/parser.pxi":806
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":807
 *             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));

      /* "src/lxml/parser.pxi":808
 *         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;

      /* "src/lxml/parser.pxi":806
 *         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
 */
    }

    /* "src/lxml/parser.pxi":809
 *             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;
  }

  /* "src/lxml/parser.pxi":810
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":792
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) noexcept nogil:
 *     cdef xmlNode* c_attr
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":832
 *     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, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
 */

/* 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_collect_ids = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_resolve_external_entities;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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_collect_ids,&__pyx_n_s_target,&__pyx_n_s_encoding,&__pyx_n_s_resolve_external_entities,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case 10: values[9] = __Pyx_Arg_VARARGS(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_VARARGS(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_VARARGS(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_VARARGS(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parse_options)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_for_html)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 1); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_schema)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 2); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_remove_comments)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 3); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_remove_pis)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 4); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strip_cdata)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 5); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_collect_ids)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[6]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 6); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[7]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 7); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[8]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, 8); __PYX_ERR(2, 832, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_resolve_external_entities);
          if (value) { values[9] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(2, 832, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case 10: values[9] = __Pyx_Arg_VARARGS(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_VARARGS(__pyx_args, 8);
        values[7] = __Pyx_Arg_VARARGS(__pyx_args, 7);
        values[6] = __Pyx_Arg_VARARGS(__pyx_args, 6);
        values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parse_options = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_parse_options == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 832, __pyx_L3_error)
    __pyx_v_for_html = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_for_html == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 832, __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_collect_ids = values[6];
    __pyx_v_target = values[7];
    __pyx_v_encoding = values[8];
    if (values[9]) {
      __pyx_v_resolve_external_entities = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_resolve_external_entities == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 834, __pyx_L3_error)
    } else {

      /* "src/lxml/parser.pxi":834
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,
 *                  remove_comments, remove_pis, strip_cdata, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 */
      __pyx_v_resolve_external_entities = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 9, 10, __pyx_nargs); __PYX_ERR(2, 832, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 832, __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_collect_ids, __pyx_v_target, __pyx_v_encoding, __pyx_v_resolve_external_entities);

  /* "src/lxml/parser.pxi":832
 *     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, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding, int __pyx_v_resolve_external_entities) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __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_encoding);

  /* "src/lxml/parser.pxi":837
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):             # <<<<<<<<<<<<<<
 *             raise TypeError, "This class cannot be instantiated"
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_4lxml_5etree_XMLParser); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), __pyx_ptype_4lxml_5etree_HTMLParser); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/parser.pxi":838
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):
 *             raise TypeError, "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_ERR(2, 838, __pyx_L1_error)

    /* "src/lxml/parser.pxi":837
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):             # <<<<<<<<<<<<<<
 *             raise TypeError, "This class cannot be instantiated"
 * 
 */
  }

  /* "src/lxml/parser.pxi":840
 *             raise TypeError, "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;

  /* "src/lxml/parser.pxi":841
 * 
 *         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;

  /* "src/lxml/parser.pxi":842
 *         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;

  /* "src/lxml/parser.pxi":843
 *         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_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_comments); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 843, __pyx_L1_error)
  __pyx_v_self->_remove_comments = __pyx_t_2;

  /* "src/lxml/parser.pxi":844
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis             # <<<<<<<<<<<<<<
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_pis); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 844, __pyx_L1_error)
  __pyx_v_self->_remove_pis = __pyx_t_2;

  /* "src/lxml/parser.pxi":845
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata             # <<<<<<<<<<<<<<
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 845, __pyx_L1_error)
  __pyx_v_self->_strip_cdata = __pyx_t_2;

  /* "src/lxml/parser.pxi":846
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids             # <<<<<<<<<<<<<<
 *         self._resolve_external_entities = resolve_external_entities
 *         self._schema = schema
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_collect_ids); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 846, __pyx_L1_error)
  __pyx_v_self->_collect_ids = __pyx_t_2;

  /* "src/lxml/parser.pxi":847
 *         self._strip_cdata = strip_cdata
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities             # <<<<<<<<<<<<<<
 *         self._schema = schema
 * 
 */
  __pyx_v_self->_resolve_external_entities = __pyx_v_resolve_external_entities;

  /* "src/lxml/parser.pxi":848
 *         self._collect_ids = collect_ids
 *         self._resolve_external_entities = resolve_external_entities
 *         self._schema = schema             # <<<<<<<<<<<<<<
 * 
 *         self._resolvers = _ResolverRegistry()
 */
  __Pyx_INCREF((PyObject *)__pyx_v_schema);
  __Pyx_GIVEREF((PyObject *)__pyx_v_schema);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_schema);
  __pyx_v_self->_schema = __pyx_v_schema;

  /* "src/lxml/parser.pxi":850
 *         self._schema = schema
 * 
 *         self._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 * 
 *         if encoding is None:
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_resolvers);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_resolvers);
  __pyx_v_self->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":852
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":853
 * 
 *         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;

    /* "src/lxml/parser.pxi":852
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/parser.pxi":855
 *             self._default_encoding = None
 *         else:
 *             encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":856
 *         else:
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))             # <<<<<<<<<<<<<<
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 */
    __pyx_v_enchandler = xmlFindCharEncodingHandler(PyBytes_AS_STRING(__pyx_v_encoding));

    /* "src/lxml/parser.pxi":857
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)
 */
    __pyx_t_2 = (__pyx_v_enchandler == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "src/lxml/parser.pxi":858
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"             # <<<<<<<<<<<<<<
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding
 */
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_unknown_encoding);
      __pyx_t_4 += 19;
      __Pyx_GIVEREF(__pyx_kp_u_unknown_encoding);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_unknown_encoding);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_encoding, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_4 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__25);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(2, 858, __pyx_L1_error)

      /* "src/lxml/parser.pxi":857
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)
 */
    }

    /* "src/lxml/parser.pxi":859
 *             if enchandler is NULL:
 *                 raise LookupError, f"unknown encoding: '{encoding}'"
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *             self._default_encoding = encoding
 * 
 */
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/parser.pxi":860
 *                 raise LookupError, f"unknown encoding: '{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_L6:;

  /* "src/lxml/parser.pxi":832
 *     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, collect_ids,
 *                  target, encoding, bint resolve_external_entities=True):
 */

  /* 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._BaseParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":862
 *             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", 1);

  /* "src/lxml/parser.pxi":863
 * 
 *     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_ERR(2, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(2, 863, __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;

  /* "src/lxml/parser.pxi":862
 *             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;
}

/* "src/lxml/parser.pxi":865
 *         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;
  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("_collectEvents", 0);
  __Pyx_INCREF(__pyx_v_event_types);

  /* "src/lxml/parser.pxi":866
 * 
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:             # <<<<<<<<<<<<<<
 *             event_types = ()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_event_types == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":867
 *     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);

    /* "src/lxml/parser.pxi":866
 * 
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:             # <<<<<<<<<<<<<<
 *             event_types = ()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":869
 *             event_types = ()
 *         else:
 *             event_types = tuple(set(event_types))             # <<<<<<<<<<<<<<
 *             _buildParseEventFilter(event_types)  # purely for validation
 *         self._events_to_collect = (event_types, tag)
 */
  /*else*/ {
    __pyx_t_2 = PySet_New(__pyx_v_event_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_event_types, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":870
 *         else:
 *             event_types = tuple(set(event_types))
 *             _buildParseEventFilter(event_types)  # purely for validation             # <<<<<<<<<<<<<<
 *         self._events_to_collect = (event_types, tag)
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_event_types); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 870, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":871
 *             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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_event_types);
  __Pyx_GIVEREF(__pyx_v_event_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_event_types)) __PYX_ERR(2, 871, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag)) __PYX_ERR(2, 871, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  __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_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":865
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":873
 *         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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  xmlParserCtxt *__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("_getParserContext", 1);

  /* "src/lxml/parser.pxi":875
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_parser_context) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":876
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)             # <<<<<<<<<<<<<<
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
 */
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2, Py_None)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__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_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":877
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
 */
    __pyx_t_1 = __pyx_v_self->_collect_ids;
    __pyx_v_self->_parser_context->_collect_ids = __pyx_t_1;

    /* "src/lxml/parser.pxi":878
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":880
 *             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_3 = ((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_3)) __PYX_ERR(2, 880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/parser.pxi":879
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
 *                 self._parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 */
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF((PyObject *)__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_3);
      __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":878
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    }

    /* "src/lxml/parser.pxi":882
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_4 == ((xmlParserCtxt *)NULL))) __PYX_ERR(2, 882, __pyx_L1_error)
    __pyx_v_pctxt = __pyx_t_4;

    /* "src/lxml/parser.pxi":883
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             self._configureSaxContext(pctxt)
 *         return self._parser_context
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_parser_context);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), __pyx_v_pctxt); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":884
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)             # <<<<<<<<<<<<<<
 *         return self._parser_context
 * 
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(__pyx_v_self, __pyx_v_pctxt); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 884, __pyx_L1_error)

    /* "src/lxml/parser.pxi":875
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target, None)
 *             self._parser_context._collect_ids = self._collect_ids
 */
  }

  /* "src/lxml/parser.pxi":885
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 *         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;

  /* "src/lxml/parser.pxi":873
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/parser.pxi":887
 *         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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlParserCtxt *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getPushParserContext", 1);

  /* "src/lxml/parser.pxi":889
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":891
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)             # <<<<<<<<<<<<<<
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:
 */
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_v_self->_events_to_collect;
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":890
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(             # <<<<<<<<<<<<<<
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __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_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__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_4);
    __pyx_t_4 = 0;

    /* "src/lxml/parser.pxi":892
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
 */
    __pyx_t_1 = __pyx_v_self->_collect_ids;
    __pyx_v_self->_push_parser_context->_collect_ids = __pyx_t_1;

    /* "src/lxml/parser.pxi":893
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":895
 *             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_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_ERR(2, 895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/parser.pxi":894
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             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_4);
      __Pyx_GOTREF((PyObject *)__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_4);
      __pyx_t_4 = 0;

      /* "src/lxml/parser.pxi":893
 *                 self.target, self._events_to_collect)
 *             self._push_parser_context._collect_ids = self._collect_ids
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    }

    /* "src/lxml/parser.pxi":897
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newPushParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_5 == ((xmlParserCtxt *)NULL))) __PYX_ERR(2, 897, __pyx_L1_error)
    __pyx_v_pctxt = __pyx_t_5;

    /* "src/lxml/parser.pxi":899
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             self._configureSaxContext(pctxt)
 *         return self._push_parser_context
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_push_parser_context);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":898
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(             # <<<<<<<<<<<<<<
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 */
    __pyx_t_2 = __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_2)) __PYX_ERR(2, 898, __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;

    /* "src/lxml/parser.pxi":900
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)             # <<<<<<<<<<<<<<
 *         return self._push_parser_context
 * 
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(__pyx_v_self, __pyx_v_pctxt); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 900, __pyx_L1_error)

    /* "src/lxml/parser.pxi":889
 *     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)
 */
  }

  /* "src/lxml/parser.pxi":901
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             self._configureSaxContext(pctxt)
 *         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;

  /* "src/lxml/parser.pxi":887
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/parser.pxi":903
 *         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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  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("_createContext", 1);

  /* "src/lxml/parser.pxi":905
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":906
 *         cdef _SaxParserContext sax_context
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)             # <<<<<<<<<<<<<<
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__TargetParserContext), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":907
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)             # <<<<<<<<<<<<<<
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_v_sax_context), __pyx_v_target); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 907, __pyx_L1_error)

    /* "src/lxml/parser.pxi":905
 *     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)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":908
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:             # <<<<<<<<<<<<<<
 *             sax_context = _SaxParserContext(self)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 908, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":909
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)             # <<<<<<<<<<<<<<
 *         else:
 *             # nothing special to configure
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__SaxParserContext), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":908
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:             # <<<<<<<<<<<<<<
 *             sax_context = _SaxParserContext(self)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":912
 *         else:
 *             # nothing special to configure
 *             return _ParserContext()             # <<<<<<<<<<<<<<
 *         if events_to_collect:
 *             events, tag = events_to_collect
 */
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ParserContext)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":913
 *             # nothing special to configure
 *             return _ParserContext()
 *         if events_to_collect:             # <<<<<<<<<<<<<<
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 913, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":914
 *             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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(2, 914, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_v_events_to_collect); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(2, 914, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(2, 914, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_events = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_tag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/parser.pxi":915
 *         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_ERR(2, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/parser.pxi":913
 *             # nothing special to configure
 *             return _ParserContext()
 *         if events_to_collect:             # <<<<<<<<<<<<<<
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 */
  }

  /* "src/lxml/parser.pxi":916
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 *         return sax_context             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __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;

  /* "src/lxml/parser.pxi":903
 *         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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/parser.pxi":919
 * 
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 */

static int __pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  int __pyx_r;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":920
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:             # <<<<<<<<<<<<<<
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:
 */
  if (__pyx_v_self->_remove_comments) {

    /* "src/lxml/parser.pxi":921
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *         if self._remove_pis:
 *             pctxt.sax.processingInstruction = NULL
 */
    __pyx_v_pctxt->sax->comment = NULL;

    /* "src/lxml/parser.pxi":920
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:
 *         if self._remove_comments:             # <<<<<<<<<<<<<<
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:
 */
  }

  /* "src/lxml/parser.pxi":922
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:             # <<<<<<<<<<<<<<
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:
 */
  if (__pyx_v_self->_remove_pis) {

    /* "src/lxml/parser.pxi":923
 *             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;

    /* "src/lxml/parser.pxi":922
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 *         if self._remove_pis:             # <<<<<<<<<<<<<<
 *             pctxt.sax.processingInstruction = NULL
 *         if self._strip_cdata:
 */
  }

  /* "src/lxml/parser.pxi":924
 *         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
 */
  if (__pyx_v_self->_strip_cdata) {

    /* "src/lxml/parser.pxi":926
 *         if self._strip_cdata:
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         if not self._resolve_external_entities:
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 */
    __pyx_v_pctxt->sax->cdataBlock = NULL;

    /* "src/lxml/parser.pxi":924
 *         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
 */
  }

  /* "src/lxml/parser.pxi":927
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:             # <<<<<<<<<<<<<<
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 */
  __pyx_t_1 = (!__pyx_v_self->_resolve_external_entities);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":928
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:
 *             pctxt.sax.getEntity = _getInternalEntityOnly             # <<<<<<<<<<<<<<
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 */
    __pyx_v_pctxt->sax->getEntity = __pyx_f_4lxml_5etree__getInternalEntityOnly;

    /* "src/lxml/parser.pxi":927
 *             # hard switch-off for CDATA nodes => makes them plain text
 *             pctxt.sax.cdataBlock = NULL
 *         if not self._resolve_external_entities:             # <<<<<<<<<<<<<<
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 */
  }

  /* "src/lxml/parser.pxi":919
 * 
 *     @cython.final
 *     cdef int _configureSaxContext(self, xmlparser.xmlParserCtxt* pctxt) except -1:             # <<<<<<<<<<<<<<
 *         if self._remove_comments:
 *             pctxt.sax.comment = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":930
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 *     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;
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":931
 * 
 *     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;

  /* "src/lxml/parser.pxi":932
 *     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_3 = (__pyx_v_sax != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_sax->initialized != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_sax->initialized != XML_SAX2_MAGIC);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":934
 *         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*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 */
    __pyx_t_2 = (((xmlSAXHandlerV1 *)__pyx_v_sax) == (&htmlDefaultSAXHandler));
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":935
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))             # <<<<<<<<<<<<<<
 *                 if sax is NULL:
 *                     raise MemoryError()
 */
      __pyx_v_sax = ((xmlSAXHandler *)xmlMalloc((sizeof(xmlSAXHandler))));

      /* "src/lxml/parser.pxi":936
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 */
      __pyx_t_2 = (__pyx_v_sax == NULL);
      if (unlikely(__pyx_t_2)) {

        /* "src/lxml/parser.pxi":937
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 */
        PyErr_NoMemory(); __PYX_ERR(2, 937, __pyx_L1_error)

        /* "src/lxml/parser.pxi":936
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 */
      }

      /* "src/lxml/parser.pxi":938
 *                 if sax is NULL:
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,             # <<<<<<<<<<<<<<
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
 */
      (void)(memcpy(__pyx_v_sax, (&htmlDefaultSAXHandler), (sizeof(htmlDefaultSAXHandler))));

      /* "src/lxml/parser.pxi":940
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax             # <<<<<<<<<<<<<<
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
      __pyx_v_c_ctxt->sax = __pyx_v_sax;

      /* "src/lxml/parser.pxi":934
 *         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*> tree.xmlMalloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 */
    }

    /* "src/lxml/parser.pxi":941
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 */
    __pyx_v_sax->initialized = XML_SAX2_MAGIC;

    /* "src/lxml/parser.pxi":943
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError             # <<<<<<<<<<<<<<
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
 */
    __pyx_v_sax->serror = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveParserError);

    /* "src/lxml/parser.pxi":944
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *             sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax.endElementNs = NULL
 *             sax._private = NULL
 */
    __pyx_v_sax->startElementNs = NULL;

    /* "src/lxml/parser.pxi":945
 *             sax.serror = <xmlerror.xmlStructuredErrorFunc> _receiveParserError
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax._private = NULL
 *         return 0
 */
    __pyx_v_sax->endElementNs = NULL;

    /* "src/lxml/parser.pxi":946
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
 *             sax._private = NULL             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_sax->_private = NULL;

    /* "src/lxml/parser.pxi":932
 *     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:
 */
  }

  /* "src/lxml/parser.pxi":947
 *             sax.endElementNs = NULL
 *             sax._private = NULL
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":930
 *             pctxt.sax.getEntity = _getInternalEntityOnly
 * 
 *     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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":949
 *         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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":951
 *     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:
 */
  if (__pyx_v_self->_for_html) {

    /* "src/lxml/parser.pxi":952
 *         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(((char *)"dummy"), 5);

    /* "src/lxml/parser.pxi":953
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":954
 *             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 == ((int)-1))) __PYX_ERR(2, 954, __pyx_L1_error)

      /* "src/lxml/parser.pxi":953
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
 */
    }

    /* "src/lxml/parser.pxi":951
 *     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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":956
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()             # <<<<<<<<<<<<<<
 *         if c_ctxt is NULL:
 *             raise MemoryError
 */
  /*else*/ {
    __pyx_v_c_ctxt = xmlNewParserCtxt();
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":957
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
 */
  __pyx_t_1 = (__pyx_v_c_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":958
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt
 */
    PyErr_NoMemory(); __PYX_ERR(2, 958, __pyx_L1_error)

    /* "src/lxml/parser.pxi":957
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
 */
  }

  /* "src/lxml/parser.pxi":959
 *         if c_ctxt is NULL:
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
 */
  __pyx_v_c_ctxt->sax->startDocument = __pyx_f_4lxml_5etree__initSaxDocument;

  /* "src/lxml/parser.pxi":960
 *             raise MemoryError
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:
 */
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":949
 *         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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":962
 *         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", 1);

  /* "src/lxml/parser.pxi":964
 *     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) {
    __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;

  /* "src/lxml/parser.pxi":965
 *         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)
 */
  if (__pyx_v_self->_for_html) {

    /* "src/lxml/parser.pxi":966
 *         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);

    /* "src/lxml/parser.pxi":968
 *             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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":969
 *                 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 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error)

      /* "src/lxml/parser.pxi":970
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 */
      (void)(htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options));

      /* "src/lxml/parser.pxi":968
 *             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)
 */
    }

    /* "src/lxml/parser.pxi":965
 *         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)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":972
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(             # <<<<<<<<<<<<<<
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
 */
  /*else*/ {

    /* "src/lxml/parser.pxi":973
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 */
    __pyx_v_c_ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename);

    /* "src/lxml/parser.pxi":974
 *             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);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":975
 *                 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()
 */
      (void)(xmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options));

      /* "src/lxml/parser.pxi":974
 *             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_L3:;

  /* "src/lxml/parser.pxi":976
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
 */
  __pyx_t_2 = (__pyx_v_c_ctxt == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/parser.pxi":977
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt
 */
    PyErr_NoMemory(); __PYX_ERR(2, 977, __pyx_L1_error)

    /* "src/lxml/parser.pxi":976
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
 */
  }

  /* "src/lxml/parser.pxi":978
 *         if c_ctxt is NULL:
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
 */
  __pyx_v_c_ctxt->sax->startDocument = __pyx_f_4lxml_5etree__initSaxDocument;

  /* "src/lxml/parser.pxi":979
 *             raise MemoryError()
 *         c_ctxt.sax.startDocument = _initSaxDocument
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":962
 *         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;
}

/* "src/lxml/parser.pxi":981
 *         return c_ctxt
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last parser run.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/parser.pxi":986
 *         """
 *         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_ERR(2, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":987
 *         cdef _ParserContext context
 *         context = self._getParserContext()
 *         return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(2, 987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":981
 *         return c_ctxt
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last parser run.
 */

  /* 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;
}

/* "src/lxml/parser.pxi":989
 *         return context._error_log.copy()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/parser.pxi":992
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
 *         return self._resolvers             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_resolvers);
  __pyx_r = ((PyObject *)__pyx_v_self->_resolvers);
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":989
 *         return context._error_log.copy()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of this parser."""
 */

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

/* "src/lxml/parser.pxi":994
 *         return self._resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/parser.pxi":997
 *     def version(self):
 *         """The version of the underlying XML parser."""
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_LIBXML_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_libxml2_d_d_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 997, __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;

  /* "src/lxml/parser.pxi":994
 *         return self._resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
 */

  /* 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;
}

/* "src/lxml/parser.pxi":999
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_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 PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_3set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lookup);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 999, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_element_class_lookup") < 0)) __PYX_ERR(2, 999, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 999, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 999, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_2set_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2set_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", 1);

  /* "src/lxml/parser.pxi":1006
 *         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((PyObject *)__pyx_v_self->_class_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_class_lookup);
  __pyx_v_self->_class_lookup = __pyx_v_lookup;

  /* "src/lxml/parser.pxi":999
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/parser.pxi":1008
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         "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;
  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("_copy", 1);

  /* "src/lxml/parser.pxi":1011
 *         "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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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__BaseParser))))) __PYX_ERR(2, 1011, __pyx_L1_error)
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1012
 *         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_4 = __pyx_v_self->_parse_options;
  __pyx_v_parser->_parse_options = __pyx_t_4;

  /* "src/lxml/parser.pxi":1013
 *         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_5 = __pyx_v_self->_for_html;
  __pyx_v_parser->_for_html = __pyx_t_5;

  /* "src/lxml/parser.pxi":1014
 *         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_5 = __pyx_v_self->_remove_comments;
  __pyx_v_parser->_remove_comments = __pyx_t_5;

  /* "src/lxml/parser.pxi":1015
 *         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_5 = __pyx_v_self->_remove_pis;
  __pyx_v_parser->_remove_pis = __pyx_t_5;

  /* "src/lxml/parser.pxi":1016
 *         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_5 = __pyx_v_self->_strip_cdata;
  __pyx_v_parser->_strip_cdata = __pyx_t_5;

  /* "src/lxml/parser.pxi":1017
 *         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_1 = __pyx_v_self->_filename;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->_filename);
  __Pyx_DECREF(__pyx_v_parser->_filename);
  __pyx_v_parser->_filename = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1018
 *         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_1 = ((PyObject *)__pyx_v_self->_resolvers);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_resolvers);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_resolvers);
  __pyx_v_parser->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1019
 *         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_1 = __pyx_v_self->target;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->target);
  __Pyx_DECREF(__pyx_v_parser->target);
  __pyx_v_parser->target = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1020
 *         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_1 = ((PyObject *)__pyx_v_self->_class_lookup);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_class_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_class_lookup);
  __pyx_v_parser->_class_lookup = ((struct LxmlElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1021
 *         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_1 = __pyx_v_self->_default_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_parser->_default_encoding);
  __Pyx_DECREF(__pyx_v_parser->_default_encoding);
  __pyx_v_parser->_default_encoding = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1022
 *         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_1 = ((PyObject *)__pyx_v_self->_schema);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_parser->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_parser->_schema);
  __pyx_v_parser->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1023
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect             # <<<<<<<<<<<<<<
 *         return parser
 * 
 */
  __pyx_t_1 = __pyx_v_self->_events_to_collect;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __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_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1024
 *         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;

  /* "src/lxml/parser.pxi":1008
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         "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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":1026
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_4copy, "copy(self)\n\n        Create a new parser with the same configuration.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_5copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_4copy};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_4copy(((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_4copy(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", 1);

  /* "src/lxml/parser.pxi":1031
 *         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_ERR(2, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1026
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/parser.pxi":1033
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11_BaseParser_6makeelement, "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11_BaseParser_7makeelement = {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_6makeelement};
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1033, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1033, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1033, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "makeelement") < 0)) __PYX_ERR(2, 1033, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(2, 1033, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_6makeelement(((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_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6makeelement(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", 1);

  /* "src/lxml/parser.pxi":1038
 *         Creates a new element associated with this parser.
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/parser.pxi":1039
 *         """
 *         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_ERR(2, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1033
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/parser.pxi":1043
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """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_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlParserCtxt *__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("_parseUnicodeDoc", 1);

  /* "src/lxml/parser.pxi":1052
 *         cdef int buffer_len, c_kind
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING             # <<<<<<<<<<<<<<
 *         if python.PyUnicode_IS_READY(utext):
 *             # PEP-393 string
 */
  __pyx_v_c_encoding = __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING;

  /* "src/lxml/parser.pxi":1053
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING
 *         if python.PyUnicode_IS_READY(utext):             # <<<<<<<<<<<<<<
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 */
  __pyx_t_1 = PyUnicode_IS_READY(__pyx_v_utext);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1055
 *         if python.PyUnicode_IS_READY(utext):
 *             # PEP-393 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));

    /* "src/lxml/parser.pxi":1056
 *             # PEP-393 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);

    /* "src/lxml/parser.pxi":1057
 *             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:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 */
    __pyx_v_c_kind = PyUnicode_KIND(__pyx_v_utext);

    /* "src/lxml/parser.pxi":1058
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:             # <<<<<<<<<<<<<<
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'
 */
    switch (__pyx_v_c_kind) {
      case 1:

      /* "src/lxml/parser.pxi":1059
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-8'
 *                 else:
 */
      __pyx_t_1 = (PyUnicode_MAX_CHAR_VALUE(__pyx_v_utext) <= 0x7F);
      if (__pyx_t_1) {

        /* "src/lxml/parser.pxi":1060
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'ISO-8859-1'
 */
        __pyx_v_c_encoding = ((const char *)"UTF-8");

        /* "src/lxml/parser.pxi":1059
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-8'
 *                 else:
 */
        goto __pyx_L4;
      }

      /* "src/lxml/parser.pxi":1062
 *                     c_encoding = 'UTF-8'
 *                 else:
 *                     c_encoding = 'ISO-8859-1'             # <<<<<<<<<<<<<<
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 */
      /*else*/ {
        __pyx_v_c_encoding = ((const char *)"ISO-8859-1");
      }
      __pyx_L4:;

      /* "src/lxml/parser.pxi":1058
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:             # <<<<<<<<<<<<<<
 *                 if python.PyUnicode_MAX_CHAR_VALUE(utext) <= 127:
 *                     c_encoding = 'UTF-8'
 */
      break;
      case 2:

      /* "src/lxml/parser.pxi":1064
 *                     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);

      /* "src/lxml/parser.pxi":1065
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 */
      if (PY_BIG_ENDIAN) {

        /* "src/lxml/parser.pxi":1066
 *                 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 = ((const char *)"UTF-16BE");

        /* "src/lxml/parser.pxi":1065
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 */
        goto __pyx_L5;
      }

      /* "src/lxml/parser.pxi":1068
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2             # <<<<<<<<<<<<<<
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 */
      /*else*/ {
        __pyx_v_c_encoding = ((const char *)"UTF-16LE");
      }
      __pyx_L5:;

      /* "src/lxml/parser.pxi":1063
 *                 else:
 *                     c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:
 */
      break;
      case 4:

      /* "src/lxml/parser.pxi":1070
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4             # <<<<<<<<<<<<<<
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 */
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len * 4);

      /* "src/lxml/parser.pxi":1071
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
 */
      if (PY_BIG_ENDIAN) {

        /* "src/lxml/parser.pxi":1072
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4
 */
        __pyx_v_c_encoding = ((const char *)"UTF-32BE");

        /* "src/lxml/parser.pxi":1071
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
 */
        goto __pyx_L6;
      }

      /* "src/lxml/parser.pxi":1074
 *                     c_encoding = 'UTF-32BE'  # actually UCS-4
 *                 else:
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4             # <<<<<<<<<<<<<<
 *             else:
 *                 assert False, f"Illegal Unicode kind {c_kind}"
 */
      /*else*/ {
        __pyx_v_c_encoding = ((const char *)"UTF-32LE");
      }
      __pyx_L6:;

      /* "src/lxml/parser.pxi":1069
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 */
      break;
      default:

      /* "src/lxml/parser.pxi":1076
 *                     c_encoding = 'UTF-32LE'  # actually UCS-4
 *             else:
 *                 assert False, f"Illegal Unicode kind {c_kind}"             # <<<<<<<<<<<<<<
 *         else:
 *             # old Py_UNICODE string
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        if (unlikely(!0)) {
          __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_c_kind, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1076, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Illegal_Unicode_kind, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1076, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_3, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(2, 1076, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(2, 1076, __pyx_L1_error)
      #endif
      break;
    }

    /* "src/lxml/parser.pxi":1053
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _PY_UNICODE_ENCODING
 *         if python.PyUnicode_IS_READY(utext):             # <<<<<<<<<<<<<<
 *             # PEP-393 string
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1079
 *         else:
 *             # old Py_UNICODE string
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)             # <<<<<<<<<<<<<<
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
 */
  /*else*/ {
    __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_utext);

    /* "src/lxml/parser.pxi":1080
 *             # old Py_UNICODE string
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)             # <<<<<<<<<<<<<<
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len
 */
    __pyx_v_c_text = PyUnicode_AS_DATA(__pyx_v_utext);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1081
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX             # <<<<<<<<<<<<<<
 *         buffer_len = py_buffer_len
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (0 <= __pyx_v_py_buffer_len);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_py_buffer_len <= INT_MAX);
    }
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(2, 1081, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(2, 1081, __pyx_L1_error)
  #endif

  /* "src/lxml/parser.pxi":1082
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert 0 <= py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_buffer_len = __pyx_v_py_buffer_len;

  /* "src/lxml/parser.pxi":1084
 *         buffer_len = py_buffer_len
 * 
 *         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_ERR(2, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1085
 * 
 *         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, NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1085, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1086
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":1087
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 */
    __pyx_t_5 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_5;

    /* "src/lxml/parser.pxi":1088
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             orig_options = pctxt.options
 *             with nogil:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1088, __pyx_L8_error)

    /* "src/lxml/parser.pxi":1089
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_t_4 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_4;

    /* "src/lxml/parser.pxi":1090
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":1091
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 */
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1092
 *             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);

            /* "src/lxml/parser.pxi":1095
 *                         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_1 = (__pyx_v_result != NULL);
            if (__pyx_t_1) {

              /* "src/lxml/parser.pxi":1096
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_1) {

                /* "src/lxml/parser.pxi":1097
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1098
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1096
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              }

              /* "src/lxml/parser.pxi":1095
 *                         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)
 */
            }

            /* "src/lxml/parser.pxi":1091
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 */
            goto __pyx_L13;
          }

          /* "src/lxml/parser.pxi":1100
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 */
          /*else*/ {

            /* "src/lxml/parser.pxi":1102
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 */
            __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_L13:;
        }

        /* "src/lxml/parser.pxi":1090
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L12;
          }
          __pyx_L12:;
        }
    }

    /* "src/lxml/parser.pxi":1103
 *                         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;

    /* "src/lxml/parser.pxi":1105
 *             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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1105, __pyx_L8_error)
    __pyx_r = __pyx_t_6;
    goto __pyx_L7_return;
  }

  /* "src/lxml/parser.pxi":1107
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,
 */
  /*finally:*/ {
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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_4 = __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 == ((int)-1))) __PYX_ERR(2, 1107, __pyx_L17_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_4; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L17_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_L7_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 == ((int)-1))) __PYX_ERR(2, 1107, __pyx_L1_error)
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1043
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         """Parse unicode document, share dictionary if possible.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parser.pxi":1109
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,             # <<<<<<<<<<<<<<
 *                            char* c_filename) except NULL:
 *         """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;
  xmlCharEncoding __pyx_v_enc;
  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", 1);

  /* "src/lxml/parser.pxi":1118
 *         cdef char* c_encoding
 *         cdef tree.xmlCharEncoding enc
 *         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_ERR(2, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1119
 *         cdef tree.xmlCharEncoding enc
 *         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, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1119, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1120
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":1121
 *         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;

    /* "src/lxml/parser.pxi":1122
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1122, __pyx_L4_error)

    /* "src/lxml/parser.pxi":1124
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 */
    __pyx_t_4 = (__pyx_v_self->_default_encoding == Py_None);
    if (__pyx_t_4) {

      /* "src/lxml/parser.pxi":1125
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 */
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1128
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
 */
      __pyx_t_5 = (__pyx_v_c_len >= 4);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[0]) == '\xFF');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[1]) == '\xFE');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }

      /* "src/lxml/parser.pxi":1129
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and
 *                                    c_text[2] == 0 and c_text[3] == 0):             # <<<<<<<<<<<<<<
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4
 */
      __pyx_t_5 = ((__pyx_v_c_text[2]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[3]) == 0);
      __pyx_t_4 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;

      /* "src/lxml/parser.pxi":1128
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
 */
      if (__pyx_t_4) {

        /* "src/lxml/parser.pxi":1130
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"             # <<<<<<<<<<<<<<
 *                     c_text += 4
 *                     c_len -= 4
 */
        __pyx_v_c_encoding = ((char *)"UTF-32LE");

        /* "src/lxml/parser.pxi":1131
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4             # <<<<<<<<<<<<<<
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 */
        __pyx_v_c_text = (__pyx_v_c_text + 4);

        /* "src/lxml/parser.pxi":1132
 *                     c_encoding = "UTF-32LE"
 *                     c_text += 4
 *                     c_len -= 4             # <<<<<<<<<<<<<<
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 */
        __pyx_v_c_len = (__pyx_v_c_len - 4);

        /* "src/lxml/parser.pxi":1128
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 *                 # NOTE: limit to problematic cases because it changes character offsets
 *                 if c_len >= 4 and (c_text[0] == b'\xFF' and c_text[1] == b'\xFE' and             # <<<<<<<<<<<<<<
 *                                    c_text[2] == 0 and c_text[3] == 0):
 *                     c_encoding = "UTF-32LE"
 */
        goto __pyx_L7;
      }

      /* "src/lxml/parser.pxi":1133
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
 */
      __pyx_t_5 = (__pyx_v_c_len >= 4);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[0]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[1]) == 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }

      /* "src/lxml/parser.pxi":1134
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):             # <<<<<<<<<<<<<<
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4
 */
      __pyx_t_5 = ((__pyx_v_c_text[2]) == '\xFE');
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_5 = ((__pyx_v_c_text[3]) == '\xFF');
      __pyx_t_4 = __pyx_t_5;
      __pyx_L13_bool_binop_done:;

      /* "src/lxml/parser.pxi":1133
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
 */
      if (__pyx_t_4) {

        /* "src/lxml/parser.pxi":1135
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"             # <<<<<<<<<<<<<<
 *                     c_text += 4
 *                     c_len -= 4
 */
        __pyx_v_c_encoding = ((char *)"UTF-32BE");

        /* "src/lxml/parser.pxi":1136
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4             # <<<<<<<<<<<<<<
 *                     c_len -= 4
 *                 else:
 */
        __pyx_v_c_text = (__pyx_v_c_text + 4);

        /* "src/lxml/parser.pxi":1137
 *                     c_encoding = "UTF-32BE"
 *                     c_text += 4
 *                     c_len -= 4             # <<<<<<<<<<<<<<
 *                 else:
 *                     # no BOM => try to determine encoding
 */
        __pyx_v_c_len = (__pyx_v_c_len - 4);

        /* "src/lxml/parser.pxi":1133
 *                     c_text += 4
 *                     c_len -= 4
 *                 elif c_len >= 4 and (c_text[0] == 0 and c_text[1] == 0 and             # <<<<<<<<<<<<<<
 *                                      c_text[2] == b'\xFE' and c_text[3] == b'\xFF'):
 *                     c_encoding = "UTF-32BE"
 */
        goto __pyx_L7;
      }

      /* "src/lxml/parser.pxi":1140
 *                 else:
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)             # <<<<<<<<<<<<<<
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'
 */
      /*else*/ {
        __pyx_v_enc = xmlDetectCharEncoding(((const xmlChar *)__pyx_v_c_text), __pyx_v_c_len);

        /* "src/lxml/parser.pxi":1141
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 */
        switch (__pyx_v_enc) {
          case XML_CHAR_ENCODING_UCS4LE:

          /* "src/lxml/parser.pxi":1142
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'             # <<<<<<<<<<<<<<
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *                         c_encoding = 'UTF-32BE'
 */
          __pyx_v_c_encoding = ((char *)"UTF-32LE");

          /* "src/lxml/parser.pxi":1141
 *                     # no BOM => try to determine encoding
 *                     enc = tree.xmlDetectCharEncoding(<const_xmlChar*>c_text, c_len)
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 */
          break;
          case XML_CHAR_ENCODING_UCS4BE:

          /* "src/lxml/parser.pxi":1144
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *                         c_encoding = 'UTF-32BE'             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
          __pyx_v_c_encoding = ((char *)"UTF-32BE");

          /* "src/lxml/parser.pxi":1143
 *                     if enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *                         c_encoding = 'UTF-32LE'
 *                     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:             # <<<<<<<<<<<<<<
 *                         c_encoding = 'UTF-32BE'
 *             else:
 */
          break;
          default: break;
        }
      }
      __pyx_L7:;

      /* "src/lxml/parser.pxi":1124
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *                 # libxml2 (at least 2.9.3) does not recognise UTF-32 BOMs
 */
      goto __pyx_L6;
    }

    /* "src/lxml/parser.pxi":1146
 *                         c_encoding = 'UTF-32BE'
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
 */
    /*else*/ {
      __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:;

    /* "src/lxml/parser.pxi":1148
 *                 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;

    /* "src/lxml/parser.pxi":1149
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":1150
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 */
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1151
 *             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);

            /* "src/lxml/parser.pxi":1154
 *                         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_4 = (__pyx_v_result != NULL);
            if (__pyx_t_4) {

              /* "src/lxml/parser.pxi":1155
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              __pyx_t_4 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_4) {

                /* "src/lxml/parser.pxi":1156
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1157
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1155
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              }

              /* "src/lxml/parser.pxi":1154
 *                         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)
 */
            }

            /* "src/lxml/parser.pxi":1150
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 */
            goto __pyx_L21;
          }

          /* "src/lxml/parser.pxi":1159
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 */
          /*else*/ {

            /* "src/lxml/parser.pxi":1161
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 */
            __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_L21:;
        }

        /* "src/lxml/parser.pxi":1149
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L20;
          }
          __pyx_L20:;
        }
    }

    /* "src/lxml/parser.pxi":1162
 *                         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;

    /* "src/lxml/parser.pxi":1164
 *             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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1164, __pyx_L4_error)
    __pyx_r = __pyx_t_6;
    goto __pyx_L3_return;
  }

  /* "src/lxml/parser.pxi":1166
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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 == ((int)-1))) __PYX_ERR(2, 1166, __pyx_L25_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_L25_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 == ((int)-1))) __PYX_ERR(2, 1166, __pyx_L1_error)
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1109
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,             # <<<<<<<<<<<<<<
 *                            char* c_filename) except NULL:
 *         """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;
}

/* "src/lxml/parser.pxi":1168
 *             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;
  xmlDoc *__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_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 1);

  /* "src/lxml/parser.pxi":1173
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_encoding
 *         result = NULL             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_result = NULL;

  /* "src/lxml/parser.pxi":1175
 *         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_ERR(2, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1176
 * 
 *         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, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1176, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1177
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":1178
 *         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;

    /* "src/lxml/parser.pxi":1179
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1179, __pyx_L4_error)

    /* "src/lxml/parser.pxi":1181
 *             __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);
    if (__pyx_t_4) {

      /* "src/lxml/parser.pxi":1182
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1181
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/parser.pxi":1184
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
 */
    /*else*/ {
      __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:;

    /* "src/lxml/parser.pxi":1186
 *                 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;

    /* "src/lxml/parser.pxi":1187
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":1188
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 */
          if (__pyx_v_self->_for_html) {

            /* "src/lxml/parser.pxi":1189
 *             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);

            /* "src/lxml/parser.pxi":1191
 *                     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_4 = (__pyx_v_result != NULL);
            if (__pyx_t_4) {

              /* "src/lxml/parser.pxi":1192
 *                         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_4 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
              if (__pyx_t_4) {

                /* "src/lxml/parser.pxi":1193
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "src/lxml/parser.pxi":1194
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
 */
                __pyx_v_result = NULL;

                /* "src/lxml/parser.pxi":1192
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              }

              /* "src/lxml/parser.pxi":1191
 *                     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)
 */
            }

            /* "src/lxml/parser.pxi":1188
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 */
            goto __pyx_L10;
          }

          /* "src/lxml/parser.pxi":1196
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(             # <<<<<<<<<<<<<<
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem
 */
          /*else*/ {

            /* "src/lxml/parser.pxi":1197
 *                 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:;
        }

        /* "src/lxml/parser.pxi":1187
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/parser.pxi":1198
 *                     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;

    /* "src/lxml/parser.pxi":1200
 *             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_ERR(2, 1200, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = ((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_5 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1200, __pyx_L4_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    goto __pyx_L3_return;
  }

  /* "src/lxml/parser.pxi":1202
 *             return context._handleParseResultDoc(self, result, c_filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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_2 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {
        __pyx_t_14 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(2, 1202, __pyx_L14_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_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_2; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
      __pyx_L14_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_L3_return: {
      __pyx_t_5 = __pyx_r;
      __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1202, __pyx_L1_error)
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1168
 *             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;
}

/* "src/lxml/parser.pxi":1204
 *             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);

  /* "src/lxml/parser.pxi":1211
 *         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_ERR(2, 1211, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1212
 *         cdef char* c_filename
 *         if not filename:
 *             filename = None             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_filename, Py_None);

    /* "src/lxml/parser.pxi":1211
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_filename
 *         if not filename:             # <<<<<<<<<<<<<<
 *             filename = None
 * 
 */
  }

  /* "src/lxml/parser.pxi":1214
 *             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_ERR(2, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/parser.pxi":1215
 * 
 *         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, NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1215, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1216
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":1217
 *         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;

    /* "src/lxml/parser.pxi":1218
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename,
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1218, __pyx_L5_error)

    /* "src/lxml/parser.pxi":1221
 *             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_ERR(2, 1221, __pyx_L5_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_3 = __pyx_v_encoding;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_self->_default_encoding);
    __pyx_t_3 = __pyx_v_self->_default_encoding;
    __pyx_L7_bool_binop_done:;

    /* "src/lxml/parser.pxi":1219
 *             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_ERR(2, 1219, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_filelike);
    __Pyx_GIVEREF(__pyx_v_filelike);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filelike)) __PYX_ERR(2, 1219, __pyx_L5_error);
    __Pyx_INCREF((PyObject *)__pyx_v_context);
    __Pyx_GIVEREF((PyObject *)__pyx_v_context);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_context))) __PYX_ERR(2, 1219, __pyx_L5_error);
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_filename)) __PYX_ERR(2, 1219, __pyx_L5_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3)) __PYX_ERR(2, 1219, __pyx_L5_error);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FileReaderContext), __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1219, __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;

    /* "src/lxml/parser.pxi":1222
 *                 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);

    /* "src/lxml/parser.pxi":1224
 *             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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1224, __pyx_L5_error)
    __pyx_r = __pyx_t_7;
    goto __pyx_L4_return;
  }

  /* "src/lxml/parser.pxi":1227
 *                 self, result, filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_6); __pyx_t_6 = 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 == ((int)-1))) __PYX_ERR(2, 1227, __pyx_L10_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_L10_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 == ((int)-1))) __PYX_ERR(2, 1227, __pyx_L1_error)
      __pyx_r = __pyx_t_7;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/parser.pxi":1204
 *             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;
}

/* "src/lxml/parser.pxi":828
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/parser.pxi":1230
 * 
 * 
 * cdef tree.xmlEntity* _getInternalEntityOnly(void* ctxt, const_xmlChar* name) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
 */

static xmlEntity *__pyx_f_4lxml_5etree__getInternalEntityOnly(void *__pyx_v_ctxt, const xmlChar *__pyx_v_name) {
  xmlEntity *__pyx_v_entity;
  xmlError __pyx_v_c_error;
  xmlStructuredErrorFunc __pyx_v_err_func;
  xmlParserInput *__pyx_v_parser_input;
  void *__pyx_v_err_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlEntity *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlParserInput *__pyx_t_3;
  xmlError __pyx_t_4;
  int __pyx_t_5;

  /* "src/lxml/parser.pxi":1234
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)             # <<<<<<<<<<<<<<
 *     if not entity:
 *         return NULL
 */
  __pyx_v_entity = xmlSAX2GetEntity(__pyx_v_ctxt, __pyx_v_name);

  /* "src/lxml/parser.pxi":1235
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if entity.etype not in (
 */
  __pyx_t_1 = (!(__pyx_v_entity != 0));
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1236
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:
 *         return NULL             # <<<<<<<<<<<<<<
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1235
 *     """
 *     cdef tree.xmlEntity* entity = xmlparser.xmlSAX2GetEntity(ctxt, name)
 *     if not entity:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if entity.etype not in (
 */
  }

  /* "src/lxml/parser.pxi":1237
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 */
  switch (__pyx_v_entity->etype) {
    case XML_EXTERNAL_GENERAL_PARSED_ENTITY:

    /* "src/lxml/parser.pxi":1238
 *         return NULL
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
 */
    case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:

    /* "src/lxml/parser.pxi":1239
 *     if entity.etype not in (
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
 *         return entity
 */
    case XML_EXTERNAL_PARAMETER_ENTITY:

    /* "src/lxml/parser.pxi":1237
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 */
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  __pyx_t_2 = __pyx_t_1;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1241
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_PARAMETER_ENTITY):
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     # Reject all external entities and fail the parsing instead. There is currently
 */
    __pyx_r = __pyx_v_entity;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1237
 *     if not entity:
 *         return NULL
 *     if entity.etype not in (             # <<<<<<<<<<<<<<
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_PARSED_ENTITY,
 *             tree.xmlEntityType.XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
 */
  }

  /* "src/lxml/parser.pxi":1250
 *     cdef void* err_context
 * 
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt             # <<<<<<<<<<<<<<
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1251
 * 
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError             # <<<<<<<<<<<<<<
 *     if err_func:
 *         parser_input = c_ctxt.input
 */
  __pyx_v_err_func = xmlStructuredError;

  /* "src/lxml/parser.pxi":1252
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:             # <<<<<<<<<<<<<<
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 */
  __pyx_t_2 = (__pyx_v_err_func != 0);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1253
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:
 *         parser_input = c_ctxt.input             # <<<<<<<<<<<<<<
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:
 */
    __pyx_t_3 = __pyx_v_c_ctxt->input;
    __pyx_v_parser_input = __pyx_t_3;

    /* "src/lxml/parser.pxi":1255
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:             # <<<<<<<<<<<<<<
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]
 * 
 */
    __pyx_t_1 = (__pyx_v_parser_input != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_parser_input->filename == NULL);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_c_ctxt->inputNr > 1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1256
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]             # <<<<<<<<<<<<<<
 * 
 *         c_error = xmlerror.xmlError(
 */
      __pyx_v_parser_input = (__pyx_v_c_ctxt->inputTab[(__pyx_v_c_ctxt->inputNr - 2)]);

      /* "src/lxml/parser.pxi":1255
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 *         if parser_input and parser_input.filename is NULL and c_ctxt.inputNr > 1:             # <<<<<<<<<<<<<<
 *             parser_input = c_ctxt.inputTab[c_ctxt.inputNr - 2]
 * 
 */
    }

    /* "src/lxml/parser.pxi":1259
 * 
 *         c_error = xmlerror.xmlError(
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,             # <<<<<<<<<<<<<<
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,
 */
    __pyx_t_4.domain = XML_FROM_PARSER;

    /* "src/lxml/parser.pxi":1260
 *         c_error = xmlerror.xmlError(
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,             # <<<<<<<<<<<<<<
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,
 *             message=b"External entity resolution is disabled for security reasons "
 */
    __pyx_t_4.code = XML_ERR_EXT_ENTITY_STANDALONE;

    /* "src/lxml/parser.pxi":1261
 *             domain=xmlerror.xmlErrorDomain.XML_FROM_PARSER,
 *             code=xmlerror.xmlParserErrors.XML_ERR_EXT_ENTITY_STANDALONE,
 *             level=xmlerror.xmlErrorLevel.XML_ERR_FATAL,             # <<<<<<<<<<<<<<
 *             message=b"External entity resolution is disabled for security reasons "
 *                     b"when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' "
 */
    __pyx_t_4.level = XML_ERR_FATAL;
    __pyx_t_4.message = ((char *)"External entity resolution is disabled for security reasons when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' if you consider it safe to enable it.");

    /* "src/lxml/parser.pxi":1265
 *                     b"when resolving '&%s;'. Use 'XMLParser(resolve_entities=True)' "
 *                     b"if you consider it safe to enable it.",
 *             file=parser_input.filename,             # <<<<<<<<<<<<<<
 *             node=entity,
 *             str1=<char*> name,
 */
    __pyx_t_4.file = __pyx_v_parser_input->filename;

    /* "src/lxml/parser.pxi":1266
 *                     b"if you consider it safe to enable it.",
 *             file=parser_input.filename,
 *             node=entity,             # <<<<<<<<<<<<<<
 *             str1=<char*> name,
 *             str2=NULL,
 */
    __pyx_t_4.node = __pyx_v_entity;

    /* "src/lxml/parser.pxi":1267
 *             file=parser_input.filename,
 *             node=entity,
 *             str1=<char*> name,             # <<<<<<<<<<<<<<
 *             str2=NULL,
 *             str3=NULL,
 */
    __pyx_t_4.str1 = ((char *)__pyx_v_name);

    /* "src/lxml/parser.pxi":1268
 *             node=entity,
 *             str1=<char*> name,
 *             str2=NULL,             # <<<<<<<<<<<<<<
 *             str3=NULL,
 *             line=parser_input.line if parser_input else 0,
 */
    __pyx_t_4.str2 = NULL;

    /* "src/lxml/parser.pxi":1269
 *             str1=<char*> name,
 *             str2=NULL,
 *             str3=NULL,             # <<<<<<<<<<<<<<
 *             line=parser_input.line if parser_input else 0,
 *             int1=0,
 */
    __pyx_t_4.str3 = NULL;

    /* "src/lxml/parser.pxi":1270
 *             str2=NULL,
 *             str3=NULL,
 *             line=parser_input.line if parser_input else 0,             # <<<<<<<<<<<<<<
 *             int1=0,
 *             int2=parser_input.col if parser_input else 0,
 */
    __pyx_t_2 = (__pyx_v_parser_input != 0);
    if (__pyx_t_2) {
      __pyx_t_5 = __pyx_v_parser_input->line;
    } else {
      __pyx_t_5 = 0;
    }
    __pyx_t_4.line = __pyx_t_5;
    __pyx_t_4.int1 = 0;

    /* "src/lxml/parser.pxi":1272
 *             line=parser_input.line if parser_input else 0,
 *             int1=0,
 *             int2=parser_input.col if parser_input else 0,             # <<<<<<<<<<<<<<
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext
 */
    __pyx_t_2 = (__pyx_v_parser_input != 0);
    if (__pyx_t_2) {
      __pyx_t_5 = __pyx_v_parser_input->col;
    } else {
      __pyx_t_5 = 0;
    }
    __pyx_t_4.int2 = __pyx_t_5;
    __pyx_v_c_error = __pyx_t_4;

    /* "src/lxml/parser.pxi":1274
 *             int2=parser_input.col if parser_input else 0,
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext             # <<<<<<<<<<<<<<
 *         err_func(err_context, &c_error)
 * 
 */
    __pyx_v_err_context = xmlStructuredErrorContext;

    /* "src/lxml/parser.pxi":1275
 *         )
 *         err_context = xmlerror.xmlStructuredErrorContext
 *         err_func(err_context, &c_error)             # <<<<<<<<<<<<<<
 * 
 *     c_ctxt.wellFormed = 0
 */
    __pyx_v_err_func(__pyx_v_err_context, (&__pyx_v_c_error));

    /* "src/lxml/parser.pxi":1252
 *     c_ctxt = <xmlparser.xmlParserCtxt *> ctxt
 *     err_func = xmlerror.xmlStructuredError
 *     if err_func:             # <<<<<<<<<<<<<<
 *         parser_input = c_ctxt.input
 *         # Copied from xmlVErrParser() in libxml2: get current input from stack.
 */
  }

  /* "src/lxml/parser.pxi":1277
 *         err_func(err_context, &c_error)
 * 
 *     c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *     # The entity was looked up and does not need to be freed.
 *     return NULL
 */
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "src/lxml/parser.pxi":1279
 *     c_ctxt.wellFormed = 0
 *     # The entity was looked up and does not need to be freed.
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1230
 * 
 * 
 * cdef tree.xmlEntity* _getInternalEntityOnly(void* ctxt, const_xmlChar* name) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Callback function to intercept the entity resolution when external entity loading is disabled.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1282
 * 
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__initSaxDocument(void *__pyx_v_ctxt) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlDoc *__pyx_v_c_doc;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  xmlDict *__pyx_v_c_dict;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDict *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_initSaxDocument", 0);

  /* "src/lxml/parser.pxi":1283
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:
 *     xmlparser.xmlSAX2StartDocument(ctxt)             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     c_doc = c_ctxt.myDoc
 */
  xmlSAX2StartDocument(__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1284
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     c_doc = c_ctxt.myDoc
 * 
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/parser.pxi":1285
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     c_doc = c_ctxt.myDoc             # <<<<<<<<<<<<<<
 * 
 *     # set up document dict
 */
  __pyx_t_1 = __pyx_v_c_ctxt->myDoc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":1288
 * 
 *     # set up document dict
 *     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
 */
  __pyx_t_3 = (__pyx_v_c_doc != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_ctxt->dict != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_doc->dict != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1290
 *     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;

    /* "src/lxml/parser.pxi":1291
 *         # 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_t_4 = __pyx_v_c_ctxt->dict;
    __pyx_v_c_doc->dict = __pyx_t_4;

    /* "src/lxml/parser.pxi":1292
 *         c_ctxt.dictNames = 1
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     # set up XML ID hash table
 */
    (void)(xmlDictReference(__pyx_v_c_ctxt->dict));

    /* "src/lxml/parser.pxi":1288
 * 
 *     # set up document dict
 *     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
 */
  }

  /* "src/lxml/parser.pxi":1295
 * 
 *     # set up XML ID hash table
 *     if c_ctxt._private:             # <<<<<<<<<<<<<<
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private != 0);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1296
 *     # set up XML ID hash table
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_c_ctxt->_private);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/parser.pxi":1297
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:             # <<<<<<<<<<<<<<
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:
 */
    if (__pyx_v_context->_collect_ids) {

      /* "src/lxml/parser.pxi":1299
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:             # <<<<<<<<<<<<<<
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 */
      __pyx_t_3 = (__pyx_v_c_doc != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_3 = (!(__pyx_v_c_doc->ids != 0));
      __pyx_t_2 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":1301
 *             if c_doc and not c_doc.ids:
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()             # <<<<<<<<<<<<<<
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 */
        __pyx_v_c_dict = xmlDictCreate();

        /* "src/lxml/parser.pxi":1302
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:             # <<<<<<<<<<<<<<
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)
 */
        __pyx_t_2 = (__pyx_v_c_dict != 0);
        if (__pyx_t_2) {

          /* "src/lxml/parser.pxi":1303
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_dict)
 *                 else:
 */
          __pyx_v_c_doc->ids = xmlHashCreateDict(0, __pyx_v_c_dict);

          /* "src/lxml/parser.pxi":1304
 *                 if c_dict:
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_doc.ids = tree.xmlHashCreate(0)
 */
          xmlDictFree(__pyx_v_c_dict);

          /* "src/lxml/parser.pxi":1302
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 *                 if c_dict:             # <<<<<<<<<<<<<<
 *                     c_doc.ids = tree.xmlHashCreateDict(0, c_dict)
 *                     xmlparser.xmlDictFree(c_dict)
 */
          goto __pyx_L12;
        }

        /* "src/lxml/parser.pxi":1306
 *                     xmlparser.xmlDictFree(c_dict)
 *                 else:
 *                     c_doc.ids = tree.xmlHashCreate(0)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
 */
        /*else*/ {
          __pyx_v_c_doc->ids = xmlHashCreate(0);
        }
        __pyx_L12:;

        /* "src/lxml/parser.pxi":1299
 *         if context._collect_ids:
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:             # <<<<<<<<<<<<<<
 *                 # memory errors are not fatal here
 *                 c_dict = xmlparser.xmlDictCreate()
 */
      }

      /* "src/lxml/parser.pxi":1297
 *     if c_ctxt._private:
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:             # <<<<<<<<<<<<<<
 *             # keep the global parser dict from filling up with XML IDs
 *             if c_doc and not c_doc.ids:
 */
      goto __pyx_L8;
    }

    /* "src/lxml/parser.pxi":1308
 *                     c_doc.ids = tree.xmlHashCreate(0)
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS             # <<<<<<<<<<<<<<
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):
 *                 # already initialised but empty => clear
 */
    /*else*/ {
      __pyx_v_c_ctxt->loadsubset = (__pyx_v_c_ctxt->loadsubset | XML_SKIP_IDS);

      /* "src/lxml/parser.pxi":1309
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):             # <<<<<<<<<<<<<<
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
 */
      __pyx_t_3 = (__pyx_v_c_doc != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_doc->ids != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (!(xmlHashSize(__pyx_v_c_doc->ids) != 0));
      __pyx_t_2 = __pyx_t_3;
      __pyx_L14_bool_binop_done:;
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":1311
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)             # <<<<<<<<<<<<<<
 *                 c_doc.ids = NULL
 * 
 */
        xmlHashFree(__pyx_v_c_doc->ids, NULL);

        /* "src/lxml/parser.pxi":1312
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
 *                 c_doc.ids = NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_v_c_doc->ids = NULL;

        /* "src/lxml/parser.pxi":1309
 *         else:
 *             c_ctxt.loadsubset |= xmlparser.XML_SKIP_IDS
 *             if c_doc and c_doc.ids and not tree.xmlHashSize(c_doc.ids):             # <<<<<<<<<<<<<<
 *                 # already initialised but empty => clear
 *                 tree.xmlHashFree(c_doc.ids, NULL)
 */
      }
    }
    __pyx_L8:;

    /* "src/lxml/parser.pxi":1295
 * 
 *     # set up XML ID hash table
 *     if c_ctxt._private:             # <<<<<<<<<<<<<<
 *         context = <_ParserContext>c_ctxt._private
 *         if context._collect_ids:
 */
  }

  /* "src/lxml/parser.pxi":1282
 * 
 * 
 * cdef void _initSaxDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     xmlparser.xmlSAX2StartDocument(ctxt)
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/parser.pxi":1322
 *     cdef bint _feed_parser_running
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def feed_error_log(self):
 *         """The error log of the last (or current) run of the feed parser.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/parser.pxi":1329
 *         different from what the ``error_log`` property returns.
 *         """
 *         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_ERR(2, 1329, __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_ERR(2, 1329, __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;

  /* "src/lxml/parser.pxi":1322
 *     cdef bint _feed_parser_running
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def feed_error_log(self):
 *         """The error log of the last (or current) run of the feed parser.
 */

  /* 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;
}

/* "src/lxml/parser.pxi":1331
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_v_bstring = 0;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  Py_ssize_t __pyx_v_ustart;
  const char *__pyx_v_char_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;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  long __pyx_v_fixup_error;
  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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  const char *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  xmlParserCtxt *__pyx_t_9;
  struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_t_12;
  char const *__pyx_t_13;
  __pyx_ctuple_int__and_int __pyx_t_14;
  int __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  char const *__pyx_t_17;
  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;
  int __pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("feed", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_11_FeedParser_1feed)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_data};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1331, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/parser.pxi":1357
 *         cdef int buffer_len
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(data, bytes):
 */
  __pyx_v_recover = (__pyx_v_self->__pyx_base._parse_options & XML_PARSE_RECOVER);

  /* "src/lxml/parser.pxi":1359
 *         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_6 = PyBytes_Check(__pyx_v_data); 
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1360
 * 
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_6 = (__pyx_v_self->__pyx_base._default_encoding == Py_None);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1361
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = self._default_encoding
 */
      __pyx_v_c_encoding = NULL;

      /* "src/lxml/parser.pxi":1360
 * 
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
      goto __pyx_L4;
    }

    /* "src/lxml/parser.pxi":1363
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 */
    /*else*/ {
      __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_self->__pyx_base._default_encoding); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 1363, __pyx_L1_error)
      __pyx_v_c_encoding = __pyx_t_7;
    }
    __pyx_L4:;

    /* "src/lxml/parser.pxi":1364
 *             else:
 *                 c_encoding = self._default_encoding
 *             char_data = _cstr(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
 */
    __pyx_v_char_data = PyBytes_AS_STRING(__pyx_v_data);

    /* "src/lxml/parser.pxi":1365
 *                 c_encoding = self._default_encoding
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *             ustart = 0
 *         elif isinstance(data, unicode):
 */
    __pyx_v_py_buffer_len = PyBytes_GET_SIZE(__pyx_v_data);

    /* "src/lxml/parser.pxi":1366
 *             char_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0             # <<<<<<<<<<<<<<
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"
 */
    __pyx_v_ustart = 0;

    /* "src/lxml/parser.pxi":1359
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 * 
 *         if isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             if self._default_encoding is None:
 *                 c_encoding = NULL
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1367
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
 *         elif isinstance(data, unicode):             # <<<<<<<<<<<<<<
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
 */
  __pyx_t_6 = PyUnicode_Check(__pyx_v_data); 
  if (likely(__pyx_t_6)) {

    /* "src/lxml/parser.pxi":1368
 *             ustart = 0
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"             # <<<<<<<<<<<<<<
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)
 */
    __pyx_v_c_encoding = ((const char *)"UTF-8");

    /* "src/lxml/parser.pxi":1369
 *         elif isinstance(data, unicode):
 *             c_encoding = b"UTF-8"
 *             char_data = NULL             # <<<<<<<<<<<<<<
 *             py_buffer_len = len(<unicode> data)
 *             ustart = 0
 */
    __pyx_v_char_data = NULL;

    /* "src/lxml/parser.pxi":1370
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)             # <<<<<<<<<<<<<<
 *             ustart = 0
 *         else:
 */
    if (unlikely(__pyx_v_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(2, 1370, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_PyUnicode_GET_LENGTH(((PyObject*)__pyx_v_data)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1370, __pyx_L1_error)
    __pyx_v_py_buffer_len = __pyx_t_8;

    /* "src/lxml/parser.pxi":1371
 *             char_data = NULL
 *             py_buffer_len = len(<unicode> data)
 *             ustart = 0             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "Parsing requires string data"
 */
    __pyx_v_ustart = 0;

    /* "src/lxml/parser.pxi":1367
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *             ustart = 0
 *         elif isinstance(data, unicode):             # <<<<<<<<<<<<<<
 *             c_encoding = b"UTF-8"
 *             char_data = NULL
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1373
 *             ustart = 0
 *         else:
 *             raise TypeError, "Parsing requires string data"             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Parsing_requires_string_data, 0, 0);
    __PYX_ERR(2, 1373, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1375
 *             raise TypeError, "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_ERR(2, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1376
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *         error = 0
 *         if not self._feed_parser_running:
 */
  __pyx_t_9 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_9;

  /* "src/lxml/parser.pxi":1377
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt
 *         error = 0             # <<<<<<<<<<<<<<
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)
 */
  __pyx_v_error = 0;

  /* "src/lxml/parser.pxi":1378
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1
 */
  __pyx_t_6 = (!__pyx_v_self->_feed_parser_running);
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1379
 *         error = 0
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.set_document_loader = 0;
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context, &__pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 1379, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1380
 *         if not self._feed_parser_running:
 *             context.prepare(set_document_loader=False)
 *             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;

    /* "src/lxml/parser.pxi":1382
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             # We have to give *mlCtxtResetPush() enough input to figure
 */
    __pyx_t_6 = (__pyx_v_self->__pyx_base._filename != ((PyObject*)Py_None));
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1381
 *             context.prepare(set_document_loader=False)
 *             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_11 = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {

      /* "src/lxml/parser.pxi":1382
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             # We have to give *mlCtxtResetPush() enough input to figure
 */
      __pyx_t_11 = NULL;
    }
    __pyx_v_c_filename = __pyx_t_11;

    /* "src/lxml/parser.pxi":1388
 *             # however if we give it all we got, we'll have nothing for
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0             # <<<<<<<<<<<<<<
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 */
    __pyx_v_buffer_len = 0;

    /* "src/lxml/parser.pxi":1389
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0
 *             if char_data is not NULL:             # <<<<<<<<<<<<<<
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 */
    __pyx_t_6 = (__pyx_v_char_data != NULL);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1390
 *             buffer_len = 0
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if self._for_html:
 */
      __pyx_t_6 = (__pyx_v_py_buffer_len > 4);
      if (__pyx_t_6) {
        __pyx_t_5 = 4;
      } else {
        __pyx_t_5 = ((int)__pyx_v_py_buffer_len);
      }
      __pyx_v_buffer_len = __pyx_t_5;

      /* "src/lxml/parser.pxi":1389
 *             # *mlParseChunk() and things go wrong.
 *             buffer_len = 0
 *             if char_data is not NULL:             # <<<<<<<<<<<<<<
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 */
    }

    /* "src/lxml/parser.pxi":1391
 *             if char_data is not NULL:
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(
 */
    __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

    /* "src/lxml/parser.pxi":1392
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
 */
    if (__pyx_v_self->__pyx_base._for_html) {

      /* "src/lxml/parser.pxi":1393
 *             orig_loader = _register_document_loader()
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
 *                     self._parse_options)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->__pyx_base._parse_options); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 1393, __pyx_L1_error)
      __pyx_v_error = __pyx_t_5;

      /* "src/lxml/parser.pxi":1392
 *                 buffer_len = 4 if py_buffer_len > 4 else <int>py_buffer_len
 *             orig_loader = _register_document_loader()
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding,
 */
      goto __pyx_L7;
    }

    /* "src/lxml/parser.pxi":1397
 *                     self._parse_options)
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 */
    /*else*/ {
      (void)(xmlCtxtUseOptions(__pyx_v_pctxt, __pyx_v_self->__pyx_base._parse_options));

      /* "src/lxml/parser.pxi":1398
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)
 *                 error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)
 */
      __pyx_v_error = xmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding);
    }
    __pyx_L7:;

    /* "src/lxml/parser.pxi":1400
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
 */
    __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

    /* "src/lxml/parser.pxi":1401
 *                     pctxt, char_data, buffer_len, c_filename, c_encoding)
 *             _reset_document_loader(orig_loader)
 *             py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *             char_data += buffer_len
 *             if error:
 */
    __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

    /* "src/lxml/parser.pxi":1402
 *             _reset_document_loader(orig_loader)
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len             # <<<<<<<<<<<<<<
 *             if error:
 *                 raise MemoryError()
 */
    __pyx_v_char_data = (__pyx_v_char_data + __pyx_v_buffer_len);

    /* "src/lxml/parser.pxi":1403
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
 *             if error:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
    __pyx_t_6 = (__pyx_v_error != 0);
    if (unlikely(__pyx_t_6)) {

      /* "src/lxml/parser.pxi":1404
 *             char_data += buffer_len
 *             if error:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
      PyErr_NoMemory(); __PYX_ERR(2, 1404, __pyx_L1_error)

      /* "src/lxml/parser.pxi":1403
 *             py_buffer_len -= buffer_len
 *             char_data += buffer_len
 *             if error:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
    }

    /* "src/lxml/parser.pxi":1405
 *             if error:
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 1405, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1378
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare(set_document_loader=False)
 *             self._feed_parser_running = 1
 */
  }

  /* "src/lxml/parser.pxi":1409
 *         #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):
 *             if char_data is NULL:
 */
  __pyx_v_fixup_error = 0;

  /* "src/lxml/parser.pxi":1410
 * 
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):             # <<<<<<<<<<<<<<
 *             if char_data is NULL:
 *                 # Unicode parsing by converting chunks to UTF-8
 */
  while (1) {
    __pyx_t_12 = (__pyx_v_py_buffer_len > 0);
    if (__pyx_t_12) {
    } else {
      __pyx_t_6 = __pyx_t_12;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_error == 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_6 = __pyx_t_12;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_6 = __pyx_v_recover;
    __pyx_L11_bool_binop_done:;
    if (!__pyx_t_6) break;

    /* "src/lxml/parser.pxi":1411
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             if char_data is NULL:             # <<<<<<<<<<<<<<
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 */
    __pyx_t_6 = (__pyx_v_char_data == NULL);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1413
 *             if char_data is NULL:
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB             # <<<<<<<<<<<<<<
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len
 */
      __pyx_v_buffer_len = 0x80000;

      /* "src/lxml/parser.pxi":1414
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')             # <<<<<<<<<<<<<<
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0
 */
      if (unlikely(__pyx_v_data == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(2, 1414, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyUnicode_Substring(((PyObject*)__pyx_v_data), __pyx_v_ustart, (__pyx_v_ustart + __pyx_v_buffer_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_bstring, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/parser.pxi":1415
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len  # may end up < 0
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))
 */
      __pyx_v_ustart = (__pyx_v_ustart + __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1416
 *                 bstring = (<unicode> data)[ustart : ustart+buffer_len].encode('UTF-8')
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0             # <<<<<<<<<<<<<<
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))
 *             else:
 */
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1417
 *                 ustart += buffer_len
 *                 py_buffer_len -= buffer_len  # may end up < 0
 *                 error, fixup_error = _parse_data_chunk(pctxt, <const char*> bstring, <int> len(bstring))             # <<<<<<<<<<<<<<
 *             else:
 *                 # Direct byte string parsing.
 */
      if (unlikely(__pyx_v_bstring == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(2, 1417, __pyx_L1_error)
      }
      __pyx_t_13 = __Pyx_PyBytes_AsString(__pyx_v_bstring); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(2, 1417, __pyx_L1_error)
      if (unlikely(__pyx_v_bstring == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(2, 1417, __pyx_L1_error)
      }
      __pyx_t_8 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1417, __pyx_L1_error)
      __pyx_t_14 = __pyx_f_4lxml_5etree__parse_data_chunk(__pyx_v_pctxt, ((char const *)__pyx_t_13), ((int)__pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1417, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_14.f0;
      __pyx_t_15 = __pyx_t_14.f1;
      __pyx_v_error = __pyx_t_5;
      __pyx_v_fixup_error = __pyx_t_15;

      /* "src/lxml/parser.pxi":1411
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             if char_data is NULL:             # <<<<<<<<<<<<<<
 *                 # Unicode parsing by converting chunks to UTF-8
 *                 buffer_len = 2**19  # len(bytes) <= 4 * (2**19) == 2 MiB
 */
      goto __pyx_L14;
    }

    /* "src/lxml/parser.pxi":1420
 *             else:
 *                 # Direct byte string parsing.
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX             # <<<<<<<<<<<<<<
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len
 */
    /*else*/ {
      __pyx_t_6 = (__pyx_v_py_buffer_len <= INT_MAX);
      if (__pyx_t_6) {
        __pyx_t_15 = ((int)__pyx_v_py_buffer_len);
      } else {
        __pyx_t_15 = INT_MAX;
      }
      __pyx_v_buffer_len = __pyx_t_15;

      /* "src/lxml/parser.pxi":1421
 *                 # Direct byte string parsing.
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len
 *                 char_data += buffer_len
 */
      __pyx_t_14 = __pyx_f_4lxml_5etree__parse_data_chunk(__pyx_v_pctxt, __pyx_v_char_data, __pyx_v_buffer_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1421, __pyx_L1_error)
      __pyx_t_15 = __pyx_t_14.f0;
      __pyx_t_5 = __pyx_t_14.f1;
      __pyx_v_error = __pyx_t_15;
      __pyx_v_fixup_error = __pyx_t_5;

      /* "src/lxml/parser.pxi":1422
 *                 buffer_len = <int>py_buffer_len if py_buffer_len <= limits.INT_MAX else limits.INT_MAX
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *                 char_data += buffer_len
 * 
 */
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

      /* "src/lxml/parser.pxi":1423
 *                 error, fixup_error = _parse_data_chunk(pctxt, char_data, buffer_len)
 *                 py_buffer_len -= buffer_len
 *                 char_data += buffer_len             # <<<<<<<<<<<<<<
 * 
 *             if fixup_error:
 */
      __pyx_v_char_data = (__pyx_v_char_data + __pyx_v_buffer_len);
    }
    __pyx_L14:;

    /* "src/lxml/parser.pxi":1425
 *                 char_data += buffer_len
 * 
 *             if fixup_error:             # <<<<<<<<<<<<<<
 *                 context.store_exception(MemoryError())
 * 
 */
    __pyx_t_6 = (__pyx_v_fixup_error != 0);
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1426
 * 
 *             if fixup_error:
 *                 context.store_exception(MemoryError())             # <<<<<<<<<<<<<<
 * 
 *             if context._has_raised():
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context), __pyx_n_s_store_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_MemoryError); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1426, __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;

      /* "src/lxml/parser.pxi":1425
 *                 char_data += buffer_len
 * 
 *             if fixup_error:             # <<<<<<<<<<<<<<
 *                 context.store_exception(MemoryError())
 * 
 */
    }

    /* "src/lxml/parser.pxi":1428
 *                 context.store_exception(MemoryError())
 * 
 *             if context._has_raised():             # <<<<<<<<<<<<<<
 *                 # propagate Python exceptions immediately
 *                 recover = 0
 */
    __pyx_t_6 = ((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)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1428, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1430
 *             if context._has_raised():
 *                 # propagate Python exceptions immediately
 *                 recover = 0             # <<<<<<<<<<<<<<
 *                 error = 1
 *                 break
 */
      __pyx_v_recover = 0;

      /* "src/lxml/parser.pxi":1431
 *                 # propagate Python exceptions immediately
 *                 recover = 0
 *                 error = 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_v_error = 1;

      /* "src/lxml/parser.pxi":1432
 *                 recover = 0
 *                 error = 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 */
      goto __pyx_L10_break;

      /* "src/lxml/parser.pxi":1428
 *                 context.store_exception(MemoryError())
 * 
 *             if context._has_raised():             # <<<<<<<<<<<<<<
 *                 # propagate Python exceptions immediately
 *                 recover = 0
 */
    }

    /* "src/lxml/parser.pxi":1434
 *                 break
 * 
 *             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():
 */
    __pyx_t_12 = (__pyx_v_error != 0);
    if (__pyx_t_12) {
    } else {
      __pyx_t_6 = __pyx_t_12;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_12 = (!__pyx_v_pctxt->replaceEntities);
    if (__pyx_t_12) {
    } else {
      __pyx_t_6 = __pyx_t_12;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_12 = (!__pyx_v_pctxt->validate);
    __pyx_t_6 = __pyx_t_12;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_6) {

      /* "src/lxml/parser.pxi":1436
 *             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_ERR(2, 1436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1436, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_8 = 0;
        __pyx_t_16 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1436, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_16 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(2, 1436, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_16)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 1436, __pyx_L1_error)
              #endif
              if (__pyx_t_8 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(2, 1436, __pyx_L1_error)
            #else
            __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1436, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(2, 1436, __pyx_L1_error)
              #endif
              if (__pyx_t_8 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(2, 1436, __pyx_L1_error)
            #else
            __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1436, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_16(__pyx_t_1);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(2, 1436, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/parser.pxi":1437
 *                 # 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_ERR(2, 1437, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1437, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_WAR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1437, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1437, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(2, 1437, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_12) {
        } else {
          __pyx_t_6 = __pyx_t_12;
          goto __pyx_L24_bool_binop_done;
        }

        /* "src/lxml/parser.pxi":1438
 *                 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_ERR(2, 1438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1438, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(2, 1438, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __pyx_t_12;
        __pyx_L24_bool_binop_done:;

        /* "src/lxml/parser.pxi":1437
 *                 # 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
 */
        if (__pyx_t_6) {

          /* "src/lxml/parser.pxi":1439
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = 0
 */
          goto __pyx_L22_break;

          /* "src/lxml/parser.pxi":1437
 *                 # 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
 */
        }

        /* "src/lxml/parser.pxi":1436
 *             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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L26_for_else;
      __pyx_L22_break:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L27_for_end;
      /*else*/ {
        __pyx_L26_for_else:;

        /* "src/lxml/parser.pxi":1441
 *                         break
 *                 else:
 *                     error = 0             # <<<<<<<<<<<<<<
 * 
 *         if not pctxt.wellFormed and pctxt.disableSAX and context._has_raised():
 */
        __pyx_v_error = 0;
      }
      __pyx_L27_for_end:;

      /* "src/lxml/parser.pxi":1434
 *                 break
 * 
 *             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():
 */
    }
  }
  __pyx_L10_break:;

  /* "src/lxml/parser.pxi":1443
 *                     error = 0
 * 
 *         if not pctxt.wellFormed and pctxt.disableSAX and context._has_raised():             # <<<<<<<<<<<<<<
 *             # propagate Python exceptions immediately
 *             recover = 0
 */
  __pyx_t_12 = (!__pyx_v_pctxt->wellFormed);
  if (__pyx_t_12) {
  } else {
    __pyx_t_6 = __pyx_t_12;
    goto __pyx_L29_bool_binop_done;
  }
  if (__pyx_v_pctxt->disableSAX) {
  } else {
    __pyx_t_6 = __pyx_v_pctxt->disableSAX;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_12 = ((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)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(2, 1443, __pyx_L1_error)
  __pyx_t_6 = __pyx_t_12;
  __pyx_L29_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1445
 *         if not pctxt.wellFormed and pctxt.disableSAX and context._has_raised():
 *             # propagate Python exceptions immediately
 *             recover = 0             # <<<<<<<<<<<<<<
 *             error = 1
 * 
 */
    __pyx_v_recover = 0;

    /* "src/lxml/parser.pxi":1446
 *             # propagate Python exceptions immediately
 *             recover = 0
 *             error = 1             # <<<<<<<<<<<<<<
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 */
    __pyx_v_error = 1;

    /* "src/lxml/parser.pxi":1443
 *                     error = 0
 * 
 *         if not pctxt.wellFormed and pctxt.disableSAX and context._has_raised():             # <<<<<<<<<<<<<<
 *             # propagate Python exceptions immediately
 *             recover = 0
 */
  }

  /* "src/lxml/parser.pxi":1448
 *             error = 1
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
 */
  __pyx_t_12 = (__pyx_v_fixup_error != 0);
  if (!__pyx_t_12) {
  } else {
    __pyx_t_6 = __pyx_t_12;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_12 = (!__pyx_v_recover);
  if (__pyx_t_12) {
  } else {
    __pyx_t_6 = __pyx_t_12;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_error != 0);
  if (!__pyx_t_12) {
  } else {
    __pyx_t_6 = __pyx_t_12;
    goto __pyx_L33_bool_binop_done;
  }
  __pyx_t_12 = (!__pyx_v_pctxt->wellFormed);
  __pyx_t_6 = __pyx_t_12;
  __pyx_L33_bool_binop_done:;
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1449
 * 
 *         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;

    /* "src/lxml/parser.pxi":1450
 *         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:*/ {

      /* "src/lxml/parser.pxi":1451
 *             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_ERR(2, 1451, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "src/lxml/parser.pxi":1453
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 *             finally:
 *                 context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cpdef close(self):
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 1453, __pyx_L1_error)
        goto __pyx_L39;
      }
      __pyx_L38_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_18);
        __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_t_5 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
        {
          __pyx_t_24 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(2, 1453, __pyx_L41_error)
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
        __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
        __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_17;
        goto __pyx_L1_error;
        __pyx_L41_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L39:;
    }

    /* "src/lxml/parser.pxi":1448
 *             error = 1
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
 */
  }

  /* "src/lxml/parser.pxi":1331
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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_bstring);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_11_FeedParser_1feed = {"feed", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_FeedParser_1feed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_FeedParser_feed};
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("feed (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1331, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "feed") < 0)) __PYX_ERR(2, 1331, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("feed", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 1331, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_feed(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11_FeedParser_feed(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1331, __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;
}

/* "src/lxml/parser.pxi":1455
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlParserCtxt *__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", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_11_FeedParser_3close)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1455, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "src/lxml/parser.pxi":1466
 *         parser interface, all other usage is undefined.
 *         """
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 */
  __pyx_t_6 = (!__pyx_v_self->_feed_parser_running);
  if (unlikely(__pyx_t_6)) {

    /* "src/lxml/parser.pxi":1467
 *         """
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError("no element found",             # <<<<<<<<<<<<<<
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                                  self._filename)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "src/lxml/parser.pxi":1468
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,             # <<<<<<<<<<<<<<
 *                                  self._filename)
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_From_xmlParserErrors(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/parser.pxi":1469
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 *                                  self._filename)             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_4, __pyx_kp_u_no_element_found, __pyx_t_3, __pyx_int_0, __pyx_int_0, __pyx_v_self->__pyx_base._filename};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 5+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1467, __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_ERR(2, 1467, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1466
 *         parser interface, all other usage is undefined.
 *         """
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError("no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0,
 */
  }

  /* "src/lxml/parser.pxi":1471
 *                                  self._filename)
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 * 
 */
  __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_ERR(2, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1472
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 * 
 *         self._feed_parser_running = 0
 */
  __pyx_t_7 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_7;

  /* "src/lxml/parser.pxi":1474
 *         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;

  /* "src/lxml/parser.pxi":1475
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 */
  if (__pyx_v_self->__pyx_base._for_html) {

    /* "src/lxml/parser.pxi":1476
 *         self._feed_parser_running = 0
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 */
    (void)(htmlParseChunk(__pyx_v_pctxt, NULL, 0, 1));

    /* "src/lxml/parser.pxi":1475
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/parser.pxi":1478
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and
 */
  /*else*/ {
    (void)(xmlParseChunk(__pyx_v_pctxt, NULL, 0, 1));
  }
  __pyx_L4:;

  /* "src/lxml/parser.pxi":1480
 *             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) {
  } else {
    __pyx_t_6 = __pyx_v_pctxt->recovery;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_8 = (!__pyx_v_pctxt->disableSAX);
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L6_bool_binop_done;
  }

  /* "src/lxml/parser.pxi":1481
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and
 *                 isinstance(context, _SaxParserContext)):             # <<<<<<<<<<<<<<
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()
 */
  __pyx_t_8 = __Pyx_TypeCheck(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__SaxParserContext); 
  __pyx_t_6 = __pyx_t_8;
  __pyx_L6_bool_binop_done:;

  /* "src/lxml/parser.pxi":1480
 *             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_t_6) {

    /* "src/lxml/parser.pxi":1483
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_5 = ((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_5 == ((int)-1))) __PYX_ERR(2, 1483, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1480
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and             # <<<<<<<<<<<<<<
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
 */
  }

  /* "src/lxml/parser.pxi":1485
 *             (<_SaxParserContext>context).flushEvents()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 */
  /*try:*/ {

    /* "src/lxml/parser.pxi":1486
 * 
 *         try:
 *             result = 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_ERR(2, 1486, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "src/lxml/parser.pxi":1488
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(result, _Document):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 1488, __pyx_L1_error)
      goto __pyx_L11;
    }
    __pyx_L10_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_2); __pyx_t_2 = 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_5 = __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 == ((int)-1))) __PYX_ERR(2, 1488, __pyx_L13_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_5; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L13_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_L11:;
  }

  /* "src/lxml/parser.pxi":1490
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
 */
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_4lxml_5etree__Document); 
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":1491
 * 
 *         if isinstance(result, _Document):
 *             return (<_Document>result).getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             return result
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_result)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1490
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
 */
  }

  /* "src/lxml/parser.pxi":1493
 *             return (<_Document>result).getroot()
 *         else:
 *             return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":1455
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(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_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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_11_FeedParser_3close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_FeedParser_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_FeedParser_2close};
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11_FeedParser_close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1455, __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;
}

/* "src/lxml/parser.pxi":1496
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 */

static __pyx_ctuple_int__and_int __pyx_f_4lxml_5etree__parse_data_chunk(xmlParserCtxt *__pyx_v_c_ctxt, char const *__pyx_v_char_data, int __pyx_v_buffer_len) {
  long __pyx_v_fixup_error;
  xmlNode *__pyx_v_c_node;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_v_error;
  __pyx_ctuple_int__and_int __pyx_r;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDict *__pyx_t_4;
  __pyx_ctuple_int__and_int __pyx_t_5;

  /* "src/lxml/parser.pxi":1498
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0             # <<<<<<<<<<<<<<
 *     with nogil:
 *         if c_ctxt.html:
 */
  __pyx_v_fixup_error = 0;

  /* "src/lxml/parser.pxi":1499
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/parser.pxi":1500
 *     fixup_error = 0
 *     with nogil:
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
 */
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/parser.pxi":1501
 *     with nogil:
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 */
          __pyx_t_1 = __pyx_v_c_ctxt->node;
          __pyx_v_c_node = __pyx_t_1;

          /* "src/lxml/parser.pxi":1502
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
 */
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/parser.pxi":1503
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
 */
          __pyx_v_error = htmlParseChunk(__pyx_v_c_ctxt, __pyx_v_char_data, __pyx_v_buffer_len, 0);

          /* "src/lxml/parser.pxi":1504
 *             orig_loader = _register_document_loader()
 *             error = htmlparser.htmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:
 */
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

          /* "src/lxml/parser.pxi":1506
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:             # <<<<<<<<<<<<<<
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 */
          __pyx_t_2 = (__pyx_v_c_ctxt->myDoc != 0);
          if (__pyx_t_2) {

            /* "src/lxml/parser.pxi":1507
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:
 *                 fixup_error = _fixHtmlDictSubtreeNames(             # <<<<<<<<<<<<<<
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
 */
            __pyx_v_fixup_error = __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->myDoc, __pyx_v_c_node);

            /* "src/lxml/parser.pxi":1509
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 */
            __pyx_t_3 = (__pyx_v_c_ctxt->myDoc->dict != 0);
            if (__pyx_t_3) {
            } else {
              __pyx_t_2 = __pyx_t_3;
              goto __pyx_L9_bool_binop_done;
            }
            __pyx_t_3 = (__pyx_v_c_ctxt->myDoc->dict != __pyx_v_c_ctxt->dict);
            __pyx_t_2 = __pyx_t_3;
            __pyx_L9_bool_binop_done:;
            if (__pyx_t_2) {

              /* "src/lxml/parser.pxi":1510
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)             # <<<<<<<<<<<<<<
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
 */
              xmlDictFree(__pyx_v_c_ctxt->myDoc->dict);

              /* "src/lxml/parser.pxi":1511
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
 *         else:
 */
              __pyx_t_4 = __pyx_v_c_ctxt->dict;
              __pyx_v_c_ctxt->myDoc->dict = __pyx_t_4;

              /* "src/lxml/parser.pxi":1512
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 *                     xmlparser.xmlDictReference(c_ctxt.dict)             # <<<<<<<<<<<<<<
 *         else:
 *             orig_loader = _register_document_loader()
 */
              (void)(xmlDictReference(__pyx_v_c_ctxt->dict));

              /* "src/lxml/parser.pxi":1509
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 *                 if c_ctxt.myDoc.dict and c_ctxt.myDoc.dict is not c_ctxt.dict:             # <<<<<<<<<<<<<<
 *                     xmlparser.xmlDictFree(c_ctxt.myDoc.dict)
 *                     c_ctxt.myDoc.dict = c_ctxt.dict
 */
            }

            /* "src/lxml/parser.pxi":1506
 *             _reset_document_loader(orig_loader)
 *             # and now for the fun part: move node names to the dict
 *             if c_ctxt.myDoc:             # <<<<<<<<<<<<<<
 *                 fixup_error = _fixHtmlDictSubtreeNames(
 *                     c_ctxt.dict, c_ctxt.myDoc, c_node)
 */
          }

          /* "src/lxml/parser.pxi":1500
 *     fixup_error = 0
 *     with nogil:
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             c_node = c_ctxt.node  # last node where the parser stopped
 *             orig_loader = _register_document_loader()
 */
          goto __pyx_L6;
        }

        /* "src/lxml/parser.pxi":1514
 *                     xmlparser.xmlDictReference(c_ctxt.dict)
 *         else:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
 */
        /*else*/ {
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/parser.pxi":1515
 *         else:
 *             orig_loader = _register_document_loader()
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *     return (error, fixup_error)
 */
          __pyx_v_error = xmlParseChunk(__pyx_v_c_ctxt, __pyx_v_char_data, __pyx_v_buffer_len, 0);

          /* "src/lxml/parser.pxi":1516
 *             orig_loader = _register_document_loader()
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *     return (error, fixup_error)
 * 
 */
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
        }
        __pyx_L6:;
      }

      /* "src/lxml/parser.pxi":1499
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             c_node = c_ctxt.node  # last node where the parser stopped
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "src/lxml/parser.pxi":1517
 *             error = xmlparser.xmlParseChunk(c_ctxt, char_data, buffer_len, 0)
 *             _reset_document_loader(orig_loader)
 *     return (error, fixup_error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5.f0 = __pyx_v_error;
  __pyx_t_5.f1 = __pyx_v_fixup_error;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1496
 * 
 * 
 * cdef (int, int) _parse_data_chunk(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                                   const char* char_data, int buffer_len):
 *     fixup_error = 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1520
 * 
 * 
 * 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;
  int __pyx_t_1;

  /* "src/lxml/parser.pxi":1526
 *     cdef xmlparser.xmlParserInput* c_input_stream
 *     # libxml2 lacks an HTML push parser setup function
 *     error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:
 */
  __pyx_v_error = xmlCtxtResetPush(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding);

  /* "src/lxml/parser.pxi":1528
 *     error = xmlparser.xmlCtxtResetPush(
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
 */
  __pyx_t_1 = (__pyx_v_error != 0);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1529
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:
 *         return error             # <<<<<<<<<<<<<<
 * 
 *     # fix libxml2 setup for HTML
 */
    __pyx_r = __pyx_v_error;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1528
 *     error = xmlparser.xmlCtxtResetPush(
 *         c_ctxt, c_data, buffer_len, c_filename, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
 */
  }

  /* "src/lxml/parser.pxi":1532
 * 
 *     # 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;

  /* "src/lxml/parser.pxi":1533
 *     # 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;

  /* "src/lxml/parser.pxi":1534
 *     c_ctxt.progressive = 1
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
  (void)(htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_parse_options));

  /* "src/lxml/parser.pxi":1536
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1520
 * 
 * 
 * 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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1600
 *     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_collect_ids = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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_collect_ids,&__pyx_n_s_target,&__pyx_n_s_compact,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/parser.pxi":1601
 *     """
 *     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='internal',
 */
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1602
 *     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='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 */
    values[5] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[7] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

    /* "src/lxml/parser.pxi":1603
 *                  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='internal',             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):
 */
    values[8] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[9] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[10] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_u_internal));

    /* "src/lxml/parser.pxi":1604
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, target=None, compact=True):
 *         cdef int parse_options
 */
    values[11] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[12] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[13] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1605
 *                  huge_tree=False, remove_blank_text=False, resolve_entities='internal',
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  collect_ids=True, target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         cdef bint resolve_external = True
 */
    values[14] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[15] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[16] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 17)) {
        Py_ssize_t index;
        for (index = 0; index < 17 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1600, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "__init__") < 0)) __PYX_ERR(2, 1600, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 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_collect_ids = values[14];
    __pyx_v_target = values[15];
    __pyx_v_compact = values[16];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1600, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 1602, __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_collect_ids, __pyx_v_target, __pyx_v_compact);

  /* "src/lxml/parser.pxi":1600
 *     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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_collect_ids, PyObject *__pyx_v_target, PyObject *__pyx_v_compact) {
  int __pyx_v_parse_options;
  int __pyx_v_resolve_external;
  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;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/parser.pxi":1607
 *                  collect_ids=True, target=None, compact=True):
 *         cdef int parse_options
 *         cdef bint resolve_external = True             # <<<<<<<<<<<<<<
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
 */
  __pyx_v_resolve_external = 1;

  /* "src/lxml/parser.pxi":1608
 *         cdef int parse_options
 *         cdef bint resolve_external = True
 *         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;

  /* "src/lxml/parser.pxi":1609
 *         cdef bint resolve_external = True
 *         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_ERR(2, 1609, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1610
 *         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);

    /* "src/lxml/parser.pxi":1609
 *         cdef bint resolve_external = True
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 */
  }

  /* "src/lxml/parser.pxi":1611
 *         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_ERR(2, 1611, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1612
 *             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);

    /* "src/lxml/parser.pxi":1611
 *         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
 */
  }

  /* "src/lxml/parser.pxi":1614
 *             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_ERR(2, 1614, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1615
 *                             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);

    /* "src/lxml/parser.pxi":1616
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/parser.pxi":1617
 *             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);

      /* "src/lxml/parser.pxi":1616
 *         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:
 */
    }

    /* "src/lxml/parser.pxi":1614
 *             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:
 */
  }

  /* "src/lxml/parser.pxi":1618
 *             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_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_clean); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1618, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1619
 *                 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);

    /* "src/lxml/parser.pxi":1618
 *             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:
 */
  }

  /* "src/lxml/parser.pxi":1620
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1620, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1621
 *             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);

    /* "src/lxml/parser.pxi":1620
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1622
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1622, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1623
 *             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);

    /* "src/lxml/parser.pxi":1622
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1624
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1624, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1625
 *             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);

    /* "src/lxml/parser.pxi":1624
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1626
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1626, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1627
 *             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);

    /* "src/lxml/parser.pxi":1626
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1628
 *         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_2 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1628, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1629
 *             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);

    /* "src/lxml/parser.pxi":1628
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1630
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_resolve_entities); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1630, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1631
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT             # <<<<<<<<<<<<<<
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOENT);

    /* "src/lxml/parser.pxi":1630
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
 */
    goto __pyx_L13;
  }

  /* "src/lxml/parser.pxi":1632
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':             # <<<<<<<<<<<<<<
 *             resolve_external = False
 *         if not strip_cdata:
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_resolve_entities, __pyx_n_u_internal, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1632, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1633
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':
 *             resolve_external = False             # <<<<<<<<<<<<<<
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 */
    __pyx_v_resolve_external = 0;

    /* "src/lxml/parser.pxi":1632
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         elif resolve_entities == 'internal':             # <<<<<<<<<<<<<<
 *             resolve_external = False
 *         if not strip_cdata:
 */
  }
  __pyx_L13:;

  /* "src/lxml/parser.pxi":1634
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1634, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1635
 *             resolve_external = False
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, False, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOCDATA);

    /* "src/lxml/parser.pxi":1634
 *         elif resolve_entities == 'internal':
 *             resolve_external = False
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 */
  }

  /* "src/lxml/parser.pxi":1637
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 *         _BaseParser.__init__(self, parse_options, False, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding, resolve_external)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__BaseParser), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/parser.pxi":1639
 *         _BaseParser.__init__(self, parse_options, False, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding, resolve_external)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_resolve_external); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[12] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_t_5, Py_False, ((PyObject *)__pyx_v_schema), __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_encoding, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 11+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1637, __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;

  /* "src/lxml/parser.pxi":1600
 *     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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1660
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_events,&__pyx_n_s_tag,&__pyx_n_s_base_url,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_events);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1660, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1660, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(2, 1660, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1660, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "src/lxml/parser.pxi":1661
 *     """
 *     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 *)__pyx_ptype_4lxml_5etree_XMLParser), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(2, 1661, __pyx_L1_error);
  __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1661, __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;

  /* "src/lxml/parser.pxi":1662
 *     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);
  if (__pyx_t_5) {

    /* "src/lxml/parser.pxi":1663
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
    __Pyx_INCREF(__pyx_tuple__58);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_tuple__58);

    /* "src/lxml/parser.pxi":1662
 *     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)
 */
  }

  /* "src/lxml/parser.pxi":1664
 *         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_ERR(2, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/parser.pxi":1665
 *             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_ERR(2, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/parser.pxi":1660
 *     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;
}

/* "src/lxml/parser.pxi":1667
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_13XMLPullParser_3read_events = {"read_events", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("read_events", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "read_events", 0))) return NULL;
  __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", 1);

  /* "src/lxml/parser.pxi":1668
 * 
 *     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_ERR(2, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__SaxParserContext)))) __PYX_ERR(2, 1668, __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;

  /* "src/lxml/parser.pxi":1667
 *         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;
}

/* "src/lxml/parser.pxi":1686
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/parser.pxi":1687
 *     """
 *     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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1688
 *     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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[7] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/parser.pxi":1689
 *                  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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[9] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[10] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1690
 *                  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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[12] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[13] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1691
 *                  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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[15] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1686, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "__init__") < 0)) __PYX_ERR(2, 1686, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1686, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/parser.pxi":1686
 *     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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/parser.pxi":1692
 *                  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 *)__pyx_ptype_4lxml_5etree_XMLParser), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(2, 1692, __pyx_L1_error);

  /* "src/lxml/parser.pxi":1693
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,             # <<<<<<<<<<<<<<
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(16); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attribute_defaults, __pyx_v_attribute_defaults) < 0) __PYX_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1694
 *         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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1695
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1696
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1697
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1698
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1699
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1700
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1701
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1702
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1703
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1704
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1705
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1706
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1707
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1708
 *                            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_ERR(2, 1693, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1692
 *                  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_ERR(2, 1692, __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;

  /* "src/lxml/parser.pxi":1686
 *     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;
}

/* "src/lxml/parser.pxi":1719
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_47set_default_parser(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_46set_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_47set_default_parser = {"set_default_parser", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_47set_default_parser, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_46set_default_parser};
static PyObject *__pyx_pw_4lxml_5etree_47set_default_parser(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1719, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_default_parser") < 0)) __PYX_ERR(2, 1719, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_default_parser", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1719, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 1719, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_46set_default_parser(__pyx_self, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_46set_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_default_parser", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1731
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1732
 *     """
 *     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));

    /* "src/lxml/parser.pxi":1731
 *     parser for each thread explicitly or use a parser pool.
 *     """
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 */
  }

  /* "src/lxml/parser.pxi":1733
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)             # <<<<<<<<<<<<<<
 * 
 * def get_default_parser():
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_parser); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1733, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1719
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.set_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1735
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_49get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_48get_default_parser, "get_default_parser()");
static PyMethodDef __pyx_mdef_4lxml_5etree_49get_default_parser = {"get_default_parser", (PyCFunction)__pyx_pw_4lxml_5etree_49get_default_parser, METH_NOARGS, __pyx_doc_4lxml_5etree_48get_default_parser};
static PyObject *__pyx_pw_4lxml_5etree_49get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_parser (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_48get_default_parser(__pyx_self);

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

static PyObject *__pyx_pf_4lxml_5etree_48get_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", 1);

  /* "src/lxml/parser.pxi":1737
 * def get_default_parser():
 *     "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_ERR(2, 1737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1735
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "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;
}

/* "src/lxml/parser.pxi":1786
 *     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;
  PyObject *__pyx_v_default_doctype = 0;
  PyObject *__pyx_v_collect_ids = 0;
  PyObject *__pyx_v_huge_tree = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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,&__pyx_n_s_default_doctype,&__pyx_n_s_collect_ids,&__pyx_n_s_huge_tree,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/parser.pxi":1787
 *     """
 *     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, default_doctype=True,
 */
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1788
 *     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, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):
 */
    values[5] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[7] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));

    /* "src/lxml/parser.pxi":1789
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,             # <<<<<<<<<<<<<<
 *                  collect_ids=True, huge_tree=False):
 *         cdef int parse_options
 */
    values[8] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[9] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[10] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/parser.pxi":1790
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True, default_doctype=True,
 *                  collect_ids=True, huge_tree=False):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 */
    values[11] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[12] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 13)) {
        Py_ssize_t index;
        for (index = 0; index < 13 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1786, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "__init__") < 0)) __PYX_ERR(2, 1786, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 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];
    __pyx_v_default_doctype = values[10];
    __pyx_v_collect_ids = values[11];
    __pyx_v_huge_tree = values[12];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(2, 1786, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(2, 1788, __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, __pyx_v_default_doctype, __pyx_v_collect_ids, __pyx_v_huge_tree);

  /* "src/lxml/parser.pxi":1786
 *     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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, PyObject *__pyx_v_default_doctype, PyObject *__pyx_v_collect_ids, PyObject *__pyx_v_huge_tree) {
  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;
  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__", 1);

  /* "src/lxml/parser.pxi":1792
 *                  collect_ids=True, huge_tree=False):
 *         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;

  /* "src/lxml/parser.pxi":1793
 *         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_ERR(2, 1793, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1794
 *         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);

    /* "src/lxml/parser.pxi":1793
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1795
 *         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_ERR(2, 1795, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1796
 *             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);

    /* "src/lxml/parser.pxi":1795
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1797
 *         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_ERR(2, 1797, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1798
 *             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);

    /* "src/lxml/parser.pxi":1797
 *         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:
 */
  }

  /* "src/lxml/parser.pxi":1799
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1799, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1800
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_COMPACT);

    /* "src/lxml/parser.pxi":1799
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
 */
  }

  /* "src/lxml/parser.pxi":1801
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_default_doctype); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1801, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1802
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_NODEFDTD);

    /* "src/lxml/parser.pxi":1801
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 *         if not default_doctype:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
 */
  }

  /* "src/lxml/parser.pxi":1803
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1803, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1804
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, True, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);

    /* "src/lxml/parser.pxi":1803
 *         if not default_doctype:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 * 
 */
  }

  /* "src/lxml/parser.pxi":1806
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 * 
 *         _BaseParser.__init__(self, parse_options, True, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__BaseParser), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/parser.pxi":1808
 *         _BaseParser.__init__(self, parse_options, True, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              collect_ids, target, encoding)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[11] = {__pyx_t_6, ((PyObject *)__pyx_v_self), __pyx_t_5, Py_True, ((PyObject *)__pyx_v_schema), __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_collect_ids, __pyx_v_target, __pyx_v_encoding};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 10+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1806, __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;

  /* "src/lxml/parser.pxi":1786
 *     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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1833
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_events,&__pyx_n_s_tag,&__pyx_n_s_base_url,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_events);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1833, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1833, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(2, 1833, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(2, 1833, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "src/lxml/parser.pxi":1834
 *     """
 *     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 *)__pyx_ptype_4lxml_5etree_HTMLParser), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(2, 1834, __pyx_L1_error);
  __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1834, __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;

  /* "src/lxml/parser.pxi":1835
 *     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);
  if (__pyx_t_5) {

    /* "src/lxml/parser.pxi":1836
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
    __Pyx_INCREF(__pyx_tuple__58);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_tuple__58);

    /* "src/lxml/parser.pxi":1835
 *     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)
 */
  }

  /* "src/lxml/parser.pxi":1837
 *         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_ERR(2, 1837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/parser.pxi":1838
 *             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_ERR(2, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/parser.pxi":1833
 *     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;
}

/* "src/lxml/parser.pxi":1840
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14HTMLPullParser_3read_events = {"read_events", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("read_events", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "read_events", 0))) return NULL;
  __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", 1);

  /* "src/lxml/parser.pxi":1841
 * 
 *     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_ERR(2, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__SaxParserContext)))) __PYX_ERR(2, 1841, __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;

  /* "src/lxml/parser.pxi":1840
 *         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;
}

/* "src/lxml/parser.pxi":1848
 * ############################################################
 * 
 * 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;
  PyObject *__pyx_v_filename_utf = NULL;
  xmlDoc *__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;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1852
 *     cdef char* c_text
 *     cdef Py_ssize_t c_len
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1853
 *     cdef Py_ssize_t c_len
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     if not filename:
 *         c_filename = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1852
 *     cdef char* c_text
 *     cdef Py_ssize_t c_len
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 */
  }

  /* "src/lxml/parser.pxi":1854
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(2, 1854, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "src/lxml/parser.pxi":1855
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 *         c_filename = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 */
    __pyx_v_c_filename = NULL;

    /* "src/lxml/parser.pxi":1854
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/parser.pxi":1857
 *         c_filename = NULL
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_filename_utf = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1858
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         if python.PyUnicode_IS_READY(text):
 */
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename_utf);
  }
  __pyx_L4:;

  /* "src/lxml/parser.pxi":1859
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if python.PyUnicode_IS_READY(text):
 *             # PEP-393 Unicode string
 */
  __pyx_t_3 = PyUnicode_Check(__pyx_v_text); 
  if (__pyx_t_3) {

    /* "src/lxml/parser.pxi":1860
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):
 *         if python.PyUnicode_IS_READY(text):             # <<<<<<<<<<<<<<
 *             # PEP-393 Unicode string
 *             c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)
 */
    __pyx_t_3 = PyUnicode_IS_READY(__pyx_v_text);
    if (__pyx_t_3) {

      /* "src/lxml/parser.pxi":1862
 *         if python.PyUnicode_IS_READY(text):
 *             # PEP-393 Unicode string
 *             c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)             # <<<<<<<<<<<<<<
 *         else:
 *             # old Py_UNICODE string
 */
      __pyx_v_c_len = (PyUnicode_GET_LENGTH(__pyx_v_text) * PyUnicode_KIND(__pyx_v_text));

      /* "src/lxml/parser.pxi":1860
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):
 *         if python.PyUnicode_IS_READY(text):             # <<<<<<<<<<<<<<
 *             # PEP-393 Unicode string
 *             c_len = python.PyUnicode_GET_LENGTH(text) * python.PyUnicode_KIND(text)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/parser.pxi":1865
 *         else:
 *             # old Py_UNICODE string
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)             # <<<<<<<<<<<<<<
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
    /*else*/ {
      __pyx_v_c_len = PyUnicode_GET_DATA_SIZE(__pyx_v_text);
    }
    __pyx_L6:;

    /* "src/lxml/parser.pxi":1866
 *             # old Py_UNICODE string
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)
 */
    __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
    if (__pyx_t_3) {

      /* "src/lxml/parser.pxi":1868
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)             # <<<<<<<<<<<<<<
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 *     else:
 */
      __Pyx_INCREF(__pyx_v_4lxml_5etree_StringIO);
      __pyx_t_4 = __pyx_v_4lxml_5etree_StringIO; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_text};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1868, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }

      /* "src/lxml/parser.pxi":1867
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                 StringIO(text), filename, None)
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 */
      __pyx_t_7 = ((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_2, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_7 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1867, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":1866
 *             # old Py_UNICODE string
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)
 */
    }

    /* "src/lxml/parser.pxi":1869
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)             # <<<<<<<<<<<<<<
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 */
    __pyx_t_7 = ((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_7 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1869, __pyx_L1_error)
    __pyx_r = __pyx_t_7;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1859
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if python.PyUnicode_IS_READY(text):
 *             # PEP-393 Unicode string
 */
  }

  /* "src/lxml/parser.pxi":1871
 *         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(
 */
  /*else*/ {
    __pyx_v_c_len = PyBytes_GET_SIZE(__pyx_v_text);

    /* "src/lxml/parser.pxi":1872
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, None)
 */
    __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
    if (__pyx_t_3) {

      /* "src/lxml/parser.pxi":1874
 *         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_INCREF(__pyx_v_4lxml_5etree_BytesIO);
      __pyx_t_4 = __pyx_v_4lxml_5etree_BytesIO; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_text};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1874, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }

      /* "src/lxml/parser.pxi":1873
 *         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_7 = ((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_2, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_7 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1873, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":1872
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, None)
 */
    }

    /* "src/lxml/parser.pxi":1875
 *             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);

    /* "src/lxml/parser.pxi":1876
 *                 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_7 = ((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_7 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1876, __pyx_L1_error)
    __pyx_r = __pyx_t_7;
    goto __pyx_L0;
  }

  /* "src/lxml/parser.pxi":1848
 * ############################################################
 * 
 * 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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._parseDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1878
 *         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;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1879
 * 
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1880
 * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1879
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 */
  }

  /* "src/lxml/parser.pxi":1881
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 */
  __pyx_t_3 = ((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_3 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1881, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1878
 *         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_2);
  __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;
}

/* "src/lxml/parser.pxi":1883
 *     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;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "src/lxml/parser.pxi":1885
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1886
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/parser.pxi":1885
 * 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)
 */
  }

  /* "src/lxml/parser.pxi":1887
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:
 */
  __pyx_t_3 = ((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_3 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1887, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1883
 *     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_2);
  __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;
}

/* "src/lxml/parser.pxi":1889
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1891
 * cdef xmlDoc* _newXMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
 */
  __pyx_v_result = xmlNewDoc(NULL);

  /* "src/lxml/parser.pxi":1892
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1893
 *     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_ERR(2, 1893, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1892
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     if result.encoding is NULL:
 */
  }

  /* "src/lxml/parser.pxi":1894
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1895
 *         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 *)((char const *)"UTF-8"))));

    /* "src/lxml/parser.pxi":1894
 *     if result is NULL:
 *         raise MemoryError()
 *     if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  }

  /* "src/lxml/parser.pxi":1896
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1896, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1897
 *         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;

  /* "src/lxml/parser.pxi":1889
 *     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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1899
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1901
 * 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);

  /* "src/lxml/parser.pxi":1902
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1903
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    PyErr_NoMemory(); __PYX_ERR(2, 1903, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1902
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  }

  /* "src/lxml/parser.pxi":1904
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1904, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1905
 *         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;

  /* "src/lxml/parser.pxi":1899
 *     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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1907
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1909
 * 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) {

    /* "src/lxml/parser.pxi":1910
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/parser.pxi":1911
 *     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);
        }

        /* "src/lxml/parser.pxi":1910
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "src/lxml/parser.pxi":1909
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:
 *     cdef xmlDoc* result
 *     if recursive:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1913
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
 */
  /*else*/ {
    __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1914
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1915
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    PyErr_NoMemory(); __PYX_ERR(2, 1915, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1914
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  }

  /* "src/lxml/parser.pxi":1916
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1916, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1917
 *         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;

  /* "src/lxml/parser.pxi":1907
 *     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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1919
 *     return result
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1923
 *     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);

  /* "src/lxml/parser.pxi":1924
 *     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_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 1924, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1925
 *     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;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/parser.pxi":1926
 *     __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);
      }

      /* "src/lxml/parser.pxi":1925
 *     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
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "src/lxml/parser.pxi":1927
 *     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_2 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/parser.pxi":1928
 *         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_ERR(2, 1928, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1927
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)
 */
  }

  /* "src/lxml/parser.pxi":1929
 *     if c_node is NULL:
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)             # <<<<<<<<<<<<<<
 *     _copyTail(c_new_root.next, c_node)
 *     return result
 */
  (void)(xmlDocSetRootElement(__pyx_v_result, __pyx_v_c_node));

  /* "src/lxml/parser.pxi":1930
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_new_root->next, __pyx_v_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 1930, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1931
 *     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;

  /* "src/lxml/parser.pxi":1919
 *     return result
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     "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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1933
 *     return result
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     "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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/parser.pxi":1936
 *     "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);

  /* "src/lxml/parser.pxi":1937
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/parser.pxi":1938
 *     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_ERR(2, 1938, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1937
 *     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)
 */
  }

  /* "src/lxml/parser.pxi":1939
 *     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 == ((int)-1))) __PYX_ERR(2, 1939, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1940
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
 *     return c_root             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_root;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1933
 *     return result
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     "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:;
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1947
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     source = _getFSPathOrObject(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
  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_t_6;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  const char *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocument", 0);
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_INCREF(__pyx_v_base_url);

  /* "src/lxml/parser.pxi":1949
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)             # <<<<<<<<<<<<<<
 *     if _isString(source):
 *         # parse the file directly from the filesystem
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_source); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parser.pxi":1950
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 */
  __pyx_t_2 = _isString(__pyx_v_source);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1952
 *     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_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_t_1, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/parser.pxi":1954
 *         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_2 = (__pyx_v_base_url != Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1955
 *         # 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_ERR(2, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_base_url, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/parser.pxi":1956
 *         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_2 = (__pyx_v_doc->_c_doc->URL != NULL);
      if (__pyx_t_2) {

        /* "src/lxml/parser.pxi":1957
 *             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));

        /* "src/lxml/parser.pxi":1956
 *         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))
 */
      }

      /* "src/lxml/parser.pxi":1958
 *             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));

      /* "src/lxml/parser.pxi":1954
 *         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:
 */
    }

    /* "src/lxml/parser.pxi":1959
 *                 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;

    /* "src/lxml/parser.pxi":1950
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 */
  }

  /* "src/lxml/parser.pxi":1961
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
 */
  __pyx_t_2 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1962
 * 
 *     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;

    /* "src/lxml/parser.pxi":1961
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/parser.pxi":1964
 *         url = base_url
 *     else:
 *         url = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_url = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/parser.pxi":1966
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 */
  __pyx_t_4 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_u_getvalue); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1966, __pyx_L1_error)
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_u_tell); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1966, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1968
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(source.getvalue(), url, parser)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_tell); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_t_2 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 1968, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "src/lxml/parser.pxi":1969
 *         # 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1969, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1969, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_t_3, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1969, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "src/lxml/parser.pxi":1968
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(source.getvalue(), url, parser)
 * 
 */
    }

    /* "src/lxml/parser.pxi":1966
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, 'getvalue') and hasattr(source, 'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 */
  }

  /* "src/lxml/parser.pxi":1972
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 */
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_u_read); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 1972, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/parser.pxi":1973
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):
 *         return _parseFilelikeDocument(source, url, parser)             # <<<<<<<<<<<<<<
 * 
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"
 */
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseFilelikeDocument(__pyx_v_source, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/parser.pxi":1972
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 */
  }

  /* "src/lxml/parser.pxi":1975
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 *     raise TypeError, f"cannot parse from '{python._fqtypename(source).decode('UTF-8')}'"             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = 0;
  __pyx_t_8 = 127;
  __Pyx_INCREF(__pyx_kp_u_cannot_parse_from);
  __pyx_t_7 += 19;
  __Pyx_GIVEREF(__pyx_kp_u_cannot_parse_from);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_cannot_parse_from);
  __pyx_t_9 = _fqtypename(__pyx_v_source);
  __pyx_t_10 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(2, 1975, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_10, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_8;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_kp_u__25);
  __pyx_t_7 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__25);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__25);
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(2, 1975, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1947
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     source = _getFSPathOrObject(source)
 */

  /* 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._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_source);
  __Pyx_XDECREF(__pyx_v_base_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parser.pxi":1977
 *     raise TypeError, f"cannot parse from '{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", 1);

  /* "src/lxml/parser.pxi":1978
 * 
 * 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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1978, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":1979
 * 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_ERR(2, 1979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1977
 *     raise TypeError, f"cannot parse from '{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;
}

/* "src/lxml/parser.pxi":1981
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseMemoryDocument", 1);

  /* "src/lxml/parser.pxi":1982
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_text); 
  if (__pyx_t_1) {

    /* "src/lxml/parser.pxi":1983
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Unicode strings with encoding declaration are not supported. "
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__hasEncodingDeclaration(__pyx_v_text); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 1983, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/parser.pxi":1984
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1984, __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_ERR(2, 1984, __pyx_L1_error)

      /* "src/lxml/parser.pxi":1983
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Unicode strings with encoding declaration are not supported. "
 */
    }

    /* "src/lxml/parser.pxi":1982
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(
 */
    goto __pyx_L3;
  }

  /* "src/lxml/parser.pxi":1987
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
 *     elif not isinstance(text, bytes):             # <<<<<<<<<<<<<<
 *         raise ValueError, "can only parse strings"
 *     c_doc = _parseDoc(text, url, parser)
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_text); 
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/parser.pxi":1988
 *                 "Please use bytes input or XML fragments without declaration.")
 *     elif not isinstance(text, bytes):
 *         raise ValueError, "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_ERR(2, 1988, __pyx_L1_error)

    /* "src/lxml/parser.pxi":1987
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
 *     elif not isinstance(text, bytes):             # <<<<<<<<<<<<<<
 *         raise ValueError, "can only parse strings"
 *     c_doc = _parseDoc(text, url, parser)
 */
  }
  __pyx_L3:;

  /* "src/lxml/parser.pxi":1989
 *     elif not isinstance(text, bytes):
 *         raise ValueError, "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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1989, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_4;

  /* "src/lxml/parser.pxi":1990
 *         raise ValueError, "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_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1981
 *     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_2);
  __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;
}

/* "src/lxml/parser.pxi":1992
 *     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", 1);

  /* "src/lxml/parser.pxi":1993
 * 
 * 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 == ((xmlDoc *)NULL))) __PYX_ERR(2, 1993, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/parser.pxi":1994
 * 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_ERR(2, 1994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/parser.pxi":1992
 *     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;
}

/* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23XMLSyntaxAssertionError_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23XMLSyntaxAssertionError_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 10, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 10, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(3, 10, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(3, 10, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(3, 10, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.XMLSyntaxAssertionError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(__pyx_self, __pyx_v_self, __pyx_v_message);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_23XMLSyntaxAssertionError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  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("__init__", 1);

  /* "src/lxml/saxparser.pxi":11
 *     """
 *     def __init__(self, message):
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_v_self, __pyx_v_message, Py_None, __pyx_int_0, __pyx_int_1};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 5+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 11, __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;

  /* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XMLSyntaxAssertionError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":33
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter = 0
 *     for event in events:
 */

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;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseEventFilter", 1);

  /* "src/lxml/saxparser.pxi":34
 * 
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0             # <<<<<<<<<<<<<<
 *     for event in events:
 *         if event == 'start':
 */
  __pyx_v_event_filter = 0;

  /* "src/lxml/saxparser.pxi":35
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 */
  if (likely(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_ERR(3, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 35, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 35, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(3, 35, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 35, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(3, 35, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 35, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/saxparser.pxi":36
 *     cdef int event_filter = 0
 *     for event in events:
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 36, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":37
 *     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);

      /* "src/lxml/saxparser.pxi":36
 *     cdef int event_filter = 0
 *     for event in events:
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":38
 *         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_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_end, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 38, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":39
 *             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);

      /* "src/lxml/saxparser.pxi":38
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":40
 *         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_PyUnicode_Equals(__pyx_v_event, __pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 40, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":41
 *             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);

      /* "src/lxml/saxparser.pxi":40
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":42
 *         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_PyUnicode_Equals(__pyx_v_event, __pyx_kp_u_end_ns, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 42, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":43
 *             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);

      /* "src/lxml/saxparser.pxi":42
 *         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':
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":44
 *         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_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_comment, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 44, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/saxparser.pxi":45
 *             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);

      /* "src/lxml/saxparser.pxi":44
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":46
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_pi, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(3, 46, __pyx_L1_error)
    if (likely(__pyx_t_5)) {

      /* "src/lxml/saxparser.pxi":47
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
 *             event_filter |= PARSE_EVENT_FILTER_PI             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI);

      /* "src/lxml/saxparser.pxi":46
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 */
      goto __pyx_L5;
    }

    /* "src/lxml/saxparser.pxi":49
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"             # <<<<<<<<<<<<<<
 *     return event_filter
 * 
 */
    /*else*/ {
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 0;
      __pyx_t_7 = 127;
      __Pyx_INCREF(__pyx_kp_u_invalid_event_name);
      __pyx_t_6 += 20;
      __Pyx_GIVEREF(__pyx_kp_u_invalid_event_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_invalid_event_name);
      __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_event, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7;
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_6 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__25);
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_8, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(3, 49, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "src/lxml/saxparser.pxi":35
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":50
 *         else:
 *             raise ValueError, f"invalid event name '{event}'"
 *     return event_filter             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_event_filter;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":33
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter = 0
 *     for event in events:
 */

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

/* "src/lxml/saxparser.pxi":56
 *     cdef int _sax_event_filter
 * 
 *     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", 1);

  /* "src/lxml/saxparser.pxi":57
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":56
 *     cdef int _sax_event_filter
 * 
 *     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;
}

/* "src/lxml/saxparser.pxi":58
 *     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", 1);

  /* "src/lxml/saxparser.pxi":59
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":58
 *     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;
}

/* "src/lxml/saxparser.pxi":60
 *     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;

  /* "src/lxml/saxparser.pxi":61
 *         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;

  /* "src/lxml/saxparser.pxi":60
 *     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:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":62
 *     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;

  /* "src/lxml/saxparser.pxi":63
 *         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;

  /* "src/lxml/saxparser.pxi":62
 *     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:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":64
 *     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", 1);

  /* "src/lxml/saxparser.pxi":65
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":64
 *     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;
}

/* "src/lxml/saxparser.pxi":66
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
 */

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", 1);

  /* "src/lxml/saxparser.pxi":67
 *         return None
 *     cdef _handleSaxComment(self, comment):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":66
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
 */

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

/* "src/lxml/saxparser.pxi":68
 *     cdef _handleSaxComment(self, comment):
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix, CYTHON_UNUSED PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxStartNs", 1);

  /* "src/lxml/saxparser.pxi":69
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEndNs(self, prefix):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":68
 *     cdef _handleSaxComment(self, comment):
 *         return None
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
 */

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

/* "src/lxml/saxparser.pxi":70
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_prefix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxEndNs", 1);

  /* "src/lxml/saxparser.pxi":71
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":70
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return None
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "src/lxml/saxparser.pxi":103
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 103, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(3, 103, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 103, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(3, 103, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/saxparser.pxi":104
 * 
 *     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_ERR(3, 104, __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;

  /* "src/lxml/saxparser.pxi":105
 *     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_ERR(3, 105, __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;

  /* "src/lxml/saxparser.pxi":106
 *         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((PyObject *)__pyx_v_self->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "src/lxml/saxparser.pxi":107
 *         self._node_stack = []
 *         self._parser = parser
 *         self.events_iterator = _ParseEventsIterator()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ParseEventsIterator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/saxparser.pxi":103
 *     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;
}

/* "src/lxml/saxparser.pxi":109
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:             # <<<<<<<<<<<<<<
 *         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", 1);

  /* "src/lxml/saxparser.pxi":110
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:
 *         self._target = target             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 */
  __Pyx_INCREF((PyObject *)__pyx_v_target);
  __Pyx_GIVEREF((PyObject *)__pyx_v_target);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_target);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_target);
  __pyx_v_self->_target = __pyx_v_target;

  /* "src/lxml/saxparser.pxi":109
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target) noexcept:             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
 */

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

/* "src/lxml/saxparser.pxi":112
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         _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) {
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":113
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _ParserContext._initParserContext(self, c_ctxt)             # <<<<<<<<<<<<<<
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 */
  __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self), __pyx_v_c_ctxt);

  /* "src/lxml/saxparser.pxi":114
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":115
 *         _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);

    /* "src/lxml/saxparser.pxi":114
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:             # <<<<<<<<<<<<<<
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":116
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:             # <<<<<<<<<<<<<<
 *             self._connectEvents(c_ctxt)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":117
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
 *             self._connectEvents(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 */
    ((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);

    /* "src/lxml/saxparser.pxi":116
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:             # <<<<<<<<<<<<<<
 *             self._connectEvents(c_ctxt)
 * 
 */
  }
  __pyx_L3:;

  /* "src/lxml/saxparser.pxi":112
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
 */

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":119
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to call into parser target.
 *         """
 */

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;
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  internalSubsetSAXFunc __pyx_t_3;

  /* "src/lxml/saxparser.pxi":122
 *         """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;

  /* "src/lxml/saxparser.pxi":123
 *         """
 *         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;

  /* "src/lxml/saxparser.pxi":124
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & (SAX_EVENT_START |
 *                                              SAX_EVENT_START_NS |
 */
  __pyx_v_self->_origSaxStartNoNs = NULL;
  __pyx_v_sax->startElement = NULL;

  /* "src/lxml/saxparser.pxi":125
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_START |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_START_NS |
 *                                              SAX_EVENT_END_NS):
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & ((__pyx_e_4lxml_5etree_SAX_EVENT_START | __pyx_e_4lxml_5etree_SAX_EVENT_START_NS) | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS)) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":130
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 */
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":131
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart             # <<<<<<<<<<<<<<
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 *                 sax.startElement = _handleSaxTargetStartNoNs
 */
      __pyx_v_sax->startElementNs = __pyx_f_4lxml_5etree__handleSaxTargetStart;

      /* "src/lxml/saxparser.pxi":130
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 */
    }

    /* "src/lxml/saxparser.pxi":132
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *                 sax.startElement = _handleSaxTargetStartNoNs
 * 
 */
    __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":133
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:
 *                 sax.startElement = _handleSaxTargetStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
 */
      __pyx_v_sax->startElement = __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs;

      /* "src/lxml/saxparser.pxi":132
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart
 *             if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *                 sax.startElement = _handleSaxTargetStartNoNs
 * 
 */
    }

    /* "src/lxml/saxparser.pxi":125
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_START |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_START_NS |
 *                                              SAX_EVENT_END_NS):
 */
  }

  /* "src/lxml/saxparser.pxi":135
 *                 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;

  /* "src/lxml/saxparser.pxi":136
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
 */
  __pyx_v_self->_origSaxEndNoNs = NULL;
  __pyx_v_sax->endElement = NULL;

  /* "src/lxml/saxparser.pxi":137
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_END |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & (__pyx_e_4lxml_5etree_SAX_EVENT_END | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS)) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":139
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 */
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":140
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd             # <<<<<<<<<<<<<<
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 *                 sax.endElement = _handleSaxEndNoNs
 */
      __pyx_v_sax->endElementNs = __pyx_f_4lxml_5etree__handleSaxEnd;

      /* "src/lxml/saxparser.pxi":139
 *         if self._target._sax_event_filter & (SAX_EVENT_END |
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 */
    }

    /* "src/lxml/saxparser.pxi":141
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 sax.endElement = _handleSaxEndNoNs
 * 
 */
    __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":142
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:
 *                 sax.endElement = _handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 */
      __pyx_v_sax->endElement = __pyx_f_4lxml_5etree__handleSaxEndNoNs;

      /* "src/lxml/saxparser.pxi":141
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 sax.endElement = _handleSaxEndNoNs
 * 
 */
    }

    /* "src/lxml/saxparser.pxi":137
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & (SAX_EVENT_END |             # <<<<<<<<<<<<<<
 *                                              SAX_EVENT_END_NS):
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 */
  }

  /* "src/lxml/saxparser.pxi":144
 *                 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;

  /* "src/lxml/saxparser.pxi":145
 * 
 *         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) {

    /* "src/lxml/saxparser.pxi":146
 *         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;

    /* "src/lxml/saxparser.pxi":145
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             sax.characters = sax.cdataBlock = _handleSaxData
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":149
 * 
 *         # 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;

  /* "src/lxml/saxparser.pxi":150
 *         # 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) {

    /* "src/lxml/saxparser.pxi":151
 *         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;

    /* "src/lxml/saxparser.pxi":150
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:             # <<<<<<<<<<<<<<
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":153
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxTargetPI
 */
  __pyx_v_self->_origSaxPI = NULL;
  __pyx_v_sax->processingInstruction = NULL;

  /* "src/lxml/saxparser.pxi":154
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_PI) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":155
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxTargetPI             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment = NULL
 */
    __pyx_v_sax->processingInstruction = __pyx_f_4lxml_5etree__handleSaxTargetPI;

    /* "src/lxml/saxparser.pxi":154
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":157
 *             sax.processingInstruction = _handleSaxTargetPI
 * 
 *         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;

  /* "src/lxml/saxparser.pxi":158
 * 
 *         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) {

    /* "src/lxml/saxparser.pxi":159
 *         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;

    /* "src/lxml/saxparser.pxi":158
 * 
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _handleSaxTargetComment
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":162
 * 
 *         # enforce entity replacement
 *         sax.reference = NULL             # <<<<<<<<<<<<<<
 *         c_ctxt.replaceEntities = 1
 * 
 */
  __pyx_v_sax->reference = NULL;

  /* "src/lxml/saxparser.pxi":163
 *         # enforce entity replacement
 *         sax.reference = NULL
 *         c_ctxt.replaceEntities = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 */
  __pyx_v_c_ctxt->replaceEntities = 1;

  /* "src/lxml/saxparser.pxi":119
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to call into parser target.
 *         """
 */

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":165
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
 */

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;
  xmlSAXHandler *__pyx_t_1;
  startDocumentSAXFunc __pyx_t_2;
  startElementNsSAX2Func __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  startElementSAXFunc __pyx_t_6;
  endElementNsSAX2Func __pyx_t_7;
  endElementSAXFunc __pyx_t_8;
  commentSAXFunc __pyx_t_9;
  processingInstructionSAXFunc __pyx_t_10;

  /* "src/lxml/saxparser.pxi":168
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
 *         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;

  /* "src/lxml/saxparser.pxi":169
 *         """
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument             # <<<<<<<<<<<<<<
 *         sax.startDocument = _handleSaxStartDocument
 * 
 */
  __pyx_t_2 = __pyx_v_sax->startDocument;
  __pyx_v_self->_origSaxStartDocument = __pyx_t_2;

  /* "src/lxml/saxparser.pxi":170
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument             # <<<<<<<<<<<<<<
 * 
 *         # only override "start" event handler if needed
 */
  __pyx_v_sax->startDocument = __pyx_f_4lxml_5etree__handleSaxStartDocument;

  /* "src/lxml/saxparser.pxi":173
 * 
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 */
  __pyx_t_3 = __pyx_v_sax->startElementNs;
  __pyx_v_self->_origSaxStart = __pyx_t_3;

  /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html 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) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  if (!__pyx_v_c_ctxt->html) {
  } else {
    __pyx_t_4 = __pyx_v_c_ctxt->html;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":175
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_START_NS |
 */
  __pyx_t_5 = ((__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);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
 */
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":179
 *                                      PARSE_EVENT_FILTER_START_NS |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxStartNoNs = sax.startElement
 */
    __pyx_v_sax->startElementNs = ((startElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxStart);

    /* "src/lxml/saxparser.pxi":174
 *         # only override "start" event handler if needed
 *         self._origSaxStart = sax.startElementNs
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
 */
  }

  /* "src/lxml/saxparser.pxi":181
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart
 * 
 *         self._origSaxStartNoNs = sax.startElement             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 */
  __pyx_t_6 = __pyx_v_sax->startElement;
  __pyx_v_self->_origSaxStartNoNs = __pyx_t_6;

  /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html 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) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  if (!__pyx_v_c_ctxt->html) {
  } else {
    __pyx_t_4 = __pyx_v_c_ctxt->html;
    goto __pyx_L8_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":183
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END):
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs
 */
  __pyx_t_5 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
 */
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":185
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         # only override "end" event handler if needed
 */
    __pyx_v_sax->startElement = ((startElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxStartNoNs);

    /* "src/lxml/saxparser.pxi":182
 * 
 *         self._origSaxStartNoNs = sax.startElement
 *         if self._event_filter == 0 or c_ctxt.html or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END):
 */
  }

  /* "src/lxml/saxparser.pxi":188
 * 
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or \
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 */
  __pyx_t_7 = __pyx_v_sax->endElementNs;
  __pyx_v_self->_origSaxEnd = __pyx_t_7;

  /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 */
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L12_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":190
 *         self._origSaxEnd = sax.endElementNs
 *         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);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L12_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 */
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":192
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEndNoNs = sax.endElement
 */
    __pyx_v_sax->endElementNs = ((endElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxEnd);

    /* "src/lxml/saxparser.pxi":189
 *         # only override "end" event handler if needed
 *         self._origSaxEnd = sax.endElementNs
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 */
  }

  /* "src/lxml/saxparser.pxi":194
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd
 * 
 *         self._origSaxEndNoNs = sax.endElement             # <<<<<<<<<<<<<<
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 */
  __pyx_t_8 = __pyx_v_sax->endElement;
  __pyx_v_self->_origSaxEndNoNs = __pyx_t_8;

  /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 */
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L15_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":196
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L15_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 */
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":197
 *         if self._event_filter == 0 or \
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment
 */
    __pyx_v_sax->endElement = ((endElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxEndNoNs);

    /* "src/lxml/saxparser.pxi":195
 * 
 *         self._origSaxEndNoNs = sax.endElement
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & PARSE_EVENT_FILTER_END:
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 */
  }

  /* "src/lxml/saxparser.pxi":199
 *             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;

  /* "src/lxml/saxparser.pxi":200
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
 */
  __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":201
 *         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);

    /* "src/lxml/saxparser.pxi":200
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":203
 *             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;

  /* "src/lxml/saxparser.pxi":204
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 */
  __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
  if (__pyx_t_4) {

    /* "src/lxml/saxparser.pxi":205
 *         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);

    /* "src/lxml/saxparser.pxi":204
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":165
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         """Wrap original SAX2 callbacks to collect parse events without parser target.
 *         """
 */

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":207
 *             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;
  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("_setEventFilter", 1);

  /* "src/lxml/saxparser.pxi":208
 * 
 *     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 == ((int)-1))) __PYX_ERR(3, 208, __pyx_L1_error)
  __pyx_v_self->_event_filter = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":209
 *     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_3 = (!(__pyx_v_self->_event_filter != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_kp_u__22, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(3, 209, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":210
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);

    /* "src/lxml/saxparser.pxi":209
 *     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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":212
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 */
  /*else*/ {
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_tag)) __PYX_ERR(3, 212, __pyx_L1_error);
    __pyx_t_5 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 212, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF((PyObject *)__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/saxparser.pxi":207
 *             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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/saxparser.pxi":214
 *             self._matcher = _MultiTagMatcher.__new__(_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;
  struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("startDocument", 1);

  /* "src/lxml/saxparser.pxi":215
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 *         try:             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_doc, self._parser)
 *         finally:
 */
  /*try:*/ {

    /* "src/lxml/saxparser.pxi":216
 *     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_ERR(3, 216, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__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;
  }

  /* "src/lxml/saxparser.pxi":218
 *             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((PyObject *)__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;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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((PyObject *)__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:;
  }

  /* "src/lxml/saxparser.pxi":219
 *         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);
  if (__pyx_t_12) {

    /* "src/lxml/saxparser.pxi":220
 *             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_13.__pyx_n = 1;
    __pyx_t_13.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_13); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/saxparser.pxi":219
 *         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
 */
  }

  /* "src/lxml/saxparser.pxi":221
 *         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;

  /* "src/lxml/saxparser.pxi":214
 *             self._matcher = _MultiTagMatcher.__new__(_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;
}

/* "src/lxml/saxparser.pxi":223
 *         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;
  PyObject *__pyx_t_2 = NULL;
  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("pushEvent", 1);

  /* "src/lxml/saxparser.pxi":225
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":226
 *         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_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->__pyx_base._doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 226, __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_ERR(3, 226, __pyx_L1_error)
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/saxparser.pxi":227
 *         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_3 = (((PyObject *)__pyx_v_root) != Py_None);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_root->_c_node->type == XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":228
 *             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((PyObject *)__pyx_v_self->_root);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_root);
      __pyx_v_self->_root = __pyx_v_root;

      /* "src/lxml/saxparser.pxi":227
 *         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)
 */
    }

    /* "src/lxml/saxparser.pxi":225
 *     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:
 */
  }

  /* "src/lxml/saxparser.pxi":229
 *             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_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":230
 *                 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 '%.30s'", "append");
    __PYX_ERR(3, 230, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_event);
  __Pyx_GIVEREF(__pyx_v_event);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_event)) __PYX_ERR(3, 230, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_node);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_node))) __PYX_ERR(3, 230, __pyx_L1_error);
  __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->events_iterator->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(3, 230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":231
 *         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;

  /* "src/lxml/saxparser.pxi":223
 *         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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/saxparser.pxi":233
 *         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", 1);

  /* "src/lxml/saxparser.pxi":234
 * 
 *     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;

  /* "src/lxml/saxparser.pxi":235
 *     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;

    /* "src/lxml/saxparser.pxi":236
 *         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 '%.30s'", "append");
      __PYX_ERR(3, 236, __pyx_L1_error)
    }
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
      __PYX_ERR(3, 236, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_u_end);
    __Pyx_GIVEREF(__pyx_n_u_end);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_end)) __PYX_ERR(3, 236, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(3, 236, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_events, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":237
 *         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 == ((int)-1))) __PYX_ERR(3, 237, __pyx_L1_error)
  }

  /* "src/lxml/saxparser.pxi":238
 *             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;

    /* "src/lxml/saxparser.pxi":239
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:
 *             _pushSaxNsEndEvents(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_self); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(3, 239, __pyx_L1_error)
  }

  /* "src/lxml/saxparser.pxi":233
 *         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;
}

/* "src/lxml/saxparser.pxi":241
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":242
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":243
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         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;

    /* "src/lxml/saxparser.pxi":242
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 */
  }

  /* "src/lxml/saxparser.pxi":245
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
 */
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "src/lxml/saxparser.pxi":246
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
 *         self._store_raised()
 */
  __pyx_v_c_ctxt->disableSAX = 1;

  /* "src/lxml/saxparser.pxi":247
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF             # <<<<<<<<<<<<<<
 *         self._store_raised()
 * 
 */
  __pyx_v_c_ctxt->instate = XML_PARSER_EOF;

  /* "src/lxml/saxparser.pxi":248
 *         c_ctxt.disableSAX = 1
 *         c_ctxt.instate = xmlparser.XML_PARSER_EOF
 *         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));

  /* "src/lxml/saxparser.pxi":241
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */

  /* function exit code */
}

/* "src/lxml/saxparser.pxi":258
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/saxparser.pxi":259
 * 
 *     def __cinit__(self):
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._event_index = 0
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 259, __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;

  /* "src/lxml/saxparser.pxi":260
 *     def __cinit__(self):
 *         self._events = []
 *         self._event_index = 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->_event_index = 0;

  /* "src/lxml/saxparser.pxi":258
 *     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;
}

/* "src/lxml/saxparser.pxi":262
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/saxparser.pxi":263
 * 
 *     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;

  /* "src/lxml/saxparser.pxi":262
 *         self._event_index = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "src/lxml/saxparser.pxi":265
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int event_index = self._event_index
 *         events = self._events
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_v_event_index;
  PyObject *__pyx_v_events = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);

  /* "src/lxml/saxparser.pxi":266
 * 
 *     def __next__(self):
 *         cdef int event_index = self._event_index             # <<<<<<<<<<<<<<
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 */
  __pyx_t_1 = __pyx_v_self->_event_index;
  __pyx_v_event_index = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":267
 *     def __next__(self):
 *         cdef int event_index = self._event_index
 *         events = self._events             # <<<<<<<<<<<<<<
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:
 */
  __pyx_t_2 = __pyx_v_self->_events;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_events = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":268
 *         cdef int event_index = self._event_index
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):             # <<<<<<<<<<<<<<
 *             if event_index:
 *                 # clean up from time to time
 */
  __pyx_t_4 = (__pyx_v_event_index >= 0x400);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_events == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 268, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(3, 268, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_v_event_index * 2) >= __pyx_t_5);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/saxparser.pxi":269
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:             # <<<<<<<<<<<<<<
 *                 # clean up from time to time
 *                 del events[:event_index]
 */
    __pyx_t_3 = (__pyx_v_event_index != 0);
    if (__pyx_t_3) {

      /* "src/lxml/saxparser.pxi":271
 *             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_ERR(3, 271, __pyx_L1_error)
      }
      if (__Pyx_PyObject_DelSlice(__pyx_v_events, 0, __pyx_v_event_index, NULL, NULL, NULL, 0, 1, 1) < 0) __PYX_ERR(3, 271, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":272
 *                 # 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_v_event_index = 0;

      /* "src/lxml/saxparser.pxi":269
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):
 *             if event_index:             # <<<<<<<<<<<<<<
 *                 # clean up from time to time
 *                 del events[:event_index]
 */
    }

    /* "src/lxml/saxparser.pxi":273
 *                 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_ERR(3, 273, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(3, 273, __pyx_L1_error)
    __pyx_t_3 = (__pyx_v_event_index >= __pyx_t_5);
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/saxparser.pxi":274
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *         item = events[event_index]
 *         self._event_index = event_index + 1
 */
      __pyx_error_without_exception = 1;
      goto __pyx_L1_error;;

      /* "src/lxml/saxparser.pxi":273
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *         item = events[event_index]
 */
    }

    /* "src/lxml/saxparser.pxi":268
 *         cdef int event_index = self._event_index
 *         events = self._events
 *         if event_index >= 2**10 or event_index * 2 >= len(events):             # <<<<<<<<<<<<<<
 *             if event_index:
 *                 # clean up from time to time
 */
  }

  /* "src/lxml/saxparser.pxi":275
 *             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_ERR(3, 275, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_events, __pyx_v_event_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_item = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":276
 *                 raise StopIteration
 *         item = events[event_index]
 *         self._event_index = event_index + 1             # <<<<<<<<<<<<<<
 *         return item
 * 
 */
  __pyx_v_self->_event_index = (__pyx_v_event_index + 1);

  /* "src/lxml/saxparser.pxi":277
 *         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;

  /* "src/lxml/saxparser.pxi":265
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int event_index = self._event_index
 *         events = self._events
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __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_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":280
 * 
 * 
 * cdef list _build_prefix_uri_list(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                                  const_xmlChar** c_namespaces):
 *     "Build [(prefix, uri)] list of declared namespaces."
 */

static PyObject *__pyx_f_4lxml_5etree__build_prefix_uri_list(CYTHON_UNUSED 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_namespaces = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_prefix_uri_list", 1);

  /* "src/lxml/saxparser.pxi":284
 *     "Build [(prefix, uri)] list of declared namespaces."
 *     cdef int i
 *     namespaces = []             # <<<<<<<<<<<<<<
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":285
 *     cdef int i
 *     namespaces = []
 *     for i in xrange(c_nb_namespaces):             # <<<<<<<<<<<<<<
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2
 */
  __pyx_t_2 = __pyx_v_c_nb_namespaces;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "src/lxml/saxparser.pxi":286
 *     namespaces = []
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))             # <<<<<<<<<<<<<<
 *         c_namespaces += 2
 *     return namespaces
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_namespaces[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1)) __PYX_ERR(3, 286, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(3, 286, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/saxparser.pxi":287
 *     for i in xrange(c_nb_namespaces):
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2             # <<<<<<<<<<<<<<
 *     return namespaces
 * 
 */
    __pyx_v_c_namespaces = (__pyx_v_c_namespaces + 2);
  }

  /* "src/lxml/saxparser.pxi":288
 *         namespaces.append((funicodeOrEmpty(c_namespaces[0]), funicode(c_namespaces[1])))
 *         c_namespaces += 2
 *     return namespaces             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_namespaces);
  __pyx_r = __pyx_v_namespaces;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":280
 * 
 * 
 * cdef list _build_prefix_uri_list(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                                  const_xmlChar** c_namespaces):
 *     "Build [(prefix, uri)] list of declared namespaces."
 */

  /* 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._build_prefix_uri_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":291
 * 
 * 
 * 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;
  int __pyx_v_event_filter;
  PyObject *__pyx_v_declared_namespaces = NULL;
  PyObject *__pyx_v_prefix_uri_tuple = 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;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "src/lxml/saxparser.pxi":299
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":300
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":301
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":300
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":302
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     cdef int event_filter = context._event_filter
 *     try:
 */
  __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;

  /* "src/lxml/saxparser.pxi":303
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter             # <<<<<<<<<<<<<<
 *     try:
 *         if (c_nb_namespaces and
 */
  __pyx_t_4 = __pyx_v_context->_event_filter;
  __pyx_v_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
 */
        __pyx_t_2 = (__pyx_v_c_nb_namespaces != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L16_bool_binop_done;
        }

        /* "src/lxml/saxparser.pxi":306
 *     try:
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |             # <<<<<<<<<<<<<<
 *                                 PARSE_EVENT_FILTER_END_NS)):
 *             declared_namespaces = _build_prefix_uri_list(
 */
        __pyx_t_2 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L16_bool_binop_done:;

        /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
 */
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":308
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
 *             declared_namespaces = _build_prefix_uri_list(             # <<<<<<<<<<<<<<
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 */
          __pyx_t_3 = __pyx_f_4lxml_5etree__build_prefix_uri_list(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 308, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":310
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 */
          __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":311
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
 */
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(3, 311, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 311, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(3, 311, __pyx_L9_error)
              #else
              __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 311, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              #endif
              __Pyx_XDECREF_SET(__pyx_v_prefix_uri_tuple, __pyx_t_9);
              __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":312
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))             # <<<<<<<<<<<<<<
 *         else:
 *             declared_namespaces = None
 */
              if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
                __PYX_ERR(3, 312, __pyx_L9_error)
              }
              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 312, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_INCREF(__pyx_kp_u_start_ns);
              __Pyx_GIVEREF(__pyx_kp_u_start_ns);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_start_ns)) __PYX_ERR(3, 312, __pyx_L9_error);
              __Pyx_INCREF(__pyx_v_prefix_uri_tuple);
              __Pyx_GIVEREF(__pyx_v_prefix_uri_tuple);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_prefix_uri_tuple)) __PYX_ERR(3, 312, __pyx_L9_error);
              __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(3, 312, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":311
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
 */
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":310
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 */
          }

          /* "src/lxml/saxparser.pxi":305
 *     cdef int event_filter = context._event_filter
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 *                                 PARSE_EVENT_FILTER_END_NS)):
 */
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":314
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 *         else:
 *             declared_namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 */
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_declared_namespaces = ((PyObject*)Py_None);
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":316
 *             declared_namespaces = None
 * 
 *         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);

        /* "src/lxml/saxparser.pxi":319
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 */
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/saxparser.pxi":320
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 *             # misplaced ones, but with tag names from C string constants that ignore the
 */
          (void)(__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node));

          /* "src/lxml/saxparser.pxi":324
 *             # misplaced ones, but with tag names from C string constants that ignore the
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)             # <<<<<<<<<<<<<<
 *             if c_localname is NULL:
 *                 raise MemoryError()
 */
          __pyx_v_c_localname = xmlDictLookup(__pyx_v_c_ctxt->dict, __pyx_v_c_localname, -1);

          /* "src/lxml/saxparser.pxi":325
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 * 
 */
          __pyx_t_1 = (__pyx_v_c_localname == NULL);
          if (unlikely(__pyx_t_1)) {

            /* "src/lxml/saxparser.pxi":326
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 */
            PyErr_NoMemory(); __PYX_ERR(3, 326, __pyx_L9_error)

            /* "src/lxml/saxparser.pxi":325
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_localname = tree.xmlDictLookup(c_ctxt.dict, c_localname, -1)
 *             if c_localname is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 * 
 */
          }

          /* "src/lxml/saxparser.pxi":319
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 */
        }

        /* "src/lxml/saxparser.pxi":328
 *                 raise MemoryError()
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":329
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)             # <<<<<<<<<<<<<<
 *         if 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 '%.30s'", "append");
            __PYX_ERR(3, 329, __pyx_L9_error)
          }
          __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_v_declared_namespaces); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(3, 329, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":328
 *                 raise MemoryError()
 * 
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 */
        }

        /* "src/lxml/saxparser.pxi":330
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
 */
        __pyx_t_1 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":332
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          __pyx_t_4 = __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_4 == ((int)-1))) __PYX_ERR(3, 332, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":330
 *         if event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, c_localname, None)
 */
        }

        /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 */
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/saxparser.pxi":333
 *                            PARSE_EVENT_FILTER_START):
 *             _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_3, &__pyx_t_9, &__pyx_t_11) < 0) __PYX_ERR(3, 333, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);

        /* "src/lxml/saxparser.pxi":334
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace, 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_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":304
 *     context = <_SaxParserContext>c_ctxt._private
 *     cdef int event_filter = context._event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 event_filter & (PARSE_EVENT_FILTER_START_NS |
 */
      __pyx_L11_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_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":336
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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_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_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L28_return;
      }
      __pyx_L28_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_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_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":291
 * 
 * 
 * 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_XDECREF(__pyx_v_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri_tuple);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":339
 * 
 * 
 * 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;
  int __pyx_v_event_filter;
  int __pyx_v_sax_event_filter;
  PyObject *__pyx_v_declared_namespaces = NULL;
  PyObject *__pyx_v_prefix_uri_tuple = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_element = 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;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetStart", 0);

  /* "src/lxml/saxparser.pxi":347
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":348
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":349
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 * 
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":348
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":350
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 * 
 *     cdef int event_filter = context._event_filter
 */
  __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;

  /* "src/lxml/saxparser.pxi":352
 *     context = <_SaxParserContext>c_ctxt._private
 * 
 *     cdef int event_filter = context._event_filter             # <<<<<<<<<<<<<<
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
 */
  __pyx_t_4 = __pyx_v_context->_event_filter;
  __pyx_v_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":353
 * 
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter             # <<<<<<<<<<<<<<
 *     try:
 *         if c_nb_namespaces:
 */
  __pyx_t_4 = __pyx_v_context->_target->_sax_event_filter;
  __pyx_v_sax_event_filter = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":355
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
 *         if c_nb_namespaces:             # <<<<<<<<<<<<<<
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 */
        __pyx_t_1 = (__pyx_v_c_nb_namespaces != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":356
 *     try:
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(             # <<<<<<<<<<<<<<
 *                 context, c_nb_namespaces, c_namespaces)
 * 
 */
          __pyx_t_3 = __pyx_f_4lxml_5etree__build_prefix_uri_list(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 356, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":359
 *                 context, c_nb_namespaces, c_namespaces)
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 */
          __pyx_t_1 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":360
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 */
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(3, 360, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 360, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(3, 360, __pyx_L9_error)
              #else
              __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 360, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              #endif
              __Pyx_XDECREF_SET(__pyx_v_prefix_uri_tuple, __pyx_t_9);
              __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":361
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))             # <<<<<<<<<<<<<<
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
 */
              if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
                __PYX_ERR(3, 361, __pyx_L9_error)
              }
              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 361, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_INCREF(__pyx_kp_u_start_ns);
              __Pyx_GIVEREF(__pyx_kp_u_start_ns);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_start_ns)) __PYX_ERR(3, 361, __pyx_L9_error);
              __Pyx_INCREF(__pyx_v_prefix_uri_tuple);
              __Pyx_GIVEREF(__pyx_v_prefix_uri_tuple);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_prefix_uri_tuple)) __PYX_ERR(3, 361, __pyx_L9_error);
              __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(3, 361, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":360
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:
 *                 for prefix_uri_tuple in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 */
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":359
 *                 context, c_nb_namespaces, c_namespaces)
 * 
 *             if event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix_uri_tuple in declared_namespaces:
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 */
          }

          /* "src/lxml/saxparser.pxi":363
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)
 */
          __pyx_t_1 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START_NS) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":364
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
 */
            if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(3, 364, __pyx_L9_error)
            }
            __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_8 = 0;
            for (;;) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 364, __pyx_L9_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(3, 364, __pyx_L9_error)
              #else
              __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 364, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              #endif
              if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
                PyObject* sequence = __pyx_t_9;
                Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
                if (unlikely(size != 2)) {
                  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                  __PYX_ERR(3, 364, __pyx_L9_error)
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                if (likely(PyTuple_CheckExact(sequence))) {
                  __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
                  __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
                } else {
                  __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
                  __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
                }
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_12);
                #else
                __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_12);
                #endif
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              } else {
                Py_ssize_t index = -1;
                __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(3, 364, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
                index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L23_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_11);
                index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L23_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_12);
                if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) __PYX_ERR(3, 364, __pyx_L9_error)
                __pyx_t_14 = NULL;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                goto __pyx_L24_unpacking_done;
                __pyx_L23_unpacking_failed:;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __pyx_t_14 = NULL;
                if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                __PYX_ERR(3, 364, __pyx_L9_error)
                __pyx_L24_unpacking_done:;
              }
              __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_11);
              __pyx_t_11 = 0;
              __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_12);
              __pyx_t_12 = 0;

              /* "src/lxml/saxparser.pxi":365
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)             # <<<<<<<<<<<<<<
 *         else:
 *             declared_namespaces = None
 */
              __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStartNs(__pyx_v_context->_target, __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 365, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/saxparser.pxi":364
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:
 *                 for prefix, uri in declared_namespaces:             # <<<<<<<<<<<<<<
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
 */
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":363
 *                     context.events_iterator._events.append(("start-ns", prefix_uri_tuple))
 * 
 *             if sax_event_filter & SAX_EVENT_START_NS:             # <<<<<<<<<<<<<<
 *                 for prefix, uri in declared_namespaces:
 *                     context._target._handleSaxStartNs(prefix, uri)
 */
          }

          /* "src/lxml/saxparser.pxi":355
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:
 *         if c_nb_namespaces:             # <<<<<<<<<<<<<<
 *             declared_namespaces = _build_prefix_uri_list(
 *                 context, c_nb_namespaces, c_namespaces)
 */
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":367
 *                     context._target._handleSaxStartNs(prefix, uri)
 *         else:
 *             declared_namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         if sax_event_filter & SAX_EVENT_START:
 */
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_declared_namespaces = ((PyObject*)Py_None);
        }
        __pyx_L15:;

        /* "src/lxml/saxparser.pxi":369
 *             declared_namespaces = None
 * 
 *         if sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
 */
        __pyx_t_1 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":370
 * 
 *         if sax_event_filter & SAX_EVENT_START:
 *             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_1 = (__pyx_v_c_nb_defaulted > 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":372
 *             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_1 = ((__pyx_v_c_ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0);
            if (__pyx_t_1) {

              /* "src/lxml/saxparser.pxi":373
 *                 # 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);

              /* "src/lxml/saxparser.pxi":372
 *             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:
 */
            }

            /* "src/lxml/saxparser.pxi":370
 * 
 *         if sax_event_filter & SAX_EVENT_START:
 *             if c_nb_defaulted > 0:             # <<<<<<<<<<<<<<
 *                 # only add default attributes if we asked for them
 *                 if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 */
          }

          /* "src/lxml/saxparser.pxi":374
 *                 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_1 = (__pyx_v_c_nb_attributes == 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":375
 *                     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;

            /* "src/lxml/saxparser.pxi":374
 *                 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:
 */
            goto __pyx_L29;
          }

          /* "src/lxml/saxparser.pxi":377
 *                 attrib = IMMUTABLE_EMPTY_MAPPING
 *             else:
 *                 attrib = {}             # <<<<<<<<<<<<<<
 *                 for i in xrange(c_nb_attributes):
 *                     name = _namespacedNameFromNsName(
 */
          /*else*/ {
            __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 377, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_v_attrib = __pyx_t_3;
            __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":378
 *             else:
 *                 attrib = {}
 *                 for i in xrange(c_nb_attributes):             # <<<<<<<<<<<<<<
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
 */
            __pyx_t_4 = __pyx_v_c_nb_attributes;
            __pyx_t_15 = __pyx_t_4;
            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
              __pyx_v_i = __pyx_t_16;

              /* "src/lxml/saxparser.pxi":379
 *                 attrib = {}
 *                 for i in xrange(c_nb_attributes):
 *                     name = _namespacedNameFromNsName(             # <<<<<<<<<<<<<<
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:
 */
              __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName((__pyx_v_c_attributes[2]), (__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 379, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_3));
              __pyx_t_3 = 0;

              /* "src/lxml/saxparser.pxi":381
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                         value = ''
 *                     else:
 */
              __pyx_t_1 = ((__pyx_v_c_attributes[3]) == NULL);
              if (__pyx_t_1) {

                /* "src/lxml/saxparser.pxi":382
 *                         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_u__12);
                __Pyx_XDECREF_SET(__pyx_v_value, __pyx_kp_u__12);

                /* "src/lxml/saxparser.pxi":381
 *                     name = _namespacedNameFromNsName(
 *                         c_attributes[2], c_attributes[0])
 *                     if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                         value = ''
 *                     else:
 */
                goto __pyx_L32;
              }

              /* "src/lxml/saxparser.pxi":384
 *                         value = ''
 *                     else:
 *                         c_len = c_attributes[4] - c_attributes[3]             # <<<<<<<<<<<<<<
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value
 */
              /*else*/ {
                __pyx_v_c_len = ((__pyx_v_c_attributes[4]) - (__pyx_v_c_attributes[3]));

                /* "src/lxml/saxparser.pxi":385
 *                     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_3 = __Pyx_decode_c_string(((char const *)(__pyx_v_c_attributes[3])), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 385, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_3);
                __pyx_t_3 = 0;
              }
              __pyx_L32:;

              /* "src/lxml/saxparser.pxi":386
 *                         c_len = c_attributes[4] - c_attributes[3]
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value             # <<<<<<<<<<<<<<
 *                     c_attributes += 5
 * 
 */
              if (unlikely((PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_v_value) < 0))) __PYX_ERR(3, 386, __pyx_L9_error)

              /* "src/lxml/saxparser.pxi":387
 *                         value = c_attributes[3][:c_len].decode('utf8')
 *                     attrib[name] = value
 *                     c_attributes += 5             # <<<<<<<<<<<<<<
 * 
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING
 */
              __pyx_v_c_attributes = (__pyx_v_c_attributes + 5);
            }
          }
          __pyx_L29:;

          /* "src/lxml/saxparser.pxi":389
 *                     c_attributes += 5
 * 
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 * 
 *             element = _callTargetSaxStart(
 */
          __pyx_t_1 = (__pyx_v_c_nb_namespaces != 0);
          if (__pyx_t_1) {
            __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_declared_namespaces); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 389, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_3 = __pyx_t_9;
            __pyx_t_9 = 0;
          } else {
            __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
            __pyx_t_3 = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
          }
          __pyx_v_nsmap = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":393
 *             element = _callTargetSaxStart(
 *                 context, c_ctxt,
 *                 _namespacedNameFromNsName(c_namespace, c_localname),             # <<<<<<<<<<<<<<
 *                 attrib, nsmap)
 *         else:
 */
          __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 393, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);

          /* "src/lxml/saxparser.pxi":391
 *             nsmap = dict(declared_namespaces) if c_nb_namespaces else IMMUTABLE_EMPTY_MAPPING
 * 
 *             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_3, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 391, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_element = __pyx_t_9;
          __pyx_t_9 = 0;

          /* "src/lxml/saxparser.pxi":369
 *             declared_namespaces = None
 * 
 *         if sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             if c_nb_defaulted > 0:
 *                 # only add default attributes if we asked for them
 */
          goto __pyx_L26;
        }

        /* "src/lxml/saxparser.pxi":396
 *                 attrib, nsmap)
 *         else:
 *             element = None             # <<<<<<<<<<<<<<
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
 */
        /*else*/ {
          __Pyx_INCREF(Py_None);
          __pyx_v_element = Py_None;
        }
        __pyx_L26:;

        /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 */
        __pyx_t_2 = ((__pyx_v_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (!__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L34_bool_binop_done;
        }

        /* "src/lxml/saxparser.pxi":399
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
 *                 sax_event_filter & SAX_EVENT_END_NS):             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_2 = ((__pyx_v_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END_NS) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L34_bool_binop_done:;

        /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 */
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":400
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)             # <<<<<<<<<<<<<<
 *         if 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 '%.30s'", "append");
            __PYX_ERR(3, 400, __pyx_L9_error)
          }
          __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_v_declared_namespaces); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(3, 400, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":398
 *             element = None
 * 
 *         if (event_filter & PARSE_EVENT_FILTER_END_NS or             # <<<<<<<<<<<<<<
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 */
        }

        /* "src/lxml/saxparser.pxi":401
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 */
        __pyx_t_1 = ((__pyx_v_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":403
 *         if event_filter & (PARSE_EVENT_FILTER_END |
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,             # <<<<<<<<<<<<<<
 *                                c_localname, element)
 *     except:
 */
          __pyx_t_4 = __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_4 == ((int)-1))) __PYX_ERR(3, 403, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":401
 *                 sax_event_filter & SAX_EVENT_END_NS):
 *             context._ns_stack.append(declared_namespaces)
 *         if event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                            PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 */
        }

        /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
 */
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __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_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/saxparser.pxi":405
 *             _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_3, &__pyx_t_12) < 0) __PYX_ERR(3, 405, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_12);

        /* "src/lxml/saxparser.pxi":406
 *                                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_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":354
 *     cdef int event_filter = context._event_filter
 *     cdef int sax_event_filter = context._target._sax_event_filter
 *     try:             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces:
 *             declared_namespaces = _build_prefix_uri_list(
 */
      __pyx_L11_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_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":408
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 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;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_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_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      {
        goto __pyx_L39_return;
      }
      __pyx_L39_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      }
      __Pyx_XDECREF(__pyx_t_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_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":339
 * 
 * 
 * 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_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri_tuple);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) noexcept 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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStartNoNs", 0);

  /* "src/lxml/saxparser.pxi":413
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":414
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":415
 *     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;

    /* "src/lxml/saxparser.pxi":414
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":416
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 */
  __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;

  /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":418
 *     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);

        /* "src/lxml/saxparser.pxi":419
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 */
        if (__pyx_v_c_ctxt->html) {

          /* "src/lxml/saxparser.pxi":420
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 *             # misplaced ones, but with tag names from C string constants that ignore the
 */
          (void)(__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node));

          /* "src/lxml/saxparser.pxi":424
 *             # misplaced ones, but with tag names from C string constants that ignore the
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)             # <<<<<<<<<<<<<<
 *             if c_name is NULL:
 *                 raise MemoryError()
 */
          __pyx_v_c_name = xmlDictLookup(__pyx_v_c_ctxt->dict, __pyx_v_c_name, -1);

          /* "src/lxml/saxparser.pxi":425
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
          __pyx_t_1 = (__pyx_v_c_name == NULL);
          if (unlikely(__pyx_t_1)) {

            /* "src/lxml/saxparser.pxi":426
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 */
            PyErr_NoMemory(); __PYX_ERR(3, 426, __pyx_L9_error)

            /* "src/lxml/saxparser.pxi":425
 *             # parser dict.  Thus, we need to intern the name ourselves.
 *             c_name = tree.xmlDictLookup(c_ctxt.dict, c_name, -1)
 *             if c_name is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
          }

          /* "src/lxml/saxparser.pxi":419
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *             # The HTML parser in libxml2 reports the missing opening tags when it finds
 */
        }

        /* "src/lxml/saxparser.pxi":427
 *             if c_name is NULL:
 *                 raise MemoryError()
 *         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) {

          /* "src/lxml/saxparser.pxi":429
 *         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_7 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, Py_None); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 429, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":427
 *             if c_name is NULL:
 *                 raise MemoryError()
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 */
        }

        /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":430
 *                                     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_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(3, 430, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":431
 *             _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_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;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":417
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":433
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_L20_return;
      }
      __pyx_L20_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;
    }
  }

  /* "src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":436
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) noexcept 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;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetStartNoNs", 0);

  /* "src/lxml/saxparser.pxi":438
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":439
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":440
 *     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;

    /* "src/lxml/saxparser.pxi":439
 *                                     const_xmlChar** c_attributes) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":441
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if c_attributes is NULL:
 */
  __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;

  /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":443
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 */
        __pyx_t_1 = (__pyx_v_c_attributes == NULL);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":444
 *     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;

          /* "src/lxml/saxparser.pxi":443
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 */
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":446
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 */
        /*else*/ {
          __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 446, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_attrib = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "src/lxml/saxparser.pxi":447
 *         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);
            if (!__pyx_t_1) break;

            /* "src/lxml/saxparser.pxi":448
 *             attrib = {}
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])             # <<<<<<<<<<<<<<
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
 */
            __pyx_t_3 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 448, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_3));
            __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":449
 *             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_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_attributes[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 449, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (unlikely((PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_t_3) < 0))) __PYX_ERR(3, 449, __pyx_L9_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "src/lxml/saxparser.pxi":450
 *                 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:;

        /* "src/lxml/saxparser.pxi":452
 *                 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_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 452, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":453
 *         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_7 = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
        __Pyx_INCREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":451
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(             # <<<<<<<<<<<<<<
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__callTargetSaxStart(__pyx_v_context, __pyx_v_c_ctxt, __pyx_t_3, __pyx_v_attrib, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 451, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_element = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":454
 *             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) {

          /* "src/lxml/saxparser.pxi":456
 *         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_9 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, __pyx_v_element); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 456, __pyx_L9_error)

          /* "src/lxml/saxparser.pxi":454
 *             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)
 */
        }

        /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":457
 *                                     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_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(3, 457, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":458
 *             _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_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":442
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":460
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_L21_return;
      }
      __pyx_L21_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;
    }
  }

  /* "src/lxml/saxparser.pxi":436
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) noexcept 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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":463
 * 
 * 
 * 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;
  unsigned short __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_callTargetSaxStart", 1);

  /* "src/lxml/saxparser.pxi":466
 *                          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_ERR(3, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":467
 *                          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_3 = (__pyx_v_element != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_ctxt->input != NULL);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":468
 *     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_2 = __Pyx_TypeCheck(__pyx_v_element, __pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":471
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)             # <<<<<<<<<<<<<<
 *     return element
 * 
 */
      __pyx_t_2 = (__pyx_v_c_ctxt->input->line < 0xFFFF);
      if (__pyx_t_2) {

        /* "src/lxml/saxparser.pxi":470
 *         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_4 = ((unsigned short)__pyx_v_c_ctxt->input->line);
      } else {
        __pyx_t_4 = 0xFFFF;
      }

      /* "src/lxml/saxparser.pxi":469
 *     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_4;

      /* "src/lxml/saxparser.pxi":468
 *     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
 */
    }

    /* "src/lxml/saxparser.pxi":467
 *                          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 = (
 */
  }

  /* "src/lxml/saxparser.pxi":472
 *                 <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;

  /* "src/lxml/saxparser.pxi":463
 * 
 * 
 * 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;
}

/* "src/lxml/saxparser.pxi":475
 * 
 * 
 * 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;
  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("_pushSaxStartEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "src/lxml/saxparser.pxi":479
 *                             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_2 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":480
 *                             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);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/saxparser.pxi":479
 *                             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:
 */
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":481
 *     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_2 = (__pyx_v_node == Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) == Py_None);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":482
 *             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(__pyx_assertions_enabled())) {
        __pyx_t_1 = (((PyObject *)__pyx_v_context->__pyx_base._doc) != Py_None);
        if (unlikely(!__pyx_t_1)) {
          __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
          __PYX_ERR(3, 482, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(3, 482, __pyx_L1_error)
      #endif

      /* "src/lxml/saxparser.pxi":483
 *         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_3 = ((PyObject *)__pyx_v_context->__pyx_base._doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_ctxt->node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/saxparser.pxi":481
 *     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)
 */
    }

    /* "src/lxml/saxparser.pxi":484
 *             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_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":485
 *             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 '%.30s'", "append");
        __PYX_ERR(3, 485, __pyx_L1_error)
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_n_u_start);
      __Pyx_GIVEREF(__pyx_n_u_start);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_start)) __PYX_ERR(3, 485, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_node)) __PYX_ERR(3, 485, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(3, 485, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/saxparser.pxi":484
 *             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
 */
    }

    /* "src/lxml/saxparser.pxi":486
 *         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) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }

    /* "src/lxml/saxparser.pxi":487
 *             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_2 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;

    /* "src/lxml/saxparser.pxi":486
 *         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)
 */
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":488
 *         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 '%.30s'", "append");
        __PYX_ERR(3, 488, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->_node_stack, __pyx_v_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(3, 488, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":486
 *         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)
 */
    }

    /* "src/lxml/saxparser.pxi":479
 *                             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:
 */
  }

  /* "src/lxml/saxparser.pxi":489
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":475
 * 
 * 
 * cdef int _pushSaxStartEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlParserCtxt* c_ctxt,
 *                             const_xmlChar* c_href,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/saxparser.pxi":492
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept 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;
  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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "src/lxml/saxparser.pxi":495
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":496
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":497
 *     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;

    /* "src/lxml/saxparser.pxi":496
 *                         const_xmlChar* c_namespace) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":498
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
 */
  __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;

  /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":500
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
 */
        __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":501
 *     try:
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
 */
          __pyx_t_1 = ((__pyx_v_context->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END) != 0);
          if (__pyx_t_1) {

            /* "src/lxml/saxparser.pxi":503
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))             # <<<<<<<<<<<<<<
 *             else:
 *                 node = None
 */
            __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 503, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);

            /* "src/lxml/saxparser.pxi":502
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 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_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 502, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_v_node = __pyx_t_7;
            __pyx_t_7 = 0;

            /* "src/lxml/saxparser.pxi":501
 *     try:
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *                 node = context._target._handleSaxEnd(
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
 */
            goto __pyx_L16;
          }

          /* "src/lxml/saxparser.pxi":505
 *                     _namespacedNameFromNsName(c_namespace, c_localname))
 *             else:
 *                 node = None             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 */
          /*else*/ {
            __Pyx_INCREF(Py_None);
            __pyx_v_node = Py_None;
          }
          __pyx_L16:;

          /* "src/lxml/saxparser.pxi":500
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 *                 node = context._target._handleSaxEnd(
 */
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":507
 *                 node = None
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 */
        /*else*/ {
          __pyx_v_context->_origSaxEnd(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace);

          /* "src/lxml/saxparser.pxi":508
 *         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:;

        /* "src/lxml/saxparser.pxi":509
 *             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 == ((int)-1))) __PYX_ERR(3, 509, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":510
 *             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 == ((int)-1))) __PYX_ERR(3, 510, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":511
 *         _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_3, &__pyx_t_9) < 0) __PYX_ERR(3, 511, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":512
 *         _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_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":499
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             if context._target._sax_event_filter & SAX_EVENT_END:
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":514
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 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_L19_return;
      }
      __pyx_L19_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;
    }
  }

  /* "src/lxml/saxparser.pxi":492
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) noexcept with gil:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":517
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 */

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;
  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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEndNoNs", 0);

  /* "src/lxml/saxparser.pxi":518
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":519
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":520
 *     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;

    /* "src/lxml/saxparser.pxi":519
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":521
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
 */
  __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;

  /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":523
 *     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);
        if (__pyx_t_1) {

          /* "src/lxml/saxparser.pxi":524
 *     try:
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 */
          __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 524, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 524, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_node = __pyx_t_7;
          __pyx_t_7 = 0;

          /* "src/lxml/saxparser.pxi":523
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
 */
          goto __pyx_L15;
        }

        /* "src/lxml/saxparser.pxi":526
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 */
        /*else*/ {
          __pyx_v_context->_origSaxEndNoNs(__pyx_v_c_ctxt, __pyx_v_c_name);

          /* "src/lxml/saxparser.pxi":527
 *         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:;

        /* "src/lxml/saxparser.pxi":528
 *             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 == ((int)-1))) __PYX_ERR(3, 528, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":529
 *             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_3, &__pyx_t_9) < 0) __PYX_ERR(3, 529, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":530
 *         _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_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":522
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":532
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 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_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_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;
    }
  }

  /* "src/lxml/saxparser.pxi":517
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":535
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
 */

static int __pyx_f_4lxml_5etree__pushSaxNsEndEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context) {
  int __pyx_v_build_events;
  int __pyx_v_call_target;
  PyObject *__pyx_v_declared_namespaces = 0;
  PyObject *__pyx_v_prefix_uri = 0;
  int __pyx_r;
  __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;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxNsEndEvents", 1);

  /* "src/lxml/saxparser.pxi":536
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS             # <<<<<<<<<<<<<<
 *     cdef bint call_target = (
 *         context._target is not None
 */
  __pyx_v_build_events = (__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS);

  /* "src/lxml/saxparser.pxi":538
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
 *         context._target is not None             # <<<<<<<<<<<<<<
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/saxparser.pxi":539
 *     cdef bint call_target = (
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)             # <<<<<<<<<<<<<<
 *     if not build_events and not call_target:
 *         return 0
 */
  __pyx_t_2 = ((__pyx_v_context->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END_NS) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_v_call_target = __pyx_t_1;

  /* "src/lxml/saxparser.pxi":540
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = (!__pyx_v_build_events);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = (!__pyx_v_call_target);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":541
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":540
 *         context._target is not None
 *         and context._target._sax_event_filter & SAX_EVENT_END_NS)
 *     if not build_events and not call_target:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":543
 *         return 0
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()             # <<<<<<<<<<<<<<
 *     if declared_namespaces is None:
 *         return 0
 */
  if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(3, 543, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_context->_ns_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_3))) __PYX_ERR(3, 543, __pyx_L1_error)
  __pyx_v_declared_namespaces = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":544
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = (__pyx_v_declared_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":545
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple prefix_uri
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":544
 * 
 *     cdef list declared_namespaces = context._ns_stack.pop()
 *     if declared_namespaces is None:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "src/lxml/saxparser.pxi":548
 * 
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):             # <<<<<<<<<<<<<<
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 */
  if (unlikely(__pyx_v_declared_namespaces == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 548, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_declared_namespaces; __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  #if !CYTHON_ASSUME_SAFE_MACROS
  if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(3, 548, __pyx_L1_error)
  #endif
  --__pyx_t_4;
  for (;;) {
    if (__pyx_t_4 < 0) break;
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(3, 548, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(3, 548, __pyx_L1_error)
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4--; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if (!(likely(PyTuple_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_5))) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_prefix_uri, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/saxparser.pxi":549
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:             # <<<<<<<<<<<<<<
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 */
    if (__pyx_v_call_target) {

      /* "src/lxml/saxparser.pxi":550
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])             # <<<<<<<<<<<<<<
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))
 */
      if (unlikely(__pyx_v_prefix_uri == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(3, 550, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_prefix_uri, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEndNs(__pyx_v_context->_target, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 550, __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;

      /* "src/lxml/saxparser.pxi":549
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):
 *         if call_target:             # <<<<<<<<<<<<<<
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 */
    }

    /* "src/lxml/saxparser.pxi":551
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end-ns', None))
 * 
 */
    if (__pyx_v_build_events) {

      /* "src/lxml/saxparser.pxi":552
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(3, 552, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_tuple__60); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(3, 552, __pyx_L1_error)

      /* "src/lxml/saxparser.pxi":551
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end-ns', None))
 * 
 */
    }

    /* "src/lxml/saxparser.pxi":548
 * 
 *     cdef tuple prefix_uri
 *     for prefix_uri in reversed(declared_namespaces):             # <<<<<<<<<<<<<<
 *         if call_target:
 *             context._target._handleSaxEndNs(prefix_uri[0])
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/saxparser.pxi":554
 *             context.events_iterator._events.append(('end-ns', None))
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":535
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef bint build_events = context._event_filter & PARSE_EVENT_FILTER_END_NS
 *     cdef bint call_target = (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._pushSaxNsEndEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_declared_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_uri);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":557
 * 
 * 
 * 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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxEndEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "src/lxml/saxparser.pxi":560
 *                           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) {

    /* "src/lxml/saxparser.pxi":561
 *                           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_2 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/saxparser.pxi":562
 *     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);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "src/lxml/saxparser.pxi":561
 *                           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:
 */
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":563
 *         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_1 = (((PyObject *)__pyx_v_context->_target) == Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/saxparser.pxi":564
 *                 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 '%.30s'", "pop");
          __PYX_ERR(3, 564, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_context->_node_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 564, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/saxparser.pxi":563
 *         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))
 */
      }

      /* "src/lxml/saxparser.pxi":565
 *             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 '%.30s'", "append");
        __PYX_ERR(3, 565, __pyx_L1_error)
      }
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_u_end);
      __Pyx_GIVEREF(__pyx_n_u_end);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_end)) __PYX_ERR(3, 565, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_node)) __PYX_ERR(3, 565, __pyx_L1_error);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 565, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":561
 *                           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:
 */
    }

    /* "src/lxml/saxparser.pxi":560
 *                           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)):
 */
  }

  /* "src/lxml/saxparser.pxi":566
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":557
 * 
 * 
 * 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_3);
  __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;
}

/* "src/lxml/saxparser.pxi":569
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept 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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "src/lxml/saxparser.pxi":571
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept 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);

  /* "src/lxml/saxparser.pxi":572
 *     # 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_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":573
 *     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;

    /* "src/lxml/saxparser.pxi":572
 *     # 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
 */
  }

  /* "src/lxml/saxparser.pxi":574
 *     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;

  /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":577
 *     try:
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_c_data), 0, __pyx_v_data_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 577, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":576
 *     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 == ((int)-1))) __PYX_ERR(3, 576, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":578
 *         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_ERR(3, 578, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":579
 *             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_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;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":575
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":581
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
    }
  }

  /* "src/lxml/saxparser.pxi":569
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept 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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":584
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) noexcept 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
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetDoctype", 0);

  /* "src/lxml/saxparser.pxi":588
 *                                   const_xmlChar* c_system) noexcept 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);

  /* "src/lxml/saxparser.pxi":589
 *     # 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_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":590
 *     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;

    /* "src/lxml/saxparser.pxi":589
 *     # 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
 */
  }

  /* "src/lxml/saxparser.pxi":591
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxDoctype(
 */
  __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;

  /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":594
 *     try:
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 594, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":595
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_system))
 *     except:
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_public); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 595, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":596
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_system); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 596, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "src/lxml/saxparser.pxi":593
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._target._handleSaxDoctype(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
 */
        __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxDoctype(__pyx_v_context->_target, __pyx_t_3, __pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 593, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":597
 *             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_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(3, 597, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":598
 *             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_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":592
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":600
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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;
    }
  }

  /* "src/lxml/saxparser.pxi":584
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) noexcept with gil:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":603
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 */

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
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStartDocument", 0);

  /* "src/lxml/saxparser.pxi":604
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":605
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":606
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":605
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":607
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 */
  __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;

  /* "src/lxml/saxparser.pxi":608
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)             # <<<<<<<<<<<<<<
 *     c_doc = c_ctxt.myDoc
 *     try:
 */
  __pyx_v_context->_origSaxStartDocument(__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":609
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc             # <<<<<<<<<<<<<<
 *     try:
 *         context.startDocument(c_doc)
 */
  __pyx_t_4 = __pyx_v_c_ctxt->myDoc;
  __pyx_v_c_doc = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":611
 *     c_doc = c_ctxt.myDoc
 *     try:
 *         context.startDocument(c_doc)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = ((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_8 == ((int)-1))) __PYX_ERR(3, 611, __pyx_L9_error)

        /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
 */
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L14_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":612
 *     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_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(3, 612, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);

        /* "src/lxml/saxparser.pxi":613
 *         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_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":610
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
 */
      __pyx_L11_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_L7_error;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":615
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 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_3); __pyx_t_3 = 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_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_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_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_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_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":603
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":618
 * 
 * 
 * cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                              const_xmlChar* c_data) noexcept with gil:
 *     # can only be called if parsing with a target
 */

static void __pyx_f_4lxml_5etree__handleSaxTargetPI(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;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetPI", 0);

  /* "src/lxml/saxparser.pxi":621
 *                              const_xmlChar* c_data) noexcept 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);

  /* "src/lxml/saxparser.pxi":622
 *     # 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_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":623
 *     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;

    /* "src/lxml/saxparser.pxi":622
 *     # 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
 */
  }

  /* "src/lxml/saxparser.pxi":624
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         pi = context._target._handleSaxPi(
 */
  __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;

  /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":627
 *     try:
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),             # <<<<<<<<<<<<<<
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 627, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":628
 *         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_7 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 628, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "src/lxml/saxparser.pxi":626
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         pi = context._target._handleSaxPi(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 */
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxPi(__pyx_v_context->_target, __pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 626, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_pi = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "src/lxml/saxparser.pxi":629
 *             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) {

          /* "src/lxml/saxparser.pxi":630
 *             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 '%.30s'", "append");
            __PYX_ERR(3, 630, __pyx_L9_error)
          }
          __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 630, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_n_u_pi);
          __Pyx_GIVEREF(__pyx_n_u_pi);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_pi)) __PYX_ERR(3, 630, __pyx_L9_error);
          __Pyx_INCREF(__pyx_v_pi);
          __Pyx_GIVEREF(__pyx_v_pi);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_pi)) __PYX_ERR(3, 630, __pyx_L9_error);
          __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 630, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "src/lxml/saxparser.pxi":629
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
 */
        }

        /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/saxparser.pxi":631
 *         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._handleSaxTargetPI", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(3, 631, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);

        /* "src/lxml/saxparser.pxi":632
 *             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_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":625
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":634
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_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_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;
    }
  }

  /* "src/lxml/saxparser.pxi":618
 * 
 * 
 * cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                              const_xmlChar* c_data) noexcept 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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":637
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) noexcept 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
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlNode *__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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxPIEvent", 0);

  /* "src/lxml/saxparser.pxi":640
 *                             const_xmlChar* data) noexcept with gil:
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":641
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":642
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":641
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":643
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 */
  __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;

  /* "src/lxml/saxparser.pxi":644
 *         return
 *     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);

  /* "src/lxml/saxparser.pxi":645
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt); if (unlikely(__pyx_t_4 == ((xmlNode *)NULL) && PyErr_Occurred())) __PYX_ERR(3, 645, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":646
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":647
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('pi', c_node)
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":646
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  }

  /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":649
 *         return
 *     try:
 *         context.pushEvent('pi', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_n_u_pi, __pyx_v_c_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(3, 649, __pyx_L10_error)

        /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
 */
      }
      __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_L15_try_end;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":650
 *     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_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(3, 650, __pyx_L12_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);

        /* "src/lxml/saxparser.pxi":651
 *         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_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L11_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":648
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
 */
      __pyx_L12_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_L8_error;
      __pyx_L11_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_L15_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":653
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 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_3); __pyx_t_3 = 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_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_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_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_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":637
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) noexcept with gil:
 *     # can only be called when collecting pi events
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxPIEvent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":656
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept 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;
  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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetComment", 0);

  /* "src/lxml/saxparser.pxi":658
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept 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);

  /* "src/lxml/saxparser.pxi":659
 *     # 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_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":660
 *     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;

    /* "src/lxml/saxparser.pxi":659
 *     # 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
 */
  }

  /* "src/lxml/saxparser.pxi":661
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 */
  __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;

  /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":663
 *     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_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 663, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxComment(__pyx_v_context->_target, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 663, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_comment = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "src/lxml/saxparser.pxi":664
 *     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) {

          /* "src/lxml/saxparser.pxi":665
 *         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 '%.30s'", "append");
            __PYX_ERR(3, 665, __pyx_L9_error)
          }
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 665, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_n_u_comment);
          __Pyx_GIVEREF(__pyx_n_u_comment);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_comment)) __PYX_ERR(3, 665, __pyx_L9_error);
          __Pyx_INCREF(__pyx_v_comment);
          __Pyx_GIVEREF(__pyx_v_comment);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_comment)) __PYX_ERR(3, 665, __pyx_L9_error);
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(3, 665, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "src/lxml/saxparser.pxi":664
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
 */
        }

        /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 */
      }
      __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_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/saxparser.pxi":666
 *         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_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(3, 666, __pyx_L11_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/saxparser.pxi":667
 *             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_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L10_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":662
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 */
      __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_L7_error;
      __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_L14_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":669
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_7); __pyx_t_7 = 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_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_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;
    }
  }

  /* "src/lxml/saxparser.pxi":656
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept 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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":672
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept 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
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlNode *__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;
  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 = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "src/lxml/saxparser.pxi":674
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil:
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "src/lxml/saxparser.pxi":675
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_2 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_c_ctxt->disableSAX;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":676
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":675
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  }

  /* "src/lxml/saxparser.pxi":677
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 */
  __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;

  /* "src/lxml/saxparser.pxi":678
 *         return
 *     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);

  /* "src/lxml/saxparser.pxi":679
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt); if (unlikely(__pyx_t_4 == ((xmlNode *)NULL) && PyErr_Occurred())) __PYX_ERR(3, 679, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_4;

  /* "src/lxml/saxparser.pxi":680
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":681
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('comment', c_node)
 */
    goto __pyx_L0;

    /* "src/lxml/saxparser.pxi":680
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  }

  /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/saxparser.pxi":683
 *         return
 *     try:
 *         context.pushEvent('comment', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_n_u_comment, __pyx_v_c_node); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(3, 683, __pyx_L10_error)

        /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
 */
      }
      __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_L15_try_end;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":684
 *     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_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(3, 684, __pyx_L12_except_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);

        /* "src/lxml/saxparser.pxi":685
 *         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_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L11_exception_handled;
      }

      /* "src/lxml/saxparser.pxi":682
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
 */
      __pyx_L12_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_L8_error;
      __pyx_L11_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_L15_try_end:;
    }
  }

  /* "src/lxml/saxparser.pxi":687
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 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_3); __pyx_t_3 = 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_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_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_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_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/saxparser.pxi":672
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/saxparser.pxi":690
 * 
 * 
 * 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;
  int __pyx_t_1;

  /* "src/lxml/saxparser.pxi":692
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":693
 *     # 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;

    /* "src/lxml/saxparser.pxi":692
 * 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:
 */
  }

  /* "src/lxml/saxparser.pxi":694
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":695
 *         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;

    /* "src/lxml/saxparser.pxi":694
 *     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:
 */
  }

  /* "src/lxml/saxparser.pxi":696
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":697
 *         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;

    /* "src/lxml/saxparser.pxi":696
 *     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:
 */
  }

  /* "src/lxml/saxparser.pxi":698
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":699
 *         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;

    /* "src/lxml/saxparser.pxi":698
 *     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:
 */
  }

  /* "src/lxml/saxparser.pxi":701
 *         return c_ctxt.node.last
 *     else:
 *         return c_ctxt.node.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_r = __pyx_v_c_ctxt->node->next;
    goto __pyx_L0;
  }

  /* "src/lxml/saxparser.pxi":690
 * 
 * 
 * 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:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
 */

/* 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;
  PyObject *__pyx_v_comment_factory = 0;
  PyObject *__pyx_v_pi_factory = 0;
  int __pyx_v_insert_comments;
  int __pyx_v_insert_pis;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_factory,&__pyx_n_s_parser,&__pyx_n_s_comment_factory,&__pyx_n_s_pi_factory,&__pyx_n_s_insert_comments,&__pyx_n_s_insert_pis,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/saxparser.pxi":736
 * 
 *     def __init__(self, *, element_factory=None, parser=None,
 *                  comment_factory=None, pi_factory=None,             # <<<<<<<<<<<<<<
 *                  bint insert_comments=True, bint insert_pis=True):
 *         self._sax_event_filter = \
 */
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 6)) {
        Py_ssize_t index;
        for (index = 0; index < 6 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 735, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "__init__") < 0)) __PYX_ERR(3, 735, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_element_factory = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_comment_factory = values[2];
    __pyx_v_pi_factory = values[3];
    if (values[4]) {
      __pyx_v_insert_comments = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_insert_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 737, __pyx_L3_error)
    } else {

      /* "src/lxml/saxparser.pxi":737
 *     def __init__(self, *, element_factory=None, parser=None,
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = \
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 */
      __pyx_v_insert_comments = ((int)1);
    }
    if (values[5]) {
      __pyx_v_insert_pis = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_insert_pis == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 737, __pyx_L3_error)
    } else {
      __pyx_v_insert_pis = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(3, 735, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, __pyx_v_comment_factory, __pyx_v_pi_factory, __pyx_v_insert_comments, __pyx_v_insert_pis);

  /* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, PyObject *__pyx_v_comment_factory, PyObject *__pyx_v_pi_factory, int __pyx_v_insert_comments, int __pyx_v_insert_pis) {
  int __pyx_r;
  __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("__init__", 1);

  /* "src/lxml/saxparser.pxi":738
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
 *         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);

  /* "src/lxml/saxparser.pxi":741
 *             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_ERR(3, 741, __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;

  /* "src/lxml/saxparser.pxi":742
 *             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_ERR(3, 742, __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;

  /* "src/lxml/saxparser.pxi":743
 *         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_ERR(3, 743, __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;

  /* "src/lxml/saxparser.pxi":744
 *         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((PyObject *)__pyx_v_self->_last);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
  __pyx_v_self->_last = ((struct LxmlElement *)Py_None);

  /* "src/lxml/saxparser.pxi":745
 *         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._comment_factory = comment_factory if comment_factory is not None else Comment
 */
  __pyx_v_self->_in_tail = 0;

  /* "src/lxml/saxparser.pxi":746
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory             # <<<<<<<<<<<<<<
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 */
  __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;

  /* "src/lxml/saxparser.pxi":747
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment             # <<<<<<<<<<<<<<
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments
 */
  __pyx_t_2 = (__pyx_v_comment_factory != Py_None);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_comment_factory);
    __pyx_t_1 = __pyx_v_comment_factory;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Comment); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 747, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_comment_factory);
  __Pyx_DECREF(__pyx_v_self->_comment_factory);
  __pyx_v_self->_comment_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":748
 *         self._factory = element_factory
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction             # <<<<<<<<<<<<<<
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis
 */
  __pyx_t_2 = (__pyx_v_pi_factory != Py_None);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_pi_factory);
    __pyx_t_1 = __pyx_v_pi_factory;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pi_factory);
  __Pyx_DECREF(__pyx_v_self->_pi_factory);
  __pyx_v_self->_pi_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":749
 *         self._comment_factory = comment_factory if comment_factory is not None else Comment
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments             # <<<<<<<<<<<<<<
 *         self._insert_pis = insert_pis
 *         self._parser = parser
 */
  __pyx_v_self->_insert_comments = __pyx_v_insert_comments;

  /* "src/lxml/saxparser.pxi":750
 *         self._pi_factory = pi_factory if pi_factory is not None else ProcessingInstruction
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
 */
  __pyx_v_self->_insert_pis = __pyx_v_insert_pis;

  /* "src/lxml/saxparser.pxi":751
 *         self._insert_comments = insert_comments
 *         self._insert_pis = insert_pis
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(3, 751, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_parser;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/saxparser.pxi":735
 *     cdef bint _insert_pis
 * 
 *     def __init__(self, *, element_factory=None, parser=None,             # <<<<<<<<<<<<<<
 *                  comment_factory=None, pi_factory=None,
 *                  bint insert_comments=True, bint insert_pis=True):
 */

  /* 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.TreeBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":754
 * 
 *     @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;
  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("_flush", 1);

  /* "src/lxml/saxparser.pxi":755
 *     @cython.final
 *     cdef int _flush(self) except -1:
 *         if self._data:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = "".join(self._data)
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":756
 *     cdef int _flush(self) except -1:
 *         if self._data:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = "".join(self._data)
 *                 if self._in_tail:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/saxparser.pxi":757
 *         if self._data:
 *             if self._last is not None:
 *                 text = "".join(self._data)             # <<<<<<<<<<<<<<
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"
 */
      __pyx_t_2 = __pyx_v_self->_data;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__12, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_text = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/saxparser.pxi":758
 *             if self._last is not None:
 *                 text = "".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text
 */
      if (__pyx_v_self->_in_tail) {

        /* "src/lxml/saxparser.pxi":759
 *                 text = "".join(self._data)
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"             # <<<<<<<<<<<<<<
 *                     self._last.tail = text
 *                 else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 759, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = (__pyx_t_3 == Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) {
            __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_internal_error_tail, 0, 0);
            __PYX_ERR(3, 759, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(3, 759, __pyx_L1_error)
        #endif

        /* "src/lxml/saxparser.pxi":760
 *                 if self._in_tail:
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert self._last.text is None, "internal error (text)"
 */
        if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tail, __pyx_v_text) < 0) __PYX_ERR(3, 760, __pyx_L1_error)

        /* "src/lxml/saxparser.pxi":758
 *             if self._last is not None:
 *                 text = "".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, "internal error (tail)"
 *                     self._last.tail = text
 */
        goto __pyx_L5;
      }

      /* "src/lxml/saxparser.pxi":762
 *                     self._last.tail = text
 *                 else:
 *                     assert self._last.text is None, "internal error (text)"             # <<<<<<<<<<<<<<
 *                     self._last.text = text
 *             del self._data[:]
 */
      /*else*/ {
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 762, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = (__pyx_t_3 == Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) {
            __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_internal_error_text, 0, 0);
            __PYX_ERR(3, 762, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(3, 762, __pyx_L1_error)
        #endif

        /* "src/lxml/saxparser.pxi":763
 *                 else:
 *                     assert self._last.text is None, "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_ERR(3, 763, __pyx_L1_error)
      }
      __pyx_L5:;

      /* "src/lxml/saxparser.pxi":756
 *     cdef int _flush(self) except -1:
 *         if self._data:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = "".join(self._data)
 *                 if self._in_tail:
 */
    }

    /* "src/lxml/saxparser.pxi":764
 *                     assert self._last.text is None, "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_ERR(3, 764, __pyx_L1_error)
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(3, 764, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":755
 *     @cython.final
 *     cdef int _flush(self) except -1:
 *         if self._data:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = "".join(self._data)
 */
  }

  /* "src/lxml/saxparser.pxi":765
 *                     self._last.text = text
 *             del self._data[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # internal SAX event handlers
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":754
 * 
 *     @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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/saxparser.pxi":770
 * 
 *     @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;
  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("_handleSaxStart", 1);

  /* "src/lxml/saxparser.pxi":771
 *     @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 == ((int)-1))) __PYX_ERR(3, 771, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":772
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":773
 *         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_INCREF(__pyx_v_self->_factory);
    __pyx_t_4 = __pyx_v_self->_factory; __pyx_t_5 = NULL;
    __pyx_t_1 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_1 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_tag, __pyx_v_attrib};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 2+__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(3, 773, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":774
 *         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_2 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/saxparser.pxi":775
 *             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_ERR(3, 775, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 775, __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_ERR(3, 775, __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_3), ((struct LxmlElement *)__pyx_t_4)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 775, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/saxparser.pxi":774
 *         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:
 */
    }

    /* "src/lxml/saxparser.pxi":772
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
 *         if self._factory is not None:             # <<<<<<<<<<<<<<
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":776
 *             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_2 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/saxparser.pxi":778
 *         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_ERR(3, 778, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 778, __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_ERR(3, 778, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":777
 *                 _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_3 = ((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_3)) __PYX_ERR(3, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/saxparser.pxi":776
 *             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)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/saxparser.pxi":780
 *                 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)
 */
  /*else*/ {

    /* "src/lxml/saxparser.pxi":781
 *         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_3 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/saxparser.pxi":780
 *                 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_3), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__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:;

  /* "src/lxml/saxparser.pxi":782
 *             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 '%.30s'", "append");
    __PYX_ERR(3, 782, __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 == ((int)-1))) __PYX_ERR(3, 782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":783
 *                 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;

  /* "src/lxml/saxparser.pxi":784
 *         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;

  /* "src/lxml/saxparser.pxi":770
 * 
 *     @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_3);
  __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;
}

/* "src/lxml/saxparser.pxi":787
 * 
 *     @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;
  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("_handleSaxEnd", 1);

  /* "src/lxml/saxparser.pxi":788
 *     @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 == ((int)-1))) __PYX_ERR(3, 788, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":789
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
 *         self._last = self._element_stack_pop()             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
  __Pyx_INCREF(__pyx_v_self->_element_stack_pop);
  __pyx_t_3 = __pyx_v_self->_element_stack_pop; __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(3, 789, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":790
 *         self._flush()
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "src/lxml/saxparser.pxi":791
 *         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;

  /* "src/lxml/saxparser.pxi":787
 * 
 *     @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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/saxparser.pxi":794
 * 
 *     @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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/saxparser.pxi":795
 *     @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 '%.30s'", "append");
    __PYX_ERR(3, 795, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 795, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":794
 * 
 *     @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:;
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":798
 * 
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:
 */

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_v_elem = 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("_handleSaxPi", 1);

  /* "src/lxml/saxparser.pxi":799
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)             # <<<<<<<<<<<<<<
 *         if self._insert_pis:
 *             self._flush()
 */
  __Pyx_INCREF(__pyx_v_self->_pi_factory);
  __pyx_t_2 = __pyx_v_self->_pi_factory; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_elem = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":800
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
 */
  if (__pyx_v_self->_insert_pis) {

    /* "src/lxml/saxparser.pxi":801
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:
 *             self._flush()             # <<<<<<<<<<<<<<
 *             self._last = elem
 *             if self._element_stack:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 801, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":802
 *         if self._insert_pis:
 *             self._flush()
 *             self._last = elem             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 */
    if (!(likely(((__pyx_v_elem) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_elem, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(3, 802, __pyx_L1_error)
    __pyx_t_1 = __pyx_v_elem;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/saxparser.pxi":803
 *             self._flush()
 *             self._last = elem
 *             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) {

      /* "src/lxml/saxparser.pxi":804
 *             self._last = elem
 *             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_ERR(3, 804, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 804, __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_ERR(3, 804, __pyx_L1_error)
      __pyx_t_2 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 804, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/saxparser.pxi":803
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
 */
    }

    /* "src/lxml/saxparser.pxi":805
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
    __pyx_v_self->_in_tail = 1;

    /* "src/lxml/saxparser.pxi":800
 *     cdef _handleSaxPi(self, target, data):
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
 */
  }

  /* "src/lxml/saxparser.pxi":806
 *                 _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;

  /* "src/lxml/saxparser.pxi":798
 * 
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         elem = self._pi_factory(target, data)
 *         if self._insert_pis:
 */

  /* 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.TreeBuilder._handleSaxPi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":809
 * 
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:
 */

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_v_elem = 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("_handleSaxComment", 1);

  /* "src/lxml/saxparser.pxi":810
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)             # <<<<<<<<<<<<<<
 *         if self._insert_comments:
 *             self._flush()
 */
  __Pyx_INCREF(__pyx_v_self->_comment_factory);
  __pyx_t_2 = __pyx_v_self->_comment_factory; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_comment};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_elem = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":811
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
 */
  if (__pyx_v_self->_insert_comments) {

    /* "src/lxml/saxparser.pxi":812
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:
 *             self._flush()             # <<<<<<<<<<<<<<
 *             self._last = elem
 *             if self._element_stack:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 812, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":813
 *         if self._insert_comments:
 *             self._flush()
 *             self._last = elem             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 */
    if (!(likely(((__pyx_v_elem) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_elem, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(3, 813, __pyx_L1_error)
    __pyx_t_1 = __pyx_v_elem;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_last);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_last);
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/saxparser.pxi":814
 *             self._flush()
 *             self._last = elem
 *             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) {

      /* "src/lxml/saxparser.pxi":815
 *             self._last = elem
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *             self._in_tail = 1
 *         return elem
 */
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(3, 815, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 815, __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_ERR(3, 815, __pyx_L1_error)
      __pyx_t_2 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 815, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/saxparser.pxi":814
 *             self._flush()
 *             self._last = elem
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
 */
    }

    /* "src/lxml/saxparser.pxi":816
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return elem
 * 
 */
    __pyx_v_self->_in_tail = 1;

    /* "src/lxml/saxparser.pxi":811
 *     cdef _handleSaxComment(self, comment):
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:             # <<<<<<<<<<<<<<
 *             self._flush()
 *             self._last = elem
 */
  }

  /* "src/lxml/saxparser.pxi":817
 *                 _appendChild(self._element_stack[-1], self._last)
 *             self._in_tail = 1
 *         return elem             # <<<<<<<<<<<<<<
 * 
 *     # Python level event handlers
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_elem);
  __pyx_r = __pyx_v_elem;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":809
 * 
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         elem = self._comment_factory(comment)
 *         if self._insert_comments:
 */

  /* 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.TreeBuilder._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_2close, "close(self)\n\n        Flushes the builder buffers, and returns the toplevel document\n        element.  Raises XMLSyntaxError on inconsistencies.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_3close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_2close};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
  __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;
  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("close", 1);

  /* "src/lxml/saxparser.pxi":827
 *         element.  Raises XMLSyntaxError on inconsistencies.
 *         """
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 */
  __pyx_t_1 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/saxparser.pxi":828
 *         """
 *         if self._element_stack:
 *             raise XMLSyntaxAssertionError("missing end tags")             # <<<<<<<<<<<<<<
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_XMLSyntaxAssertionError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_missing_end_tags};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 828, __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_ERR(3, 828, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":827
 *         element.  Raises XMLSyntaxError on inconsistencies.
 *         """
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 */
  }

  /* "src/lxml/saxparser.pxi":830
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing toplevel element")
 *         return self._last
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/saxparser.pxi":831
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:
 *             raise XMLSyntaxAssertionError("missing toplevel element")             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_XMLSyntaxAssertionError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_missing_toplevel_element};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 831, __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_ERR(3, 831, __pyx_L1_error)

    /* "src/lxml/saxparser.pxi":830
 *             raise XMLSyntaxAssertionError("missing end tags")
 *         # TODO: this does not necessarily seem like an error case.  Why not just return None?
 *         if self._last is None:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxAssertionError("missing toplevel element")
 *         return self._last
 */
  }

  /* "src/lxml/saxparser.pxi":832
 *         if self._last is None:
 *             raise XMLSyntaxAssertionError("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;

  /* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */

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

/* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_5data = {"data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_5data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_4data};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 834, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "data") < 0)) __PYX_ERR(3, 834, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 834, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_4data(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/saxparser.pxi":840
 *         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(__pyx_v_self, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 840, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_6start, "start(self, tag, attrs, nsmap=None)\n\n        Opens a new element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_7start = {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_7start, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_6start};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_nsmap = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrs,&__pyx_n_s_nsmap,0};
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 842, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrs)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 842, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, 1); __PYX_ERR(3, 842, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 842, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "start") < 0)) __PYX_ERR(3, 842, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, __pyx_nargs); __PYX_ERR(3, 842, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start", 0);
  __Pyx_INCREF(__pyx_v_nsmap);

  /* "src/lxml/saxparser.pxi":847
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/saxparser.pxi":848
 *         """
 *         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);

    /* "src/lxml/saxparser.pxi":847
 *         Opens a new element.
 *         """
 *         if nsmap is None:             # <<<<<<<<<<<<<<
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)
 */
  }

  /* "src/lxml/saxparser.pxi":849
 *         if nsmap is None:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_8end, "end(self, tag)\n\n        Closes the current element.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_9end = {"end", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_9end, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_8end};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 851, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "end") < 0)) __PYX_ERR(3, 851, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 851, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_8end(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_tag);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end", 1);

  /* "src/lxml/saxparser.pxi":856
 *         Closes the current element.
 *         """
 *         element = self._handleSaxEnd(tag)             # <<<<<<<<<<<<<<
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(__pyx_v_self, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/saxparser.pxi":857
 *         """
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\             # <<<<<<<<<<<<<<
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
 *         return element
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 857, __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_ERR(3, 857, __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_ERR(3, 857, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {

      /* "src/lxml/saxparser.pxi":858
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"             # <<<<<<<<<<<<<<
 *         return element
 * 
 */
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_end_tag_mismatch_expected);
      __pyx_t_4 += 27;
      __Pyx_GIVEREF(__pyx_kp_u_end_tag_mismatch_expected);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_end_tag_mismatch_expected);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u_got);
      __pyx_t_4 += 6;
      __Pyx_GIVEREF(__pyx_kp_u_got);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_got);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__61);
      __pyx_t_4 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__61);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__61);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(3, 857, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(3, 857, __pyx_L1_error)
  #endif

  /* "src/lxml/saxparser.pxi":859
 *         assert self._last.tag == tag,\
 *             f"end tag mismatch (expected {self._last.tag}, got {tag})"
 *         return element             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_10pi, "pi(self, target, data=None)\n\n        Creates a processing instruction using the factory, appends it\n        (unless disabled) and returns it.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_11pi = {"pi", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_11pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_10pi};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_data,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 861, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 861, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pi") < 0)) __PYX_ERR(3, 861, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 0, 1, 2, __pyx_nargs); __PYX_ERR(3, 861, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/saxparser.pxi":867
 *         (unless disabled) and returns it.
 *         """
 *         return self._handleSaxPi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(__pyx_v_self, __pyx_v_target, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
 */

  /* 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;
}

/* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_11TreeBuilder_12comment, "comment(self, comment)\n\n        Creates a comment using the factory, appends it (unless disabled)\n        and returns it.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_11TreeBuilder_13comment = {"comment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_13comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_12comment};
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_comment = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comment,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 869, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "comment") < 0)) __PYX_ERR(3, 869, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_comment = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 869, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_12comment(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_comment);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/saxparser.pxi":875
 *         and returns it.
 *         """
 *         return self._handleSaxComment(comment)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(__pyx_v_self, __pyx_v_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/parsertarget.pxi":14
 *     # 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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_result = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_result,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 14, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 14, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(4, 14, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(4, 14, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(4, 14, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/parsertarget.pxi":15
 *     # machinery towards the API level functions
 *     def __init__(self, result):
 *         self.result = result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_result, __pyx_v_result) < 0) __PYX_ERR(4, 15, __pyx_L1_error)

  /* "src/lxml/parsertarget.pxi":14
 *     # 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;
}

/* "src/lxml/parsertarget.pxi":31
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 31, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(4, 31, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_target = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(4, 31, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  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("__cinit__", 1);

  /* "src/lxml/parsertarget.pxi":33
 *     def __cinit__(self, target):
 *         cdef int event_filter
 *         event_filter = 0             # <<<<<<<<<<<<<<
 *         self._start_takes_nsmap = 0
 *         try:
 */
  __pyx_v_event_filter = 0;

  /* "src/lxml/parsertarget.pxi":34
 *         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;

  /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":36
 *         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_ERR(4, 36, __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;

      /* "src/lxml/parsertarget.pxi":37
 *         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);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":38
 *             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);

        /* "src/lxml/parsertarget.pxi":37
 *         try:
 *             self._target_start = target.start
 *             if self._target_start is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
 */
    }

    /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 */
    /*else:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/parsertarget.pxi":43
 *         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_INCREF(__pyx_v_4lxml_5etree_inspect_getargspec);
          __pyx_t_9 = __pyx_v_4lxml_5etree_inspect_getargspec; __pyx_t_10 = NULL;
          __pyx_t_11 = 0;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
              __pyx_t_11 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_self->_target_start};
            __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 43, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __pyx_v_arguments = __pyx_t_4;
          __pyx_t_4 = 0;

          /* "src/lxml/parsertarget.pxi":44
 *             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_4 = __Pyx_GetItemInt(__pyx_v_arguments, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 44, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(4, 44, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_13 = (__pyx_t_12 > 3);
          if (!__pyx_t_13) {
          } else {
            __pyx_t_5 = __pyx_t_13;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_arguments, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 44, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = (__pyx_t_4 != Py_None);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_5 = __pyx_t_13;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_5) {

            /* "src/lxml/parsertarget.pxi":45
 *                 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;

            /* "src/lxml/parsertarget.pxi":44
 *             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:
 */
          }

          /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 */
        }
        __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_L10_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "src/lxml/parsertarget.pxi":46
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         try:
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_11) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L11_exception_handled;
        }
        goto __pyx_L12_except_error;

        /* "src/lxml/parsertarget.pxi":42
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 */
        __pyx_L12_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_except_error;
        __pyx_L11_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:;
      }
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/parsertarget.pxi":39
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         else:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/parsertarget.pxi":35
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
 */
    __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_L8_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":49
 *                 pass
 *         try:
 *             self._target_end = target.end             # <<<<<<<<<<<<<<
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 49, __pyx_L19_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_end);
      __Pyx_DECREF(__pyx_v_self->_target_end);
      __pyx_v_self->_target_end = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":50
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_end != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":51
 *             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);

        /* "src/lxml/parsertarget.pxi":50
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
 */
    }
    __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_L24_try_end;
    __pyx_L19_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":52
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L20_exception_handled;
    }
    goto __pyx_L21_except_error;

    /* "src/lxml/parsertarget.pxi":48
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
 */
    __pyx_L21_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L20_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_L24_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":55
 *             pass
 *         try:
 *             self._target_start_ns = target.start_ns             # <<<<<<<<<<<<<<
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_start_ns_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 55, __pyx_L26_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_start_ns);
      __Pyx_DECREF(__pyx_v_self->_target_start_ns);
      __pyx_v_self->_target_start_ns = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":56
 *         try:
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_start_ns != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":57
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_START_NS);

        /* "src/lxml/parsertarget.pxi":56
 *         try:
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not 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_L31_try_end;
    __pyx_L26_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":58
 *             if self._target_start_ns is not None:
 *                 event_filter |= SAX_EVENT_START_NS
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L27_exception_handled;
    }
    goto __pyx_L28_except_error;

    /* "src/lxml/parsertarget.pxi":54
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start_ns = target.start_ns
 *             if self._target_start_ns is not None:
 */
    __pyx_L28_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_L27_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_L31_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":61
 *             pass
 *         try:
 *             self._target_end_ns = target.end_ns             # <<<<<<<<<<<<<<
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_end_ns_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 61, __pyx_L33_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_end_ns);
      __Pyx_DECREF(__pyx_v_self->_target_end_ns);
      __pyx_v_self->_target_end_ns = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":62
 *         try:
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_end_ns != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":63
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_END_NS);

        /* "src/lxml/parsertarget.pxi":62
 *         try:
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
 */
    }
    __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_L38_try_end;
    __pyx_L33_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":64
 *             if self._target_end_ns is not None:
 *                 event_filter |= SAX_EVENT_END_NS
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L34_exception_handled;
    }
    goto __pyx_L35_except_error;

    /* "src/lxml/parsertarget.pxi":60
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end_ns = target.end_ns
 *             if self._target_end_ns is not None:
 */
    __pyx_L35_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_L34_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_L38_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":67
 *             pass
 *         try:
 *             self._target_data = target.data             # <<<<<<<<<<<<<<
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 67, __pyx_L40_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_data);
      __Pyx_DECREF(__pyx_v_self->_target_data);
      __pyx_v_self->_target_data = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":68
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_data != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":69
 *             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);

        /* "src/lxml/parsertarget.pxi":68
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not 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_L45_try_end;
    __pyx_L40_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":70
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L41_exception_handled;
    }
    goto __pyx_L42_except_error;

    /* "src/lxml/parsertarget.pxi":66
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
 */
    __pyx_L42_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_L41_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_L45_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":73
 *             pass
 *         try:
 *             self._target_doctype = target.doctype             # <<<<<<<<<<<<<<
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_doctype); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 73, __pyx_L47_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_doctype);
      __Pyx_DECREF(__pyx_v_self->_target_doctype);
      __pyx_v_self->_target_doctype = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":74
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_doctype != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":75
 *             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);

        /* "src/lxml/parsertarget.pxi":74
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 */
    }
    __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_L52_try_end;
    __pyx_L47_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":76
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L48_exception_handled;
    }
    goto __pyx_L49_except_error;

    /* "src/lxml/parsertarget.pxi":72
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 */
    __pyx_L49_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_L48_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_L52_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":79
 *             pass
 *         try:
 *             self._target_pi = target.pi             # <<<<<<<<<<<<<<
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_pi); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 79, __pyx_L54_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_pi);
      __Pyx_DECREF(__pyx_v_self->_target_pi);
      __pyx_v_self->_target_pi = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":80
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_pi != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":81
 *             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);

        /* "src/lxml/parsertarget.pxi":80
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not 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_L59_try_end;
    __pyx_L54_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":82
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L55_exception_handled;
    }
    goto __pyx_L56_except_error;

    /* "src/lxml/parsertarget.pxi":78
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 */
    __pyx_L56_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_L55_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_L59_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":85
 *             pass
 *         try:
 *             self._target_comment = target.comment             # <<<<<<<<<<<<<<
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_comment); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 85, __pyx_L61_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_comment);
      __Pyx_DECREF(__pyx_v_self->_target_comment);
      __pyx_v_self->_target_comment = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "src/lxml/parsertarget.pxi":86
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_comment != Py_None);
      if (__pyx_t_5) {

        /* "src/lxml/parsertarget.pxi":87
 *             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);

        /* "src/lxml/parsertarget.pxi":86
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:
 */
      }

      /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 */
    }
    __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_L66_try_end;
    __pyx_L61_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "src/lxml/parsertarget.pxi":88
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         self._sax_event_filter = event_filter
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L62_exception_handled;
    }
    goto __pyx_L63_except_error;

    /* "src/lxml/parsertarget.pxi":84
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 */
    __pyx_L63_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_L62_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_L66_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":90
 *         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;

  /* "src/lxml/parsertarget.pxi":31
 *     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_9);
  __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;
}

/* "src/lxml/parsertarget.pxi":92
 *         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
  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("_handleSaxStart", 1);

  /* "src/lxml/parsertarget.pxi":93
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 */
  if (__pyx_v_self->_start_takes_nsmap) {

    /* "src/lxml/parsertarget.pxi":94
 *     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_INCREF(__pyx_v_self->_target_start);
    __pyx_t_2 = __pyx_v_self->_target_start; __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 94, __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;

    /* "src/lxml/parsertarget.pxi":93
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 */
  }

  /* "src/lxml/parsertarget.pxi":96
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 *             return self._target_start(tag, attrib)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEnd(self, tag):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_target_start);
    __pyx_t_2 = __pyx_v_self->_target_start; __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_tag, __pyx_v_attrib};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 96, __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;
  }

  /* "src/lxml/parsertarget.pxi":92
 *         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_1);
  __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;
}

/* "src/lxml/parsertarget.pxi":98
 *             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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEnd", 1);

  /* "src/lxml/parsertarget.pxi":99
 * 
 *     cdef _handleSaxEnd(self, tag):
 *         return self._target_end(tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_target_end);
  __pyx_t_2 = __pyx_v_self->_target_end; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_tag};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 99, __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;

  /* "src/lxml/parsertarget.pxi":98
 *             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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parsertarget.pxi":101
 *         return self._target_end(tag)
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return self._target_start_ns(prefix, uri)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  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("_handleSaxStartNs", 1);

  /* "src/lxml/parsertarget.pxi":102
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):
 *         return self._target_start_ns(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEndNs(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_target_start_ns);
  __pyx_t_2 = __pyx_v_self->_target_start_ns; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_prefix, __pyx_v_uri};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 102, __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;

  /* "src/lxml/parsertarget.pxi":101
 *         return self._target_end(tag)
 * 
 *     cdef _handleSaxStartNs(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         return self._target_start_ns(prefix, uri)
 * 
 */

  /* 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._PythonSaxParserTarget._handleSaxStartNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":104
 *         return self._target_start_ns(prefix, uri)
 * 
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return self._target_end_ns(prefix)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_prefix) {
  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("_handleSaxEndNs", 1);

  /* "src/lxml/parsertarget.pxi":105
 * 
 *     cdef _handleSaxEndNs(self, prefix):
 *         return self._target_end_ns(prefix)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_target_end_ns);
  __pyx_t_2 = __pyx_v_self->_target_end_ns; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_prefix};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 105, __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;

  /* "src/lxml/parsertarget.pxi":104
 *         return self._target_start_ns(prefix, uri)
 * 
 *     cdef _handleSaxEndNs(self, prefix):             # <<<<<<<<<<<<<<
 *         return self._target_end_ns(prefix)
 * 
 */

  /* 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._PythonSaxParserTarget._handleSaxEndNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":107
 *         return self._target_end_ns(prefix)
 * 
 *     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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxData", 1);

  /* "src/lxml/parsertarget.pxi":108
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._target_data(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */
  __Pyx_INCREF(__pyx_v_self->_target_data);
  __pyx_t_2 = __pyx_v_self->_target_data; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 108, __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;

  /* "src/lxml/parsertarget.pxi":107
 *         return self._target_end_ns(prefix)
 * 
 *     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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":110
 *         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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxDoctype", 1);

  /* "src/lxml/parsertarget.pxi":111
 * 
 *     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_INCREF(__pyx_v_self->_target_doctype);
  __pyx_t_2 = __pyx_v_self->_target_doctype; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_root_tag, __pyx_v_public_id, __pyx_v_system_id};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 111, __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;

  /* "src/lxml/parsertarget.pxi":110
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxDoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":113
 *         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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxPi", 1);

  /* "src/lxml/parsertarget.pxi":114
 * 
 *     cdef _handleSaxPi(self, target, data):
 *         return self._target_pi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxComment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_target_pi);
  __pyx_t_2 = __pyx_v_self->_target_pi; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 114, __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;

  /* "src/lxml/parsertarget.pxi":113
 *         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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parsertarget.pxi":116
 *         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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxComment", 1);

  /* "src/lxml/parsertarget.pxi":117
 * 
 *     cdef _handleSaxComment(self, comment):
 *         return self._target_comment(comment)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_target_comment);
  __pyx_t_2 = __pyx_v_self->_target_comment; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_comment};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 117, __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;

  /* "src/lxml/parsertarget.pxi":116
 *         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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/parsertarget.pxi":127
 *     """
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setTarget", 0);
  __Pyx_INCREF(__pyx_v_target);

  /* "src/lxml/parsertarget.pxi":128
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target             # <<<<<<<<<<<<<<
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__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;

  /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_target, __pyx_ptype_4lxml_5etree__SaxParserTarget); 
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/parsertarget.pxi":130
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__dict__'):             # <<<<<<<<<<<<<<
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 */
  __pyx_t_3 = __Pyx_HasAttr(__pyx_v_target, __pyx_n_u_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 130, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
 */
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":131
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         self._setSaxParserTarget(target)
 *         return 0
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__PythonSaxParserTarget), __pyx_v_target); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/parsertarget.pxi":129
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, '__dict__'):
 *             target = _PythonSaxParserTarget(target)
 */
  }

  /* "src/lxml/parsertarget.pxi":132
 *                 hasattr(target, '__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_ERR(4, 132, __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));

  /* "src/lxml/parsertarget.pxi":133
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":127
 *     """
 *     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_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;
}

/* "src/lxml/parsertarget.pxi":135
 *         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", 1);

  /* "src/lxml/parsertarget.pxi":137
 *     cdef _ParserContext _copy(self):
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._setTarget(self._python_target)
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_14_ParserContext__copy(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 137, __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_ERR(4, 137, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":138
 *         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 == ((int)-1))) __PYX_ERR(4, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/parsertarget.pxi":139
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 */
  __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;

  /* "src/lxml/parsertarget.pxi":135
 *         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;
}

/* "src/lxml/parsertarget.pxi":141
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/parsertarget.pxi":142
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         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_2 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != __pyx_v_result);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/parsertarget.pxi":144
 *         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);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         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
 */
    if (__pyx_t_1) {

      /* "src/lxml/parsertarget.pxi":146
 *                     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);

      /* "src/lxml/parsertarget.pxi":143
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         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
 */
    }

    /* "src/lxml/parsertarget.pxi":147
 *                 # 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;

    /* "src/lxml/parsertarget.pxi":142
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:
 *         if self._c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:
 */
  }

  /* "src/lxml/parsertarget.pxi":141
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result) noexcept:             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 */

  /* function exit code */
}

/* "src/lxml/parsertarget.pxi":149
 *             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_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;
  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("_handleParseResult", 1);

  /* "src/lxml/parsertarget.pxi":152
 *                                    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);

  /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":154
 *         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)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 154, __pyx_L3_error)
      if (__pyx_t_4) {

        /* "src/lxml/parsertarget.pxi":155
 *         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);

        /* "src/lxml/parsertarget.pxi":156
 *             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 == ((int)-1))) __PYX_ERR(4, 156, __pyx_L3_error)

        /* "src/lxml/parsertarget.pxi":154
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:
 *             if self._has_raised():             # <<<<<<<<<<<<<<
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 */
      }

      /* "src/lxml/parsertarget.pxi":157
 *                 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_6 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
      if (__pyx_t_6) {
      } else {
        __pyx_t_4 = __pyx_t_6;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_6 = (!__pyx_v_recover);
      __pyx_t_4 = __pyx_t_6;
      __pyx_L11_bool_binop_done:;
      if (__pyx_t_4) {

        /* "src/lxml/parsertarget.pxi":158
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             self._python_target.close()
 */
        __pyx_t_7 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_7);
        __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_7)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 158, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/parsertarget.pxi":157
 *                 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:
 */
      }

      /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/parsertarget.pxi":159
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             self._python_target.close()
 *             raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(4, 159, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/parsertarget.pxi":160
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             self._python_target.close()             # <<<<<<<<<<<<<<
 *             raise
 *         return self._python_target.close()
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 160, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 160, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "src/lxml/parsertarget.pxi":161
 *         except:
 *             self._python_target.close()
 *             raise             # <<<<<<<<<<<<<<
 *         return self._python_target.close()
 * 
 */
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; 
      __PYX_ERR(4, 161, __pyx_L5_except_error)
    }

    /* "src/lxml/parsertarget.pxi":153
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 */
    __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_L8_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":162
 *             self._python_target.close()
 *             raise
 *         return self._python_target.close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "src/lxml/parsertarget.pxi":149
 *             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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/parsertarget.pxi":164
 *         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_parse_result = NULL;
  xmlDoc *__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;
  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("_handleParseResultDoc", 1);

  /* "src/lxml/parsertarget.pxi":167
 *                                        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);

  /* "src/lxml/parsertarget.pxi":168
 *         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_2 = (__pyx_v_result != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_result->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/parsertarget.pxi":170
 *         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);

    /* "src/lxml/parsertarget.pxi":168
 *         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)
 */
  }

  /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/parsertarget.pxi":172
 *             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);

      /* "src/lxml/parsertarget.pxi":173
 *         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_6 = ((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_6 == ((int)-1))) __PYX_ERR(4, 173, __pyx_L6_error)

      /* "src/lxml/parsertarget.pxi":174
 *             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_2 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_2 = (!__pyx_v_recover);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/parsertarget.pxi":175
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             self._python_target.close()
 */
        __pyx_t_7 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_6 = __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_7)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(4, 175, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/parsertarget.pxi":174
 *             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:
 */
      }

      /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 */
    }
    __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_L6_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/parsertarget.pxi":176
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             self._python_target.close()
 *             raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(4, 176, __pyx_L8_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "src/lxml/parsertarget.pxi":177
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             self._python_target.close()             # <<<<<<<<<<<<<<
 *             raise
 *         parse_result = self._python_target.close()
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 177, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 177, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "src/lxml/parsertarget.pxi":178
 *         except:
 *             self._python_target.close()
 *             raise             # <<<<<<<<<<<<<<
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)
 */
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; 
      __PYX_ERR(4, 178, __pyx_L8_except_error)
    }

    /* "src/lxml/parsertarget.pxi":171
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 */
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L11_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":179
 *             self._python_target.close()
 *             raise
 *         parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *         raise _TargetParserResult(parse_result)
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __pyx_v_parse_result = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "src/lxml/parsertarget.pxi":180
 *             raise
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)             # <<<<<<<<<<<<<<
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_parse_result};
    __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_Raise(__pyx_t_9, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __PYX_ERR(4, 180, __pyx_L1_error)

  /* "src/lxml/parsertarget.pxi":164
 *         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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XDECREF(__pyx_v_parse_result);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":18
 * 
 * 
 * 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;
  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("_findOutputMethod", 0);
  __Pyx_INCREF(__pyx_v_method);

  /* "src/lxml/serializer.pxi":19
 * 
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":20
 * 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;

    /* "src/lxml/serializer.pxi":19
 * 
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 */
  }

  /* "src/lxml/serializer.pxi":21
 *     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_ERR(10, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":22
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == "xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_xml, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 22, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":23
 *     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;

    /* "src/lxml/serializer.pxi":22
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == "xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
 */
  }

  /* "src/lxml/serializer.pxi":24
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 *     if method == "html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_html, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 24, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":25
 *         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;

    /* "src/lxml/serializer.pxi":24
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 *     if method == "html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 */
  }

  /* "src/lxml/serializer.pxi":26
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_text, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 26, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":27
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT             # <<<<<<<<<<<<<<
 *     raise ValueError(f"unknown output method {method!r}")
 * 
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":26
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")
 */
  }

  /* "src/lxml/serializer.pxi":28
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(f"unknown output method {method!r}")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_method), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_unknown_output_method, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 28, __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_ERR(10, 28, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":18
 * 
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 */

  /* 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._findOutputMethod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":31
 * 
 * 
 * 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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  char *__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);

  /* "src/lxml/serializer.pxi":38
 *     cdef int error_result
 * 
 *     c_buffer = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         raise MemoryError()
 */
  __pyx_v_c_buffer = xmlBufferCreate();

  /* "src/lxml/serializer.pxi":39
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":40
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    PyErr_NoMemory(); __PYX_ERR(10, 40, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":39
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
  }

  /* "src/lxml/serializer.pxi":42
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/serializer.pxi":43
 * 
 *     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);

        /* "src/lxml/serializer.pxi":44
 *     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:
 */
        if (__pyx_v_with_tail) {

          /* "src/lxml/serializer.pxi":45
 *         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);

          /* "src/lxml/serializer.pxi":46
 *         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);
            if (!__pyx_t_1) break;

            /* "src/lxml/serializer.pxi":47
 *             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));

            /* "src/lxml/serializer.pxi":48
 *             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);
          }

          /* "src/lxml/serializer.pxi":44
 *     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:
 */
        }

        /* "src/lxml/serializer.pxi":49
 *                 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);
      }

      /* "src/lxml/serializer.pxi":42
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "src/lxml/serializer.pxi":51
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 */
  __pyx_t_2 = (__pyx_v_error_result < 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_text == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L11_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":52
 * 
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 * 
 */
    xmlBufferFree(__pyx_v_c_buffer);

    /* "src/lxml/serializer.pxi":53
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_SerialisationError), __pyx_kp_u_Error_during_serialisation_out_o, 0, 0);
    __PYX_ERR(10, 53, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":51
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 */
  }

  /* "src/lxml/serializer.pxi":55
 *         raise SerialisationError, "Error during serialisation (out of memory?)"
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         needs_conversion = 0
 *         if encoding is unicode:
 */
  /*try:*/ {

    /* "src/lxml/serializer.pxi":56
 * 
 *     try:
 *         needs_conversion = 0             # <<<<<<<<<<<<<<
 *         if encoding is unicode:
 *             needs_conversion = 1
 */
    __pyx_v_needs_conversion = 0;

    /* "src/lxml/serializer.pxi":57
 *     try:
 *         needs_conversion = 0
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
 */
    __pyx_t_1 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":58
 *         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;

      /* "src/lxml/serializer.pxi":57
 *     try:
 *         needs_conversion = 0
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
 */
      goto __pyx_L16;
    }

    /* "src/lxml/serializer.pxi":59
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":61
 *         elif encoding is not None:
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()             # <<<<<<<<<<<<<<
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 61, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 61, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":62
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):             # <<<<<<<<<<<<<<
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 */
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_3 = __pyx_v_encoding;
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_utf8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 62, __pyx_L14_error)
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_utf_8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 62, __pyx_L14_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_L18_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __pyx_t_1;
      if (__pyx_t_2) {

        /* "src/lxml/serializer.pxi":63
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':             # <<<<<<<<<<<<<<
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
 */
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_encoding, __pyx_n_u_ascii, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 63, __pyx_L14_error)
        if (__pyx_t_2) {

          /* "src/lxml/serializer.pxi":64
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree_isutf8l(__pyx_v_c_text, xmlBufferLength(__pyx_v_c_buffer));
          if (__pyx_t_2) {

            /* "src/lxml/serializer.pxi":66
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
 *                         needs_conversion = 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     needs_conversion = 1
 */
            __pyx_v_needs_conversion = 1;

            /* "src/lxml/serializer.pxi":64
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
 */
          }

          /* "src/lxml/serializer.pxi":63
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):
 *                 if encoding == 'ascii':             # <<<<<<<<<<<<<<
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 *                         # will raise a decode error below
 */
          goto __pyx_L20;
        }

        /* "src/lxml/serializer.pxi":68
 *                         needs_conversion = 1
 *                 else:
 *                     needs_conversion = 1             # <<<<<<<<<<<<<<
 * 
 *         if needs_conversion:
 */
        /*else*/ {
          __pyx_v_needs_conversion = 1;
        }
        __pyx_L20:;

        /* "src/lxml/serializer.pxi":62
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 *             if encoding not in ('utf8', 'utf-8'):             # <<<<<<<<<<<<<<
 *                 if encoding == 'ascii':
 *                     if isutf8l(c_text, tree.xmlBufferLength(c_buffer)):
 */
      }

      /* "src/lxml/serializer.pxi":59
 *         if encoding is unicode:
 *             needs_conversion = 1
 *         elif encoding is not None:             # <<<<<<<<<<<<<<
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 */
    }
    __pyx_L16:;

    /* "src/lxml/serializer.pxi":70
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
 */
    if (__pyx_v_needs_conversion) {

      /* "src/lxml/serializer.pxi":71
 * 
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')             # <<<<<<<<<<<<<<
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)
 */
      __pyx_t_3 = __Pyx_decode_c_string(((const char *)__pyx_v_c_text), 0, xmlBufferLength(__pyx_v_c_buffer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 71, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_text = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":72
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 */
      __pyx_t_2 = (__pyx_v_encoding != ((PyObject *)(&PyUnicode_Type)));
      if (__pyx_t_2) {

        /* "src/lxml/serializer.pxi":73
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 73, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":75
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')             # <<<<<<<<<<<<<<
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]
 */
        __pyx_t_7 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(10, 75, __pyx_L14_error)

        /* "src/lxml/serializer.pxi":74
 *             if encoding is not unicode:
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     text, encoding, 'strict')
 *         else:
 */
        __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_text, __pyx_t_7, ((char *)"strict")); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 74, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":72
 *         if needs_conversion:
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 */
      }

      /* "src/lxml/serializer.pxi":70
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8')
 *             if encoding is not unicode:
 */
      goto __pyx_L22;
    }

    /* "src/lxml/serializer.pxi":77
 *                     text, encoding, 'strict')
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_c_text)) + 0, xmlBufferLength(__pyx_v_c_buffer) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 77, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_text = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L22:;
  }

  /* "src/lxml/serializer.pxi":79
 *             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_L15;
    }
    __pyx_L14_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      __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_6 = __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_6; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L15:;
  }

  /* "src/lxml/serializer.pxi":80
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":31
 * 
 * 
 * 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_3);
  __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;
}

/* "src/lxml/serializer.pxi":83
 * 
 * 
 * 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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  xmlBuf *__pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_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);

  /* "src/lxml/serializer.pxi":97
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":98
 *     cdef int error_result
 *     if element is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":97
 *     cdef int c_method
 *     cdef int error_result
 *     if element is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(element)
 */
  }

  /* "src/lxml/serializer.pxi":99
 *     if element is None:
 *         return None
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(10, 99, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":100
 *         return None
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(10, 100, __pyx_L1_error)
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":101
 *     _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_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":102
 *     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_3 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":101
 *     _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:
 */
  }

  /* "src/lxml/serializer.pxi":103
 *     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_4 = (__pyx_v_encoding == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_1 = __pyx_t_4;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":104
 *         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;

    /* "src/lxml/serializer.pxi":103
 *     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:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":106
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":107
 *     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:;

  /* "src/lxml/serializer.pxi":108
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":109
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;

    /* "src/lxml/serializer.pxi":108
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
    goto __pyx_L8;
  }

  /* "src/lxml/serializer.pxi":111
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 *     # it is necessary to *and* find the encoding handler *and* use
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":112
 *     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_L8:;

  /* "src/lxml/serializer.pxi":115
 *     # 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);

  /* "src/lxml/serializer.pxi":116
 *     # 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_4 = (__pyx_v_enchandler == NULL);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_enc != NULL);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":117
 *     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, f"unknown encoding: '{encoding}'"
 */
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":118
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_2 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_2 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_kp_u_UTF_8};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_2, 1+__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":117
 *     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, f"unknown encoding: '{encoding}'"
 */
    }

    /* "src/lxml/serializer.pxi":119
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"             # <<<<<<<<<<<<<<
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = 0;
    __pyx_t_8 = 127;
    __Pyx_INCREF(__pyx_kp_u_unknown_encoding);
    __pyx_t_7 += 19;
    __Pyx_GIVEREF(__pyx_kp_u_unknown_encoding);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_unknown_encoding);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_encoding, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_8;
    __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_7 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__25);
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(10, 119, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":116
 *     # 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')
 */
  }

  /* "src/lxml/serializer.pxi":120
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_v_c_buffer = xmlAllocOutputBuffer(__pyx_v_enchandler);

  /* "src/lxml/serializer.pxi":121
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()
 */
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":122
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
    (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

    /* "src/lxml/serializer.pxi":123
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    PyErr_NoMemory(); __PYX_ERR(10, 123, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":121
 *         raise LookupError, f"unknown encoding: '{encoding}'"
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()
 */
  }

  /* "src/lxml/serializer.pxi":125
 *         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;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/serializer.pxi":126
 * 
 *     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);

        /* "src/lxml/serializer.pxi":129
 *                            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
 */
        (void)(xmlOutputBufferFlush(__pyx_v_c_buffer));

        /* "src/lxml/serializer.pxi":130
 *                            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_1 = (__pyx_v_c_buffer->conv != NULL);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":131
 *         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_9 = __pyx_v_c_buffer->conv;
          __pyx_v_c_result_buffer = __pyx_t_9;

          /* "src/lxml/serializer.pxi":130
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:             # <<<<<<<<<<<<<<
 *             c_result_buffer = c_buffer.conv
 *         else:
 */
          goto __pyx_L17;
        }

        /* "src/lxml/serializer.pxi":133
 *             c_result_buffer = c_buffer.conv
 *         else:
 *             c_result_buffer = c_buffer.buffer             # <<<<<<<<<<<<<<
 * 
 *     error_result = c_buffer.error
 */
        /*else*/ {
          __pyx_t_9 = __pyx_v_c_buffer->buffer;
          __pyx_v_c_result_buffer = __pyx_t_9;
        }
        __pyx_L17:;
      }

      /* "src/lxml/serializer.pxi":125
 *         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
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
  }

  /* "src/lxml/serializer.pxi":135
 *             c_result_buffer = c_buffer.buffer
 * 
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
  __pyx_t_2 = __pyx_v_c_buffer->error;
  __pyx_v_error_result = __pyx_t_2;

  /* "src/lxml/serializer.pxi":136
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
 */
  __pyx_t_1 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":137
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
    (void)(xmlOutputBufferClose(__pyx_v_c_buffer));

    /* "src/lxml/serializer.pxi":138
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":136
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
 */
  }

  /* "src/lxml/serializer.pxi":140
 *         _raiseSerialisationError(error_result)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if encoding is unicode:
 *             result = (<unsigned char*>tree.xmlBufContent(
 */
  /*try:*/ {

    /* "src/lxml/serializer.pxi":141
 * 
 *     try:
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 */
    __pyx_t_1 = (__pyx_v_encoding == ((PyObject *)(&PyUnicode_Type)));
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":143
 *         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_5 = __Pyx_decode_c_string(((char const *)((unsigned char *)xmlBufContent(__pyx_v_c_result_buffer))), 0, xmlBufUse(__pyx_v_c_result_buffer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 143, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_result = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":141
 * 
 *     try:
 *         if encoding is unicode:             # <<<<<<<<<<<<<<
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 */
      goto __pyx_L22;
    }

    /* "src/lxml/serializer.pxi":145
 *                 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:
 */
    /*else*/ {

      /* "src/lxml/serializer.pxi":146
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_t_5 = __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_5)) __PYX_ERR(10, 146, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "src/lxml/serializer.pxi":145
 *                 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_3 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L22:;
  }

  /* "src/lxml/serializer.pxi":148
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if error_result == -1:
 *         _raiseSerialisationError(error_result)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      goto __pyx_L21;
    }
    __pyx_L20_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __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_XGOTREF(__pyx_t_17);
      __pyx_t_2 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L21:;
  }

  /* "src/lxml/serializer.pxi":149
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
 */
  __pyx_t_1 = (__pyx_v_error_result == -1L);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":150
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":149
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result == -1:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
 */
  }

  /* "src/lxml/serializer.pxi":151
 *     if error_result == -1:
 *         _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;

  /* "src/lxml/serializer.pxi":83
 * 
 * 
 * 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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/serializer.pxi":153
 *     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;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  xmlChar **__pyx_t_5;
  xmlChar **__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("_tostringC14N", 1);

  /* "src/lxml/serializer.pxi":155
 * 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;

  /* "src/lxml/serializer.pxi":156
 *     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;

  /* "src/lxml/serializer.pxi":162
 *     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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":163
 * 
 *     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_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element_or_tree)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(10, 163, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":164
 *     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_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_element_or_tree)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":165
 *         _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_4 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_doc->_c_doc, ((struct LxmlElement *)__pyx_v_element_or_tree)->_c_node, 0); if (unlikely(__pyx_t_4 == ((xmlDoc *)NULL))) __PYX_ERR(10, 165, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/serializer.pxi":162
 *     cdef xmlChar **c_inclusive_ns_prefixes
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":167
 *         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
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":168
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(10, 168, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":169
 *         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_4 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_4;
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":171
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 171, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_6 = __pyx_f_4lxml_5etree__convert_ns_prefixes(__pyx_v_c_doc->dict, __pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_6 == ((xmlChar **)NULL))) __PYX_ERR(10, 171, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
  } else {
    __pyx_t_5 = NULL;
  }
  __pyx_v_c_inclusive_ns_prefixes = __pyx_t_5;

  /* "src/lxml/serializer.pxi":172
 * 
 *     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:*/ {

    /* "src/lxml/serializer.pxi":173
 *     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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/serializer.pxi":174
 *     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));
        }

        /* "src/lxml/serializer.pxi":173
 *     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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }
  }

  /* "src/lxml/serializer.pxi":178
 * 
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

      /* "src/lxml/serializer.pxi":179
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
      __pyx_t_1 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":180
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 */
        lxml_free(__pyx_v_c_inclusive_ns_prefixes);

        /* "src/lxml/serializer.pxi":179
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
      }
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "src/lxml/serializer.pxi":182
 *             python.lxml_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_7 = (__pyx_v_byte_count < 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_c_buffer == NULL);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":183
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
 */
    __pyx_t_1 = (__pyx_v_c_buffer != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":184
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise C14NError, "C14N failed"
 *     try:
 */
      xmlFree(__pyx_v_c_buffer);

      /* "src/lxml/serializer.pxi":183
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
 */
    }

    /* "src/lxml/serializer.pxi":185
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"             # <<<<<<<<<<<<<<
 *     try:
 *         result = c_buffer[:byte_count]
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_C14NError), __pyx_kp_u_C14N_failed, 0, 0);
    __PYX_ERR(10, 185, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":182
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if byte_count < 0 or c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 */
  }

  /* "src/lxml/serializer.pxi":186
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, "C14N failed"
 *     try:             # <<<<<<<<<<<<<<
 *         result = c_buffer[:byte_count]
 *     finally:
 */
  /*try:*/ {

    /* "src/lxml/serializer.pxi":187
 *         raise C14NError, "C14N failed"
 *     try:
 *         result = c_buffer[:byte_count]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_buffer)
 */
    __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_c_buffer) + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 187, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "src/lxml/serializer.pxi":189
 *         result = c_buffer[:byte_count]
 *     finally:
 *         tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_buffer);
      goto __pyx_L17;
    }
    __pyx_L16_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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_2 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        xmlFree(__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_2; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L17:;
  }

  /* "src/lxml/serializer.pxi":190
 *     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;

  /* "src/lxml/serializer.pxi":153
 *     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_3);
  __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;
}

/* "src/lxml/serializer.pxi":192
 *     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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseSerialisationError", 1);

  /* "src/lxml/serializer.pxi":193
 * 
 * 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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":194
 * 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_ERR(10, 194, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":193
 * 
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 */
  }

  /* "src/lxml/serializer.pxi":195
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)             # <<<<<<<<<<<<<<
 *     if message is None:
 *         message = f"unknown error {error_result}"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_getName); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":196
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:             # <<<<<<<<<<<<<<
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message
 */
  __pyx_t_1 = (__pyx_v_message == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":197
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:
 *         message = f"unknown error {error_result}"             # <<<<<<<<<<<<<<
 *     raise SerialisationError, message
 * 
 */
    __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_error_result, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_unknown_error_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 197, __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;

    /* "src/lxml/serializer.pxi":196
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:             # <<<<<<<<<<<<<<
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message
 */
  }

  /* "src/lxml/serializer.pxi":198
 *     if message is None:
 *         message = f"unknown error {error_result}"
 *     raise SerialisationError, message             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_SerialisationError), __pyx_v_message, 0, 0);
  __PYX_ERR(10, 198, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":192
 *     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_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/serializer.pxi":203
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) noexcept 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) {

  /* "src/lxml/serializer.pxi":205
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,
 *                         const_xmlChar* c_doctype) noexcept nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),             # <<<<<<<<<<<<<<
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, xmlStrlen(__pyx_v_c_doctype), ((const char *)__pyx_v_c_doctype)));

  /* "src/lxml/serializer.pxi":207
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)"\n")));

  /* "src/lxml/serializer.pxi":203
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) noexcept nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 */

  /* function exit code */
}

/* "src/lxml/serializer.pxi":209
 *     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;
  xmlNode *__pyx_t_4;

  /* "src/lxml/serializer.pxi":216
 *                              int standalone) noexcept 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;

  /* "src/lxml/serializer.pxi":217
 *     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 (__pyx_v_write_xml_declaration) {
  } else {
    __pyx_t_2 = __pyx_v_write_xml_declaration;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":218
 *     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)             # <<<<<<<<<<<<<<
 * 
 *     # comments/processing instructions before doctype declaration
 */
    __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc->version, __pyx_v_encoding, __pyx_v_standalone);

    /* "src/lxml/serializer.pxi":217
 *     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)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":221
 * 
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 */
  if (__pyx_v_write_complete_document) {
  } else {
    __pyx_t_2 = __pyx_v_write_complete_document;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_doc->intSubset != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":222
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)             # <<<<<<<<<<<<<<
 * 
 *     if c_doctype:
 */
    __pyx_f_4lxml_5etree__writePrevSiblings(__pyx_v_c_buffer, ((xmlNode *)__pyx_v_c_doc->intSubset), __pyx_v_encoding, __pyx_v_pretty_print);

    /* "src/lxml/serializer.pxi":221
 * 
 *     # comments/processing instructions before doctype declaration
 *     if write_complete_document and not c_buffer.error and c_doc.intSubset:             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":224
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 *     if c_doctype:             # <<<<<<<<<<<<<<
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 */
  __pyx_t_2 = (__pyx_v_c_doctype != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":225
 * 
 *     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);

    /* "src/lxml/serializer.pxi":224
 *         _writePrevSiblings(c_buffer, <xmlNode*>c_doc.intSubset, encoding, pretty_print)
 * 
 *     if c_doctype:             # <<<<<<<<<<<<<<
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 */
  }

  /* "src/lxml/serializer.pxi":227
 *         _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, c_method, encoding)
 */
  if (__pyx_v_write_complete_document) {
  } else {
    __pyx_t_2 = __pyx_v_write_complete_document;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":228
 *     # 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, c_method, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    __pyx_t_2 = (__pyx_v_c_doctype == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":229
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, 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_c_method, __pyx_v_encoding);

      /* "src/lxml/serializer.pxi":228
 *     # 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, c_method, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    }

    /* "src/lxml/serializer.pxi":230
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, c_method, 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);

    /* "src/lxml/serializer.pxi":227
 *         _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, c_method, encoding)
 */
  }

  /* "src/lxml/serializer.pxi":232
 *         _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;

  /* "src/lxml/serializer.pxi":233
 * 
 *     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_3 = (!(__pyx_v_c_node->parent != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_c_node->parent->type != XML_DOCUMENT_NODE);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":236
 *         # 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);

    /* "src/lxml/serializer.pxi":237
 *         # 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_2 = (!(__pyx_v_c_nsdecl_node != 0));
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":238
 *         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;

      /* "src/lxml/serializer.pxi":239
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 */
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":237
 *         # 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
 */
    }

    /* "src/lxml/serializer.pxi":240
 *             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);

    /* "src/lxml/serializer.pxi":242
 *         _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_4 = __pyx_v_c_node->parent;
    __pyx_v_c_nsdecl_node->parent = __pyx_t_4;

    /* "src/lxml/serializer.pxi":243
 * 
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.last = c_node.last
 * 
 */
    __pyx_t_4 = __pyx_v_c_node->children;
    __pyx_v_c_nsdecl_node->children = __pyx_t_4;

    /* "src/lxml/serializer.pxi":244
 *         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_4 = __pyx_v_c_node->last;
    __pyx_v_c_nsdecl_node->last = __pyx_t_4;

    /* "src/lxml/serializer.pxi":233
 * 
 *     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
 */
  }

  /* "src/lxml/serializer.pxi":247
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 */
  __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":248
 *     # 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);

    /* "src/lxml/serializer.pxi":247
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 */
    goto __pyx_L19;
  }

  /* "src/lxml/serializer.pxi":251
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 *     else:
 *         tree.xmlNodeDumpOutput(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 */
  /*else*/ {

    /* "src/lxml/serializer.pxi":252
 *     else:
 *         tree.xmlNodeDumpOutput(
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)             # <<<<<<<<<<<<<<
 * 
 *     if c_nsdecl_node is not c_node:
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
  }
  __pyx_L19:;

  /* "src/lxml/serializer.pxi":254
 *             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_2 = (__pyx_v_c_nsdecl_node != __pyx_v_c_node);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":256
 *     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;

    /* "src/lxml/serializer.pxi":257
 *         # 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);

    /* "src/lxml/serializer.pxi":254
 *             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
 */
  }

  /* "src/lxml/serializer.pxi":259
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 *     if c_buffer.error:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (__pyx_v_c_buffer->error != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":260
 * 
 *     if c_buffer.error:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # write tail, trailing comments, etc.
 */
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":259
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 *     if c_buffer.error:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/serializer.pxi":263
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
 */
  if (__pyx_v_with_tail) {

    /* "src/lxml/serializer.pxi":264
 *     # 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);

    /* "src/lxml/serializer.pxi":263
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
 */
  }

  /* "src/lxml/serializer.pxi":265
 *     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:
 */
  if (__pyx_v_write_complete_document) {

    /* "src/lxml/serializer.pxi":266
 *         _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);

    /* "src/lxml/serializer.pxi":265
 *     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:
 */
  }

  /* "src/lxml/serializer.pxi":267
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 */
  if (__pyx_v_pretty_print) {

    /* "src/lxml/serializer.pxi":268
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, ((const char *)"\n")));

    /* "src/lxml/serializer.pxi":267
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 */
  }

  /* "src/lxml/serializer.pxi":209
 *     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:;
}

/* "src/lxml/serializer.pxi":270
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept 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;

  /* "src/lxml/serializer.pxi":273
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 */
  __pyx_t_1 = (__pyx_v_version == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":274
 *                                     int standalone) noexcept 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 *)((char const *)"1.0")));

    /* "src/lxml/serializer.pxi":273
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 */
  }

  /* "src/lxml/serializer.pxi":275
 *     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='")
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 15, ((const char *)"<?xml version='")));

  /* "src/lxml/serializer.pxi":276
 *         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)
 */
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_version)));

  /* "src/lxml/serializer.pxi":277
 *     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:
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 12, ((const char *)"' encoding='")));

  /* "src/lxml/serializer.pxi":278
 *     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")
 */
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_encoding));

  /* "src/lxml/serializer.pxi":279
 *     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:
 */
  switch (__pyx_v_standalone) {
    case 0:

    /* "src/lxml/serializer.pxi":280
 *     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")
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 20, ((const char *)"' standalone='no'?>\n")));

    /* "src/lxml/serializer.pxi":279
 *     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:
 */
    break;
    case 1:

    /* "src/lxml/serializer.pxi":282
 *         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")
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 21, ((const char *)"' standalone='yes'?>\n")));

    /* "src/lxml/serializer.pxi":281
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 */
    break;
    default:

    /* "src/lxml/serializer.pxi":284
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 4, ((const char *)"'?>\n")));
    break;
  }

  /* "src/lxml/serializer.pxi":270
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) noexcept nogil:
 */

  /* function exit code */
}

/* "src/lxml/serializer.pxi":286
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             int c_method, const_char* encoding) noexcept 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, int __pyx_v_c_method, const char *__pyx_v_encoding) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  char *__pyx_v_quotechar;
  const xmlChar *__pyx_v_public_id;
  const xmlChar *__pyx_v_sys_url;
  xmlBuffer *__pyx_v_c_buf;
  xmlDtd *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  const xmlChar *__pyx_t_4;
  xmlNode *__pyx_t_5;

  /* "src/lxml/serializer.pxi":292
 *     cdef xmlNode* c_node
 *     cdef char* quotechar
 *     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;

  /* "src/lxml/serializer.pxi":293
 *     cdef char* quotechar
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = (!(__pyx_v_c_dtd != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->name != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":294
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # Name in document type declaration must match the root element tag.
 */
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":293
 *     cdef char* quotechar
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/serializer.pxi":298
 *     # Name in document type declaration must match the root element tag.
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return
 */
  __pyx_t_2 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":299
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 *     else:
 */
    __pyx_t_2 = (xmlStrcasecmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":300
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return             # <<<<<<<<<<<<<<
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 */
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":299
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 *     else:
 */
    }

    /* "src/lxml/serializer.pxi":298
 *     # Name in document type declaration must match the root element tag.
 *     # For XML, case sensitive match, for HTML insensitive.
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrcasecmp(c_root_name, c_dtd.name) != 0:
 *             return
 */
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":302
 *             return
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  /*else*/ {
    __pyx_t_2 = (xmlStrcmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":303
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 *             return             # <<<<<<<<<<<<<<
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 */
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":302
 *             return
 *     else:
 *         if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    }
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":305
 *             return
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 * 
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 10, ((const char *)"<!DOCTYPE ")));

  /* "src/lxml/serializer.pxi":306
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)             # <<<<<<<<<<<<<<
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 */
  (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_c_dtd->name)));

  /* "src/lxml/serializer.pxi":308
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':
 */
  __pyx_t_4 = __pyx_v_c_dtd->ExternalID;
  __pyx_v_public_id = __pyx_t_4;

  /* "src/lxml/serializer.pxi":309
 * 
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID             # <<<<<<<<<<<<<<
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
 */
  __pyx_t_4 = __pyx_v_c_dtd->SystemID;
  __pyx_v_sys_url = __pyx_t_4;

  /* "src/lxml/serializer.pxi":310
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':             # <<<<<<<<<<<<<<
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
 */
  __pyx_t_3 = (__pyx_v_public_id != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_public_id[0]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":311
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL             # <<<<<<<<<<<<<<
 *     if sys_url and sys_url[0] == b'\0':
 *         sys_url = NULL
 */
    __pyx_v_public_id = NULL;

    /* "src/lxml/serializer.pxi":310
 *     cdef const_xmlChar* public_id = c_dtd.ExternalID
 *     cdef const_xmlChar* sys_url = c_dtd.SystemID
 *     if public_id and public_id[0] == b'\0':             # <<<<<<<<<<<<<<
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
 */
  }

  /* "src/lxml/serializer.pxi":312
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':             # <<<<<<<<<<<<<<
 *         sys_url = NULL
 * 
 */
  __pyx_t_3 = (__pyx_v_sys_url != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_sys_url[0]) == '\x00');
  __pyx_t_2 = __pyx_t_3;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":313
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':
 *         sys_url = NULL             # <<<<<<<<<<<<<<
 * 
 *     if public_id:
 */
    __pyx_v_sys_url = NULL;

    /* "src/lxml/serializer.pxi":312
 *     if public_id and public_id[0] == b'\0':
 *         public_id = NULL
 *     if sys_url and sys_url[0] == b'\0':             # <<<<<<<<<<<<<<
 *         sys_url = NULL
 * 
 */
  }

  /* "src/lxml/serializer.pxi":315
 *         sys_url = NULL
 * 
 *     if public_id:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 */
  __pyx_t_2 = (__pyx_v_public_id != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":316
 * 
 *     if public_id:
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 9, ((const char *)" PUBLIC \"")));

    /* "src/lxml/serializer.pxi":317
 *     if public_id:
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)             # <<<<<<<<<<<<<<
 *         if sys_url:
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 */
    (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_public_id)));

    /* "src/lxml/serializer.pxi":318
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
 */
    __pyx_t_2 = (__pyx_v_sys_url != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":319
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 */
      (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 2, ((const char *)"\" ")));

      /* "src/lxml/serializer.pxi":318
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 *         if sys_url:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
 */
      goto __pyx_L16;
    }

    /* "src/lxml/serializer.pxi":321
 *             tree.xmlOutputBufferWrite(c_buffer, 2, '" ')
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')             # <<<<<<<<<<<<<<
 *     elif sys_url:
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 */
    /*else*/ {
      (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, ((const char *)"\"")));
    }
    __pyx_L16:;

    /* "src/lxml/serializer.pxi":315
 *         sys_url = NULL
 * 
 *     if public_id:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>public_id)
 */
    goto __pyx_L15;
  }

  /* "src/lxml/serializer.pxi":322
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 */
  __pyx_t_2 = (__pyx_v_sys_url != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":323
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')             # <<<<<<<<<<<<<<
 * 
 *     if sys_url:
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 8, ((const char *)" SYSTEM ")));

    /* "src/lxml/serializer.pxi":322
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     elif sys_url:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 */
  }
  __pyx_L15:;

  /* "src/lxml/serializer.pxi":325
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 *     if sys_url:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''
 */
  __pyx_t_2 = (__pyx_v_sys_url != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":326
 * 
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):             # <<<<<<<<<<<<<<
 *             quotechar = '\''
 *         else:
 */
    __pyx_t_2 = (xmlStrchr(__pyx_v_sys_url, '"') != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":327
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''             # <<<<<<<<<<<<<<
 *         else:
 *             quotechar = '"'
 */
      __pyx_v_quotechar = ((char *)"'");

      /* "src/lxml/serializer.pxi":326
 * 
 *     if sys_url:
 *         if tree.xmlStrchr(sys_url, b'"'):             # <<<<<<<<<<<<<<
 *             quotechar = '\''
 *         else:
 */
      goto __pyx_L18;
    }

    /* "src/lxml/serializer.pxi":329
 *             quotechar = '\''
 *         else:
 *             quotechar = '"'             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
 */
    /*else*/ {
      __pyx_v_quotechar = ((char *)"\"");
    }
    __pyx_L18:;

    /* "src/lxml/serializer.pxi":330
 *         else:
 *             quotechar = '"'
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_v_quotechar));

    /* "src/lxml/serializer.pxi":331
 *             quotechar = '"'
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 */
    (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_sys_url)));

    /* "src/lxml/serializer.pxi":332
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>sys_url)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)             # <<<<<<<<<<<<<<
 * 
 *     if (not c_dtd.entities and not c_dtd.elements and
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_v_quotechar));

    /* "src/lxml/serializer.pxi":325
 *         tree.xmlOutputBufferWrite(c_buffer, 8, ' SYSTEM ')
 * 
 *     if sys_url:             # <<<<<<<<<<<<<<
 *         if tree.xmlStrchr(sys_url, b'"'):
 *             quotechar = '\''
 */
  }

  /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     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));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->elements != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":335
 * 
 *     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_3 = (!(__pyx_v_c_dtd->attributes != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_dtd->notations != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L20_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":336
 *     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_3 = (!(__pyx_v_c_dtd->pentities != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L20_bool_binop_done:;

  /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     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):
 */
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":337
 *            not c_dtd.attributes and not c_dtd.notations and
 *            not c_dtd.pentities):
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 2, ((const char *)">\n")));

    /* "src/lxml/serializer.pxi":338
 *            not c_dtd.pentities):
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return             # <<<<<<<<<<<<<<
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 */
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":334
 *         tree.xmlOutputBufferWrite(c_buffer, 1, quotechar)
 * 
 *     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):
 */
  }

  /* "src/lxml/serializer.pxi":340
 *         return
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')             # <<<<<<<<<<<<<<
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 3, ((const char *)" [\n")));

  /* "src/lxml/serializer.pxi":341
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
 */
  __pyx_t_3 = (__pyx_v_c_dtd->notations != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L26_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
  __pyx_t_2 = __pyx_t_3;
  __pyx_L26_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":342
 *     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();

    /* "src/lxml/serializer.pxi":343
 *     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_2 = (!(__pyx_v_c_buf != 0));
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":344
 *         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;

      /* "src/lxml/serializer.pxi":345
 *         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;

      /* "src/lxml/serializer.pxi":343
 *     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
 */
    }

    /* "src/lxml/serializer.pxi":346
 *             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));

    /* "src/lxml/serializer.pxi":347
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 *         tree.xmlOutputBufferWrite(             # <<<<<<<<<<<<<<
 *             c_buffer, tree.xmlBufferLength(c_buf),
 *             <const_char*>tree.xmlBufferContent(c_buf))
 */
    (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, xmlBufferLength(__pyx_v_c_buf), ((const char *)xmlBufferContent(__pyx_v_c_buf))));

    /* "src/lxml/serializer.pxi":350
 *             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);

    /* "src/lxml/serializer.pxi":341
 * 
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
 */
  }

  /* "src/lxml/serializer.pxi":351
 *             <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_5 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_5;

  /* "src/lxml/serializer.pxi":352
 *         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) {
    __pyx_t_3 = (__pyx_v_c_node != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
    __pyx_t_2 = __pyx_t_3;
    __pyx_L31_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/serializer.pxi":353
 *     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);

    /* "src/lxml/serializer.pxi":354
 *     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_5 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "src/lxml/serializer.pxi":355
 *         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,
 */
  (void)(xmlOutputBufferWrite(__pyx_v_c_buffer, 3, ((const char *)"]>\n")));

  /* "src/lxml/serializer.pxi":286
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             int c_method, const_char* encoding) noexcept nogil:
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":357
 *     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) noexcept nogil:
 *     "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;

  /* "src/lxml/serializer.pxi":360
 *                      const_char* encoding, int c_method, bint pretty_print) noexcept nogil:
 *     "Write the element tail."
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_node = __pyx_t_1;

  /* "src/lxml/serializer.pxi":361
 *     "Write the element tail."
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (             # <<<<<<<<<<<<<<
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (!(__pyx_v_c_buffer->error != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":362
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):             # <<<<<<<<<<<<<<
 *         if c_method == OUTPUT_METHOD_HTML:
 *             tree.htmlNodeDumpFormatOutput(
 */
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:
      case XML_CDATA_SECTION_NODE:

      /* "src/lxml/serializer.pxi":361
 *     "Write the element tail."
 *     c_node = c_node.next
 *     while c_node and not c_buffer.error and c_node.type in (             # <<<<<<<<<<<<<<
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:
 */
      __pyx_t_3 = 1;
      break;
      default:
      __pyx_t_3 = 0;
      break;
    }
    __pyx_t_4 = __pyx_t_3;
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_2) break;

    /* "src/lxml/serializer.pxi":363
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         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);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":364
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         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);

      /* "src/lxml/serializer.pxi":363
 *     while c_node and not c_buffer.error and c_node.type in (
 *             tree.XML_TEXT_NODE, tree.XML_CDATA_SECTION_NODE):
 *         if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *             tree.htmlNodeDumpFormatOutput(
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 */
      goto __pyx_L8;
    }

    /* "src/lxml/serializer.pxi":367
 *                 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
 */
    /*else*/ {

      /* "src/lxml/serializer.pxi":368
 *         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_L8:;

    /* "src/lxml/serializer.pxi":369
 *             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;
  }

  /* "src/lxml/serializer.pxi":357
 *     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) noexcept nogil:
 *     "Write the element tail."
 */

  /* function exit code */
}

/* "src/lxml/serializer.pxi":371
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept 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;

  /* "src/lxml/serializer.pxi":374
 *                              const_char* encoding, bint pretty_print) noexcept 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
 */
  __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":375
 *     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;

    /* "src/lxml/serializer.pxi":374
 *                              const_char* encoding, bint pretty_print) noexcept 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
 */
  }

  /* "src/lxml/serializer.pxi":377
 *         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;

  /* "src/lxml/serializer.pxi":378
 *     # 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) {
    __pyx_t_2 = (__pyx_v_c_sibling->prev != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":379
 *     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:
      case XML_COMMENT_NODE:

      /* "src/lxml/serializer.pxi":380
 *     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:
 */
      __pyx_t_2 = 1;

      /* "src/lxml/serializer.pxi":379
 *     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
 */
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":381
 *             (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;
  }

  /* "src/lxml/serializer.pxi":382
 *              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_2 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_2 = (!(__pyx_v_c_buffer->error != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L12_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":383
 *         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);

    /* "src/lxml/serializer.pxi":385
 *         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
 */
    if (__pyx_v_pretty_print) {

      /* "src/lxml/serializer.pxi":386
 *                                pretty_print, encoding)
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 * 
 */
      (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)"\n")));

      /* "src/lxml/serializer.pxi":385
 *         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
 */
    }

    /* "src/lxml/serializer.pxi":387
 *         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;
  }

  /* "src/lxml/serializer.pxi":371
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":389
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept 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;

  /* "src/lxml/serializer.pxi":392
 *                              const_char* encoding, bint pretty_print) noexcept 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
 */
  __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":393
 *     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;

    /* "src/lxml/serializer.pxi":392
 *                              const_char* encoding, bint pretty_print) noexcept 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
 */
  }

  /* "src/lxml/serializer.pxi":395
 *         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;

  /* "src/lxml/serializer.pxi":396
 *     # 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));
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_sibling != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }

    /* "src/lxml/serializer.pxi":397
 *     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:
      case XML_COMMENT_NODE:

      /* "src/lxml/serializer.pxi":398
 *     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")
 */
      __pyx_t_2 = 1;

      /* "src/lxml/serializer.pxi":397
 *     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:
 */
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":399
 *             (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,
 */
    if (__pyx_v_pretty_print) {

      /* "src/lxml/serializer.pxi":400
 *              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)
 */
      (void)(xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)"\n")));

      /* "src/lxml/serializer.pxi":399
 *             (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,
 */
    }

    /* "src/lxml/serializer.pxi":401
 *         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);

    /* "src/lxml/serializer.pxi":403
 *         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;
  }

  /* "src/lxml/serializer.pxi":389
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) noexcept nogil:
 *     cdef xmlNode* c_sibling
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/serializer.pxi":407
 * 
 * # copied and adapted from libxml2
 * cdef unsigned char *xmlSerializeHexCharRef(unsigned char *out, int val) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlChar *ptr
 *     cdef const xmlChar* hexdigits = b"0123456789ABCDEF"
 */

static unsigned char *__pyx_f_4lxml_5etree_xmlSerializeHexCharRef(unsigned char *__pyx_v_out, int __pyx_v_val) {
  xmlChar *__pyx_v_ptr;
  xmlChar const *__pyx_v_hexdigits;
  unsigned char *__pyx_r;
  int __pyx_t_1;

  /* "src/lxml/serializer.pxi":409
 * cdef unsigned char *xmlSerializeHexCharRef(unsigned char *out, int val) noexcept:
 *     cdef xmlChar *ptr
 *     cdef const xmlChar* hexdigits = b"0123456789ABCDEF"             # <<<<<<<<<<<<<<
 * 
 *     out[0] = b'&'
 */
  __pyx_v_hexdigits = ((xmlChar const *)((char const *)"0123456789ABCDEF"));

  /* "src/lxml/serializer.pxi":411
 *     cdef const xmlChar* hexdigits = b"0123456789ABCDEF"
 * 
 *     out[0] = b'&'             # <<<<<<<<<<<<<<
 *     out += 1
 *     out[0] = b'#'
 */
  (__pyx_v_out[0]) = '&';

  /* "src/lxml/serializer.pxi":412
 * 
 *     out[0] = b'&'
 *     out += 1             # <<<<<<<<<<<<<<
 *     out[0] = b'#'
 *     out += 1
 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "src/lxml/serializer.pxi":413
 *     out[0] = b'&'
 *     out += 1
 *     out[0] = b'#'             # <<<<<<<<<<<<<<
 *     out += 1
 *     out[0] = b'x'
 */
  (__pyx_v_out[0]) = '#';

  /* "src/lxml/serializer.pxi":414
 *     out += 1
 *     out[0] = b'#'
 *     out += 1             # <<<<<<<<<<<<<<
 *     out[0] = b'x'
 *     out += 1
 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "src/lxml/serializer.pxi":415
 *     out[0] = b'#'
 *     out += 1
 *     out[0] = b'x'             # <<<<<<<<<<<<<<
 *     out += 1
 * 
 */
  (__pyx_v_out[0]) = 'x';

  /* "src/lxml/serializer.pxi":416
 *     out += 1
 *     out[0] = b'x'
 *     out += 1             # <<<<<<<<<<<<<<
 * 
 *     if val < 0x10:
 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "src/lxml/serializer.pxi":418
 *     out += 1
 * 
 *     if val < 0x10:             # <<<<<<<<<<<<<<
 *         ptr = out
 *     elif val < 0x100:
 */
  __pyx_t_1 = (__pyx_v_val < 0x10);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":419
 * 
 *     if val < 0x10:
 *         ptr = out             # <<<<<<<<<<<<<<
 *     elif val < 0x100:
 *         ptr = out + 1
 */
    __pyx_v_ptr = __pyx_v_out;

    /* "src/lxml/serializer.pxi":418
 *     out += 1
 * 
 *     if val < 0x10:             # <<<<<<<<<<<<<<
 *         ptr = out
 *     elif val < 0x100:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":420
 *     if val < 0x10:
 *         ptr = out
 *     elif val < 0x100:             # <<<<<<<<<<<<<<
 *         ptr = out + 1
 *     elif val < 0x1000:
 */
  __pyx_t_1 = (__pyx_v_val < 0x100);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":421
 *         ptr = out
 *     elif val < 0x100:
 *         ptr = out + 1             # <<<<<<<<<<<<<<
 *     elif val < 0x1000:
 *         ptr = out + 2
 */
    __pyx_v_ptr = (__pyx_v_out + 1);

    /* "src/lxml/serializer.pxi":420
 *     if val < 0x10:
 *         ptr = out
 *     elif val < 0x100:             # <<<<<<<<<<<<<<
 *         ptr = out + 1
 *     elif val < 0x1000:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":422
 *     elif val < 0x100:
 *         ptr = out + 1
 *     elif val < 0x1000:             # <<<<<<<<<<<<<<
 *         ptr = out + 2
 *     elif val < 0x10000:
 */
  __pyx_t_1 = (__pyx_v_val < 0x1000);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":423
 *         ptr = out + 1
 *     elif val < 0x1000:
 *         ptr = out + 2             # <<<<<<<<<<<<<<
 *     elif val < 0x10000:
 *         ptr = out + 3
 */
    __pyx_v_ptr = (__pyx_v_out + 2);

    /* "src/lxml/serializer.pxi":422
 *     elif val < 0x100:
 *         ptr = out + 1
 *     elif val < 0x1000:             # <<<<<<<<<<<<<<
 *         ptr = out + 2
 *     elif val < 0x10000:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":424
 *     elif val < 0x1000:
 *         ptr = out + 2
 *     elif val < 0x10000:             # <<<<<<<<<<<<<<
 *         ptr = out + 3
 *     elif val < 0x100000:
 */
  __pyx_t_1 = (__pyx_v_val < 0x10000);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":425
 *         ptr = out + 2
 *     elif val < 0x10000:
 *         ptr = out + 3             # <<<<<<<<<<<<<<
 *     elif val < 0x100000:
 *         ptr = out + 4
 */
    __pyx_v_ptr = (__pyx_v_out + 3);

    /* "src/lxml/serializer.pxi":424
 *     elif val < 0x1000:
 *         ptr = out + 2
 *     elif val < 0x10000:             # <<<<<<<<<<<<<<
 *         ptr = out + 3
 *     elif val < 0x100000:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":426
 *     elif val < 0x10000:
 *         ptr = out + 3
 *     elif val < 0x100000:             # <<<<<<<<<<<<<<
 *         ptr = out + 4
 *     else:
 */
  __pyx_t_1 = (__pyx_v_val < 0x100000);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":427
 *         ptr = out + 3
 *     elif val < 0x100000:
 *         ptr = out + 4             # <<<<<<<<<<<<<<
 *     else:
 *         ptr = out + 5
 */
    __pyx_v_ptr = (__pyx_v_out + 4);

    /* "src/lxml/serializer.pxi":426
 *     elif val < 0x10000:
 *         ptr = out + 3
 *     elif val < 0x100000:             # <<<<<<<<<<<<<<
 *         ptr = out + 4
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":429
 *         ptr = out + 4
 *     else:
 *         ptr = out + 5             # <<<<<<<<<<<<<<
 * 
 *     out = ptr + 1
 */
  /*else*/ {
    __pyx_v_ptr = (__pyx_v_out + 5);
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":431
 *         ptr = out + 5
 * 
 *     out = ptr + 1             # <<<<<<<<<<<<<<
 *     while val > 0:
 *         ptr[0] = hexdigits[val & 0xF]
 */
  __pyx_v_out = (__pyx_v_ptr + 1);

  /* "src/lxml/serializer.pxi":432
 * 
 *     out = ptr + 1
 *     while val > 0:             # <<<<<<<<<<<<<<
 *         ptr[0] = hexdigits[val & 0xF]
 *         ptr -= 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_val > 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":433
 *     out = ptr + 1
 *     while val > 0:
 *         ptr[0] = hexdigits[val & 0xF]             # <<<<<<<<<<<<<<
 *         ptr -= 1
 *         val >>= 4
 */
    (__pyx_v_ptr[0]) = (__pyx_v_hexdigits[(__pyx_v_val & 0xF)]);

    /* "src/lxml/serializer.pxi":434
 *     while val > 0:
 *         ptr[0] = hexdigits[val & 0xF]
 *         ptr -= 1             # <<<<<<<<<<<<<<
 *         val >>= 4
 * 
 */
    __pyx_v_ptr = (__pyx_v_ptr - 1);

    /* "src/lxml/serializer.pxi":435
 *         ptr[0] = hexdigits[val & 0xF]
 *         ptr -= 1
 *         val >>= 4             # <<<<<<<<<<<<<<
 * 
 *     out[0] = b';'
 */
    __pyx_v_val = (__pyx_v_val >> 4);
  }

  /* "src/lxml/serializer.pxi":437
 *         val >>= 4
 * 
 *     out[0] = b';'             # <<<<<<<<<<<<<<
 *     out += 1
 *     out[0] = 0
 */
  (__pyx_v_out[0]) = ';';

  /* "src/lxml/serializer.pxi":438
 * 
 *     out[0] = b';'
 *     out += 1             # <<<<<<<<<<<<<<
 *     out[0] = 0
 * 
 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "src/lxml/serializer.pxi":439
 *     out[0] = b';'
 *     out += 1
 *     out[0] = 0             # <<<<<<<<<<<<<<
 * 
 *     return out
 */
  (__pyx_v_out[0]) = 0;

  /* "src/lxml/serializer.pxi":441
 *     out[0] = 0
 * 
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":407
 * 
 * # copied and adapted from libxml2
 * cdef unsigned char *xmlSerializeHexCharRef(unsigned char *out, int val) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlChar *ptr
 *     cdef const xmlChar* hexdigits = b"0123456789ABCDEF"
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":445
 * 
 * # copied and adapted from libxml2 (xmlBufAttrSerializeTxtContent())
 * cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string):             # <<<<<<<<<<<<<<
 *     cdef const char *base
 *     cdef const char *cur
 */

static PyObject *__pyx_f_4lxml_5etree__write_attr_string(xmlOutputBuffer *__pyx_v_buf, char const *__pyx_v_string) {
  char const *__pyx_v_base;
  char const *__pyx_v_cur;
  unsigned char const *__pyx_v_ucur;
  unsigned char __pyx_v_tmp[12];
  int __pyx_v_val;
  int __pyx_v_l;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_attr_string", 1);

  /* "src/lxml/serializer.pxi":451
 * 
 *     cdef unsigned char tmp[12]
 *     cdef int val = 0             # <<<<<<<<<<<<<<
 *     cdef int l
 * 
 */
  __pyx_v_val = 0;

  /* "src/lxml/serializer.pxi":454
 *     cdef int l
 * 
 *     if string == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = (__pyx_v_string == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":455
 * 
 *     if string == NULL:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     base = cur = <const char*>string
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":454
 *     cdef int l
 * 
 *     if string == NULL:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/serializer.pxi":457
 *         return
 * 
 *     base = cur = <const char*>string             # <<<<<<<<<<<<<<
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
 */
  __pyx_v_base = ((char const *)__pyx_v_string);
  __pyx_v_cur = ((char const *)__pyx_v_string);

  /* "src/lxml/serializer.pxi":458
 * 
 *     base = cur = <const char*>string
 *     while cur[0] != 0:             # <<<<<<<<<<<<<<
 *         if cur[0] == b'\n':
 *             if base != cur:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_cur[0]) != 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/serializer.pxi":459
 *     base = cur = <const char*>string
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\n');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":460
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":461
 *         if cur[0] == b'\n':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":460
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":463
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, ((const char *)"&#10;")));

      /* "src/lxml/serializer.pxi":464
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":465
 *             tree.xmlOutputBufferWrite(buf, 5, "&#10;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'\r':
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":459
 *     base = cur = <const char*>string
 *     while cur[0] != 0:
 *         if cur[0] == b'\n':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":467
 *             base = cur
 * 
 *         elif cur[0] == b'\r':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\r');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":468
 * 
 *         elif cur[0] == b'\r':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":469
 *         elif cur[0] == b'\r':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":468
 * 
 *         elif cur[0] == b'\r':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":471
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, ((const char *)"&#13;")));

      /* "src/lxml/serializer.pxi":472
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":473
 *             tree.xmlOutputBufferWrite(buf, 5, "&#13;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'\t':
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":467
 *             base = cur
 * 
 *         elif cur[0] == b'\r':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":475
 *             base = cur
 * 
 *         elif cur[0] == b'\t':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '\t');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":476
 * 
 *         elif cur[0] == b'\t':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":477
 *         elif cur[0] == b'\t':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":476
 * 
 *         elif cur[0] == b'\t':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":479
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, ((const char *)"&#9;")));

      /* "src/lxml/serializer.pxi":480
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":481
 *             tree.xmlOutputBufferWrite(buf, 4, "&#9;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'"':
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":475
 *             base = cur
 * 
 *         elif cur[0] == b'\t':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":483
 *             base = cur
 * 
 *         elif cur[0] == b'"':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '"');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":484
 * 
 *         elif cur[0] == b'"':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":485
 *         elif cur[0] == b'"':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":484
 * 
 *         elif cur[0] == b'"':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":487
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 6, ((const char *)"&quot;")));

      /* "src/lxml/serializer.pxi":488
 * 
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":489
 *             tree.xmlOutputBufferWrite(buf, 6, "&quot;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'<':
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":483
 *             base = cur
 * 
 *         elif cur[0] == b'"':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":491
 *             base = cur
 * 
 *         elif cur[0] == b'<':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '<');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":492
 * 
 *         elif cur[0] == b'<':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":493
 *         elif cur[0] == b'<':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":492
 * 
 *         elif cur[0] == b'<':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":495
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, ((const char *)"&lt;")));

      /* "src/lxml/serializer.pxi":496
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":497
 *             tree.xmlOutputBufferWrite(buf, 4, "&lt;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif cur[0] == b'>':
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":491
 *             base = cur
 * 
 *         elif cur[0] == b'<':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":499
 *             base = cur
 * 
 *         elif cur[0] == b'>':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '>');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":500
 * 
 *         elif cur[0] == b'>':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":501
 *         elif cur[0] == b'>':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":500
 * 
 *         elif cur[0] == b'>':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":503
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 4, ((const char *)"&gt;")));

      /* "src/lxml/serializer.pxi":504
 * 
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 *         elif cur[0] == b'&':
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":505
 *             tree.xmlOutputBufferWrite(buf, 4, "&gt;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 *         elif cur[0] == b'&':
 *             if base != cur:
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":499
 *             base = cur
 * 
 *         elif cur[0] == b'>':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":506
 *             cur += 1
 *             base = cur
 *         elif cur[0] == b'&':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
    __pyx_t_1 = ((__pyx_v_cur[0]) == '&');
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":507
 *             base = cur
 *         elif cur[0] == b'&':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":508
 *         elif cur[0] == b'&':
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":507
 *             base = cur
 *         elif cur[0] == b'&':
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":510
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")             # <<<<<<<<<<<<<<
 *             cur += 1
 *             base = cur
 */
      (void)(xmlOutputBufferWrite(__pyx_v_buf, 5, ((const char *)"&amp;")));

      /* "src/lxml/serializer.pxi":511
 * 
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
 *             cur += 1             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + 1);

      /* "src/lxml/serializer.pxi":512
 *             tree.xmlOutputBufferWrite(buf, 5, "&amp;")
 *             cur += 1
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         elif (<const unsigned char>cur[0] >= 0x80) and (cur[1] != 0):
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":506
 *             cur += 1
 *             base = cur
 *         elif cur[0] == b'&':             # <<<<<<<<<<<<<<
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":514
 *             base = cur
 * 
 *         elif (<const unsigned char>cur[0] >= 0x80) and (cur[1] != 0):             # <<<<<<<<<<<<<<
 * 
 *             if base != cur:
 */
    __pyx_t_2 = (((unsigned char const )(__pyx_v_cur[0])) >= 0x80);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_cur[1]) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":516
 *         elif (<const unsigned char>cur[0] >= 0x80) and (cur[1] != 0):
 * 
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":517
 * 
 *             if base != cur:
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 *             ucur = <const unsigned char *>cur
 */
        (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

        /* "src/lxml/serializer.pxi":516
 *         elif (<const unsigned char>cur[0] >= 0x80) and (cur[1] != 0):
 * 
 *             if base != cur:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
      }

      /* "src/lxml/serializer.pxi":519
 *                 tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 *             ucur = <const unsigned char *>cur             # <<<<<<<<<<<<<<
 * 
 *             if ucur[0] < 0xC0:
 */
      __pyx_v_ucur = ((unsigned char const *)__pyx_v_cur);

      /* "src/lxml/serializer.pxi":521
 *             ucur = <const unsigned char *>cur
 * 
 *             if ucur[0] < 0xC0:             # <<<<<<<<<<<<<<
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]
 */
      __pyx_t_1 = ((__pyx_v_ucur[0]) < 0xC0);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":523
 *             if ucur[0] < 0xC0:
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]             # <<<<<<<<<<<<<<
 *                 l = 1
 * 
 */
        __pyx_v_val = (__pyx_v_ucur[0]);

        /* "src/lxml/serializer.pxi":524
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]
 *                 l = 1             # <<<<<<<<<<<<<<
 * 
 *             elif ucur[0] < 0xE0:
 */
        __pyx_v_l = 1;

        /* "src/lxml/serializer.pxi":521
 *             ucur = <const unsigned char *>cur
 * 
 *             if ucur[0] < 0xC0:             # <<<<<<<<<<<<<<
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]
 */
        goto __pyx_L17;
      }

      /* "src/lxml/serializer.pxi":526
 *                 l = 1
 * 
 *             elif ucur[0] < 0xE0:             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x1F
 *                 val <<= 6
 */
      __pyx_t_1 = ((__pyx_v_ucur[0]) < 0xE0);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":527
 * 
 *             elif ucur[0] < 0xE0:
 *                 val = (ucur[0]) & 0x1F             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 */
        __pyx_v_val = ((__pyx_v_ucur[0]) & 0x1F);

        /* "src/lxml/serializer.pxi":528
 *             elif ucur[0] < 0xE0:
 *                 val = (ucur[0]) & 0x1F
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[1]) & 0x3F
 *                 l = 2
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":529
 *                 val = (ucur[0]) & 0x1F
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F             # <<<<<<<<<<<<<<
 *                 l = 2
 * 
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[1]) & 0x3F));

        /* "src/lxml/serializer.pxi":530
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 *                 l = 2             # <<<<<<<<<<<<<<
 * 
 *             elif (ucur[0] < 0xF0) and (ucur[2] != 0):
 */
        __pyx_v_l = 2;

        /* "src/lxml/serializer.pxi":526
 *                 l = 1
 * 
 *             elif ucur[0] < 0xE0:             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x1F
 *                 val <<= 6
 */
        goto __pyx_L17;
      }

      /* "src/lxml/serializer.pxi":532
 *                 l = 2
 * 
 *             elif (ucur[0] < 0xF0) and (ucur[2] != 0):             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x0F
 *                 val <<= 6
 */
      __pyx_t_2 = ((__pyx_v_ucur[0]) < 0xF0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_2 = ((__pyx_v_ucur[2]) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L18_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":533
 * 
 *             elif (ucur[0] < 0xF0) and (ucur[2] != 0):
 *                 val = (ucur[0]) & 0x0F             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 */
        __pyx_v_val = ((__pyx_v_ucur[0]) & 0x0F);

        /* "src/lxml/serializer.pxi":534
 *             elif (ucur[0] < 0xF0) and (ucur[2] != 0):
 *                 val = (ucur[0]) & 0x0F
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":535
 *                 val = (ucur[0]) & 0x0F
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[1]) & 0x3F));

        /* "src/lxml/serializer.pxi":536
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[2]) & 0x3F
 *                 l = 3
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":537
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F             # <<<<<<<<<<<<<<
 *                 l = 3
 * 
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[2]) & 0x3F));

        /* "src/lxml/serializer.pxi":538
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F
 *                 l = 3             # <<<<<<<<<<<<<<
 * 
 *             elif (ucur[0] < 0xF8) and (ucur[2] != 0) and (ucur[3] != 0):
 */
        __pyx_v_l = 3;

        /* "src/lxml/serializer.pxi":532
 *                 l = 2
 * 
 *             elif (ucur[0] < 0xF0) and (ucur[2] != 0):             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x0F
 *                 val <<= 6
 */
        goto __pyx_L17;
      }

      /* "src/lxml/serializer.pxi":540
 *                 l = 3
 * 
 *             elif (ucur[0] < 0xF8) and (ucur[2] != 0) and (ucur[3] != 0):             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x07
 *                 val <<= 6
 */
      __pyx_t_2 = ((__pyx_v_ucur[0]) < 0xF8);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_2 = ((__pyx_v_ucur[2]) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_2 = ((__pyx_v_ucur[3]) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L20_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":541
 * 
 *             elif (ucur[0] < 0xF8) and (ucur[2] != 0) and (ucur[3] != 0):
 *                 val = (ucur[0]) & 0x07             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 */
        __pyx_v_val = ((__pyx_v_ucur[0]) & 0x07);

        /* "src/lxml/serializer.pxi":542
 *             elif (ucur[0] < 0xF8) and (ucur[2] != 0) and (ucur[3] != 0):
 *                 val = (ucur[0]) & 0x07
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":543
 *                 val = (ucur[0]) & 0x07
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[1]) & 0x3F));

        /* "src/lxml/serializer.pxi":544
 *                 val <<= 6
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[2]) & 0x3F
 *                 val <<= 6
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":545
 *                 val |= (ucur[1]) & 0x3F
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F             # <<<<<<<<<<<<<<
 *                 val <<= 6
 *                 val |= (ucur[3]) & 0x3F
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[2]) & 0x3F));

        /* "src/lxml/serializer.pxi":546
 *                 val <<= 6
 *                 val |= (ucur[2]) & 0x3F
 *                 val <<= 6             # <<<<<<<<<<<<<<
 *                 val |= (ucur[3]) & 0x3F
 *                 l = 4
 */
        __pyx_v_val = (__pyx_v_val << 6);

        /* "src/lxml/serializer.pxi":547
 *                 val |= (ucur[2]) & 0x3F
 *                 val <<= 6
 *                 val |= (ucur[3]) & 0x3F             # <<<<<<<<<<<<<<
 *                 l = 4
 *             else:
 */
        __pyx_v_val = (__pyx_v_val | ((__pyx_v_ucur[3]) & 0x3F));

        /* "src/lxml/serializer.pxi":548
 *                 val <<= 6
 *                 val |= (ucur[3]) & 0x3F
 *                 l = 4             # <<<<<<<<<<<<<<
 *             else:
 *                 # invalid UTF-8 sequence
 */
        __pyx_v_l = 4;

        /* "src/lxml/serializer.pxi":540
 *                 l = 3
 * 
 *             elif (ucur[0] < 0xF8) and (ucur[2] != 0) and (ucur[3] != 0):             # <<<<<<<<<<<<<<
 *                 val = (ucur[0]) & 0x07
 *                 val <<= 6
 */
        goto __pyx_L17;
      }

      /* "src/lxml/serializer.pxi":551
 *             else:
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]             # <<<<<<<<<<<<<<
 *                 l = 1
 * 
 */
      /*else*/ {
        __pyx_v_val = (__pyx_v_ucur[0]);

        /* "src/lxml/serializer.pxi":552
 *                 # invalid UTF-8 sequence
 *                 val = ucur[0]
 *                 l = 1             # <<<<<<<<<<<<<<
 * 
 *             if (l == 1) or (not tree.xmlIsCharQ(val)):
 */
        __pyx_v_l = 1;
      }
      __pyx_L17:;

      /* "src/lxml/serializer.pxi":554
 *                 l = 1
 * 
 *             if (l == 1) or (not tree.xmlIsCharQ(val)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid character: {val:X}")
 * 
 */
      __pyx_t_2 = (__pyx_v_l == 1);
      if (!__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_2 = (!(xmlIsCharQ(__pyx_v_val) != 0));
      __pyx_t_1 = __pyx_t_2;
      __pyx_L24_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/serializer.pxi":555
 * 
 *             if (l == 1) or (not tree.xmlIsCharQ(val)):
 *                 raise ValueError(f"Invalid character: {val:X}")             # <<<<<<<<<<<<<<
 * 
 *             # We could do multiple things here. Just save
 */
        __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_val, 0, ' ', 'X'); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_character, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(10, 555, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":554
 *                 l = 1
 * 
 *             if (l == 1) or (not tree.xmlIsCharQ(val)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Invalid character: {val:X}")
 * 
 */
      }

      /* "src/lxml/serializer.pxi":559
 *             # We could do multiple things here. Just save
 *             # as a char ref
 *             xmlSerializeHexCharRef(tmp, val)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(buf, len(tmp), <const char*> tmp)
 *             cur += l
 */
      (void)(__pyx_f_4lxml_5etree_xmlSerializeHexCharRef(__pyx_v_tmp, __pyx_v_val));

      /* "src/lxml/serializer.pxi":560
 *             # as a char ref
 *             xmlSerializeHexCharRef(tmp, val)
 *             tree.xmlOutputBufferWrite(buf, len(tmp), <const char*> tmp)             # <<<<<<<<<<<<<<
 *             cur += l
 *             base = cur
 */
      __pyx_t_5 = __Pyx_ssize_strlen(((char const *)__pyx_v_tmp)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(10, 560, __pyx_L1_error)
      (void)(xmlOutputBufferWrite(__pyx_v_buf, __pyx_t_5, ((char const *)__pyx_v_tmp)));

      /* "src/lxml/serializer.pxi":561
 *             xmlSerializeHexCharRef(tmp, val)
 *             tree.xmlOutputBufferWrite(buf, len(tmp), <const char*> tmp)
 *             cur += l             # <<<<<<<<<<<<<<
 *             base = cur
 * 
 */
      __pyx_v_cur = (__pyx_v_cur + __pyx_v_l);

      /* "src/lxml/serializer.pxi":562
 *             tree.xmlOutputBufferWrite(buf, len(tmp), <const char*> tmp)
 *             cur += l
 *             base = cur             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_v_base = __pyx_v_cur;

      /* "src/lxml/serializer.pxi":514
 *             base = cur
 * 
 *         elif (<const unsigned char>cur[0] >= 0x80) and (cur[1] != 0):             # <<<<<<<<<<<<<<
 * 
 *             if base != cur:
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":565
 * 
 *         else:
 *             cur += 1             # <<<<<<<<<<<<<<
 * 
 *     if base != cur:
 */
    /*else*/ {
      __pyx_v_cur = (__pyx_v_cur + 1);
    }
    __pyx_L6:;
  }

  /* "src/lxml/serializer.pxi":567
 *             cur += 1
 * 
 *     if base != cur:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
  __pyx_t_1 = (__pyx_v_base != __pyx_v_cur);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":568
 * 
 *     if base != cur:
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)(xmlOutputBufferWrite(__pyx_v_buf, (__pyx_v_cur - __pyx_v_base), __pyx_v_base));

    /* "src/lxml/serializer.pxi":567
 *             cur += 1
 * 
 *     if base != cur:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(buf, cur - base, base)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":445
 * 
 * # copied and adapted from libxml2 (xmlBufAttrSerializeTxtContent())
 * cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string):             # <<<<<<<<<<<<<<
 *     cdef const char *base
 *     cdef const char *cur
 */

  /* 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._write_attr_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_52generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":589
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_51_open_utf8_file(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_51_open_utf8_file = {"_open_utf8_file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_51_open_utf8_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_51_open_utf8_file(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_compression = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_open_utf8_file (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_compression,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0)));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 589, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compression);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 589, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_open_utf8_file") < 0)) __PYX_ERR(10, 589, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_file = values[0];
    __pyx_v_compression = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_open_utf8_file", 0, 1, 2, __pyx_nargs); __PYX_ERR(10, 589, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_50_open_utf8_file(__pyx_self, __pyx_v_file, __pyx_v_compression);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_50_open_utf8_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_open_utf8_file", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file(__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 589, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_file = __pyx_v_file;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file);
  __pyx_cur_scope->__pyx_v_compression = __pyx_v_compression;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_compression);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_compression);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_52generator, __pyx_codeobj__62, (PyObject *) __pyx_cur_scope, __pyx_n_s_open_utf8_file, __pyx_n_s_open_utf8_file, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

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

static PyObject *__pyx_gb_4lxml_5etree_52generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_open_utf8_file", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L16_resume_from_yield;
    case 2: goto __pyx_L31_resume_from_yield;
    case 3: goto __pyx_L47_resume_from_yield;
    case 4: goto __pyx_L52_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 589, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":591
 * @contextmanager
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *     if _isString(file):
 *         if compression:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_cur_scope->__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_file);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_file, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":592
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):             # <<<<<<<<<<<<<<
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 */
  __pyx_t_2 = _isString(__pyx_cur_scope->__pyx_v_file);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":593
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_compression); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 593, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":594
 *     if _isString(file):
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
 */
      /*with:*/ {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_gzip, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_file)) __PYX_ERR(10, 594, __pyx_L1_error);
        __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(10, 594, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_compresslevel, __pyx_cur_scope->__pyx_v_compression) < 0) __PYX_ERR(10, 594, __pyx_L1_error)
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 594, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 594, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 594, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_t_3 = __pyx_t_4;
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_cur_scope->__pyx_v_zf = __pyx_t_3;
              __pyx_t_3 = 0;

              /* "src/lxml/serializer.pxi":595
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)             # <<<<<<<<<<<<<<
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:
 */
              __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
              __pyx_t_5 = __pyx_v_4lxml_5etree_utf8_writer; __pyx_t_4 = NULL;
              __pyx_t_7 = 0;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_5))) {
                __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
                if (likely(__pyx_t_4)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                  __Pyx_INCREF(__pyx_t_4);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_5, function);
                  __pyx_t_7 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_zf};
                __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
                __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 595, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              }
              __pyx_r = __pyx_t_3;
              __pyx_t_3 = 0;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 1;
              return __pyx_r;
              __pyx_L16_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 595, __pyx_L10_error)

              /* "src/lxml/serializer.pxi":594
 *     if _isString(file):
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
 */
            }
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L15_try_end;
            __pyx_L10_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(10, 594, __pyx_L12_except_error)
              __Pyx_XGOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_4);
              __pyx_t_1 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 594, __pyx_L12_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 594, __pyx_L12_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_2 < 0) __PYX_ERR(10, 594, __pyx_L12_except_error)
              __pyx_t_12 = (!__pyx_t_2);
              if (unlikely(__pyx_t_12)) {
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_XGIVEREF(__pyx_t_4);
                __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4);
                __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; 
                __PYX_ERR(10, 594, __pyx_L12_except_error)
              }
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              goto __pyx_L11_exception_handled;
            }
            __pyx_L12_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L11_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            __pyx_L15_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 594, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
        goto __pyx_L20;
        __pyx_L6_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L20:;
      }

      /* "src/lxml/serializer.pxi":593
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
 */
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":597
 *                 yield utf8_writer(zf)
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:             # <<<<<<<<<<<<<<
 *                 yield f
 *     else:
 */
    /*else*/ {
      /*with:*/ {
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_file)) __PYX_ERR(10, 597, __pyx_L1_error);
        __Pyx_INCREF(__pyx_n_u_w);
        __Pyx_GIVEREF(__pyx_n_u_w);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_w)) __PYX_ERR(10, 597, __pyx_L1_error);
        __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_encoding, __pyx_n_u_utf8) < 0) __PYX_ERR(10, 597, __pyx_L1_error)
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_io_open, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 597, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
          __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 597, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_t_4 = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        /*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:*/ {
              __Pyx_GIVEREF(__pyx_t_4);
              __pyx_cur_scope->__pyx_v_f = __pyx_t_4;
              __pyx_t_4 = 0;

              /* "src/lxml/serializer.pxi":598
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:
 *                 yield f             # <<<<<<<<<<<<<<
 *     else:
 *         if compression:
 */
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
              __pyx_r = __pyx_cur_scope->__pyx_v_f;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 2;
              return __pyx_r;
              __pyx_L31_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 598, __pyx_L25_error)

              /* "src/lxml/serializer.pxi":597
 *                 yield utf8_writer(zf)
 *         else:
 *             with io_open(file, 'w', encoding='utf8') as f:             # <<<<<<<<<<<<<<
 *                 yield f
 *     else:
 */
            }
            __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_L30_try_end;
            __pyx_L25_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(10, 597, __pyx_L27_except_error)
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_t_5);
              __pyx_t_1 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 597, __pyx_L27_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 597, __pyx_L27_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_12 < 0) __PYX_ERR(10, 597, __pyx_L27_except_error)
              __pyx_t_2 = (!__pyx_t_12);
              if (unlikely(__pyx_t_2)) {
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_XGIVEREF(__pyx_t_5);
                __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_5);
                __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; 
                __PYX_ERR(10, 597, __pyx_L27_except_error)
              }
              __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;
              goto __pyx_L26_exception_handled;
            }
            __pyx_L27_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_L26_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_L30_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 597, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            goto __pyx_L24;
          }
          __pyx_L24:;
        }
        goto __pyx_L35;
        __pyx_L21_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L35:;
      }
    }
    __pyx_L5:;

    /* "src/lxml/serializer.pxi":592
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 *     if _isString(file):             # <<<<<<<<<<<<<<
 *         if compression:
 *             with gzip.GzipFile(file, mode='wb', compresslevel=compression) as zf:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":600
 *                 yield f
 *     else:
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_compression); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 600, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":601
 *     else:
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
 */
      /*with:*/ {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_gzip, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fileobj, __pyx_cur_scope->__pyx_v_file) < 0) __PYX_ERR(10, 601, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(10, 601, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compresslevel, __pyx_cur_scope->__pyx_v_compression) < 0) __PYX_ERR(10, 601, __pyx_L1_error)
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 601, __pyx_L1_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_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 601, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 601, __pyx_L37_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {
              __Pyx_GIVEREF(__pyx_t_5);
              __pyx_cur_scope->__pyx_v_zf = __pyx_t_5;
              __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":602
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)             # <<<<<<<<<<<<<<
 *         else:
 *             yield utf8_writer(file)
 */
              __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
              __pyx_t_4 = __pyx_v_4lxml_5etree_utf8_writer; __pyx_t_3 = NULL;
              __pyx_t_7 = 0;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
                if (likely(__pyx_t_3)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                  __Pyx_INCREF(__pyx_t_3);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_4, function);
                  __pyx_t_7 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_zf};
                __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 602, __pyx_L41_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              }
              __pyx_r = __pyx_t_5;
              __pyx_t_5 = 0;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_10;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 3;
              return __pyx_r;
              __pyx_L47_resume_from_yield:;
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 602, __pyx_L41_error)

              /* "src/lxml/serializer.pxi":601
 *     else:
 *         if compression:
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:             # <<<<<<<<<<<<<<
 *                 yield utf8_writer(zf)
 *         else:
 */
            }
            __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_L46_try_end;
            __pyx_L41_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(10, 601, __pyx_L43_except_error)
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_3);
              __pyx_t_1 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 601, __pyx_L43_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 601, __pyx_L43_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_2 < 0) __PYX_ERR(10, 601, __pyx_L43_except_error)
              __pyx_t_12 = (!__pyx_t_2);
              if (unlikely(__pyx_t_12)) {
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_3);
                __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
                __PYX_ERR(10, 601, __pyx_L43_except_error)
              }
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L42_exception_handled;
            }
            __pyx_L43_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L42_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_L46_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 601, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L40;
          }
          __pyx_L40:;
        }
        goto __pyx_L51;
        __pyx_L37_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L51:;
      }

      /* "src/lxml/serializer.pxi":600
 *                 yield f
 *     else:
 *         if compression:             # <<<<<<<<<<<<<<
 *             with gzip.GzipFile(fileobj=file, mode='wb', compresslevel=compression) as zf:
 *                 yield utf8_writer(zf)
 */
      goto __pyx_L36;
    }

    /* "src/lxml/serializer.pxi":604
 *                 yield utf8_writer(zf)
 *         else:
 *             yield utf8_writer(file)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_4lxml_5etree_utf8_writer);
      __pyx_t_4 = __pyx_v_4lxml_5etree_utf8_writer; __pyx_t_5 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_file};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 604, __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;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 4;
      return __pyx_r;
      __pyx_L52_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 604, __pyx_L1_error)
    }
    __pyx_L36:;
  }
  __pyx_L4:;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":589
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_open_utf8_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":614
 *     cdef _ExceptionContext _exc_context
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):             # <<<<<<<<<<<<<<
 *         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;
  PyObject *__pyx_v_close = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filelike,&__pyx_n_s_exc_context,&__pyx_n_s_compression,&__pyx_n_s_close,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filelike)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 614, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_context);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 614, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compression);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 614, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_close);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 614, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 614, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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];
    __pyx_v_close = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, __pyx_nargs); __PYX_ERR(10, 614, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, __pyx_v_close);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, PyObject *__pyx_v_close) {
  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("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_filelike);

  /* "src/lxml/serializer.pxi":615
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 */
  __pyx_t_2 = (__pyx_v_compression != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 615, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":617
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         elif close:
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fileobj, __pyx_v_filelike) < 0) __PYX_ERR(10, 617, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(10, 617, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compresslevel, __pyx_v_compression) < 0) __PYX_ERR(10, 617, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":616
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_GzipFile, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_filelike, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":618
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         elif close:
 *             self._close_filelike = filelike.close
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_filelike, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_close_filelike);
    __Pyx_DECREF(__pyx_v_self->_close_filelike);
    __pyx_v_self->_close_filelike = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":615
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":619
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         elif close:             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_close); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 619, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":620
 *             self._close_filelike = filelike.close
 *         elif close:
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         if exc_context is None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_filelike, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_close_filelike);
    __Pyx_DECREF(__pyx_v_self->_close_filelike);
    __pyx_v_self->_close_filelike = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":619
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         elif close:             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 */
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":621
 *         elif close:
 *             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;

  /* "src/lxml/serializer.pxi":622
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_exc_context == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":623
 *         self._filelike = filelike
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         else:
 *             self._exc_context = exc_context
 */
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ExceptionContext)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__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_4);
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":622
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":625
 *             self._exc_context = _ExceptionContext()
 *         else:
 *             self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self.error_log = _ErrorLog()
 * 
 */
  /*else*/ {
    if (!(likely(((__pyx_v_exc_context) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))))) __PYX_ERR(10, 625, __pyx_L1_error)
    __pyx_t_4 = __pyx_v_exc_context;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__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_4);
    __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":626
 *         else:
 *             self._exc_context = exc_context
 *         self.error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/serializer.pxi":614
 *     cdef _ExceptionContext _exc_context
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None, close=False):             # <<<<<<<<<<<<<<
 *         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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/serializer.pxi":628
 *         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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/serializer.pxi":631
 *         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);

  /* "src/lxml/serializer.pxi":634
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer
 */
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":635
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:
 *             raise IOError, "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_ERR(10, 635, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":634
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer
 */
  }

  /* "src/lxml/serializer.pxi":636
 *         if c_buffer is NULL:
 *             raise IOError, "Could not create I/O writer context."
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":628
 *         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:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":638
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  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;
  __Pyx_RefNannySetupContext("write", 1);

  /* "src/lxml/serializer.pxi":639
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/serializer.pxi":640
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 */
        __pyx_t_4 = (__pyx_v_self->_filelike == Py_None);
        if (unlikely(__pyx_t_4)) {

          /* "src/lxml/serializer.pxi":641
 *         try:
 *             if self._filelike is None:
 *                 raise IOError, "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_ERR(10, 641, __pyx_L6_error)

          /* "src/lxml/serializer.pxi":640
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 */
        }

        /* "src/lxml/serializer.pxi":642
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]             # <<<<<<<<<<<<<<
 *             self._filelike.write(py_buffer)
 *         except:
 */
        __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_buffer + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 642, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __pyx_t_5;
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_py_buffer = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":643
 *                 raise IOError, "File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)             # <<<<<<<<<<<<<<
 *         except:
 *             size = -1
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 643, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = NULL;
        __pyx_t_8 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_8 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_py_buffer};
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 643, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":639
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
 */
      }
      __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_L11_try_end;
      __pyx_L6_error:;
      __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;

      /* "src/lxml/serializer.pxi":644
 *             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_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(10, 644, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_7);

        /* "src/lxml/serializer.pxi":645
 *             self._filelike.write(py_buffer)
 *         except:
 *             size = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
 */
        __pyx_v_size = -1;

        /* "src/lxml/serializer.pxi":646
 *         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_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/serializer.pxi":639
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, "File is already closed"
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/serializer.pxi":648
 *             self._exc_context._store_raised()
 *         finally:
 *             return size  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int close(self) noexcept:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_size;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_5); __pyx_t_5 = 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_L15_return;
      }
      __pyx_L15_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;
    }
  }

  /* "src/lxml/serializer.pxi":638
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size) noexcept:             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
 */

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

/* "src/lxml/serializer.pxi":650
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  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;
  __Pyx_RefNannySetupContext("close", 1);

  /* "src/lxml/serializer.pxi":651
 * 
 *     cdef int close(self) noexcept:
 *         retval = 0             # <<<<<<<<<<<<<<
 *         try:
 *             if self._close_filelike is not None:
 */
  __pyx_v_retval = 0;

  /* "src/lxml/serializer.pxi":652
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/serializer.pxi":653
 *         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);
        if (__pyx_t_4) {

          /* "src/lxml/serializer.pxi":654
 *         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_INCREF(__pyx_v_self->_close_filelike);
          __pyx_t_6 = __pyx_v_self->_close_filelike; __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_8 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
            __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 654, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/serializer.pxi":653
 *         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
 */
        }

        /* "src/lxml/serializer.pxi":656
 *                 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;

        /* "src/lxml/serializer.pxi":652
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
 */
      }
      __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_L11_try_end;
      __pyx_L6_error:;
      __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;

      /* "src/lxml/serializer.pxi":657
 *             # 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_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 657, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);

        /* "src/lxml/serializer.pxi":658
 *             self._filelike = None
 *         except:
 *             retval = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
 */
        __pyx_v_retval = -1L;

        /* "src/lxml/serializer.pxi":659
 *         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_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_L7_exception_handled;
      }

      /* "src/lxml/serializer.pxi":652
 *     cdef int close(self) noexcept:
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/serializer.pxi":661
 *             self._exc_context._store_raised()
 *         finally:
 *             return retval  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_retval;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_5); __pyx_t_5 = 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_retval;
        goto __pyx_L15_return;
      }
      __pyx_L15_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;
    }
  }

  /* "src/lxml/serializer.pxi":650
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self) noexcept:             # <<<<<<<<<<<<<<
 *         retval = 0
 *         try:
 */

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

/* "src/lxml/serializer.pxi":663
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:             # <<<<<<<<<<<<<<
 *     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;

  /* "src/lxml/serializer.pxi":664
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)             # <<<<<<<<<<<<<<
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:
 */
  __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;

  /* "src/lxml/serializer.pxi":663
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":666
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 */

static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *__pyx_v_ctxt) {
  int __pyx_r;

  /* "src/lxml/serializer.pxi":667
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:
 *     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;

  /* "src/lxml/serializer.pxi":666
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":669
 *     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) {
  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;
  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_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);

  /* "src/lxml/serializer.pxi":673
 *                  bint pretty_print, bint with_tail, int standalone,
 *                  int compression):
 *     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);

  /* "src/lxml/serializer.pxi":680
 *     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 == ((int)-1))) __PYX_ERR(10, 680, __pyx_L1_error)
  __pyx_v_c_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":681
 * 
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":682
 *     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_ERR(10, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_data = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":683
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 */
    __pyx_t_2 = (__pyx_v_compression != 0);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":684
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 *             bytes_out = BytesIO()             # <<<<<<<<<<<<<<
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)
 */
      __Pyx_INCREF(__pyx_v_4lxml_5etree_BytesIO);
      __pyx_t_4 = __pyx_v_4lxml_5etree_BytesIO; __pyx_t_5 = NULL;
      __pyx_t_1 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_1 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_v_bytes_out = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":685
 *         if compression:
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
 */
      /*with:*/ {
        __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fileobj, __pyx_v_bytes_out) < 0) __PYX_ERR(10, 685, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(10, 685, __pyx_L1_error)
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compresslevel, __pyx_t_4) < 0) __PYX_ERR(10, 685, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_GzipFile, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 685, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = NULL;
        __pyx_t_1 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_1 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 685, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __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:*/ {
              __pyx_v_gzip_file = __pyx_t_5;
              __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":686
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)             # <<<<<<<<<<<<<<
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
 */
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gzip_file, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 686, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_3 = NULL;
              __pyx_t_1 = 0;
              #if CYTHON_UNPACK_METHODS
              if (likely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
                if (likely(__pyx_t_3)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                  __Pyx_INCREF(__pyx_t_3);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_4, function);
                  __pyx_t_1 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data};
                __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 686, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              }
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":685
 *         if compression:
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
 */
            }
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L14_try_end;
            __pyx_L9_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;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(10, 685, __pyx_L11_except_error)
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_3);
              __pyx_t_7 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 685, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 685, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_2 < 0) __PYX_ERR(10, 685, __pyx_L11_except_error)
              __pyx_t_12 = (!__pyx_t_2);
              if (unlikely(__pyx_t_12)) {
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_3);
                __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
                __PYX_ERR(10, 685, __pyx_L11_except_error)
              }
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L10_exception_handled;
            }
            __pyx_L11_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L1_error;
            __pyx_L10_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            __pyx_L14_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 685, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
        goto __pyx_L18;
        __pyx_L5_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L18:;
      }

      /* "src/lxml/serializer.pxi":687
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bytes_out, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_1 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_1 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 687, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":683
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             with GzipFile(fileobj=bytes_out, mode='wb', compresslevel=compression) as gzip_file:
 */
    }

    /* "src/lxml/serializer.pxi":688
 *                 gzip_file.write(data)
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":689
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
 */
    __pyx_t_12 = _isString(__pyx_v_f);
    if (__pyx_t_12) {

      /* "src/lxml/serializer.pxi":690
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             with open(filename8, 'wb') as f:
 *                 f.write(data)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_filename8 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":691
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *         else:
 */
      /*with:*/ {
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_filename8);
        __Pyx_GIVEREF(__pyx_v_filename8);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename8)) __PYX_ERR(10, 691, __pyx_L1_error);
        __Pyx_INCREF(__pyx_n_u_wb);
        __Pyx_GIVEREF(__pyx_n_u_wb);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_wb)) __PYX_ERR(10, 691, __pyx_L1_error);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 691, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = NULL;
        __pyx_t_1 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_1 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 0+__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 691, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __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:*/ {
              __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
              __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":692
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
 *                 f.write(data)             # <<<<<<<<<<<<<<
 *         else:
 *             f.write(data)
 */
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 692, __pyx_L24_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_3 = NULL;
              __pyx_t_1 = 0;
              #if CYTHON_UNPACK_METHODS
              if (likely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
                if (likely(__pyx_t_3)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                  __Pyx_INCREF(__pyx_t_3);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_4, function);
                  __pyx_t_1 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data};
                __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 692, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              }
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "src/lxml/serializer.pxi":691
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *         else:
 */
            }
            __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_L24_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;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(10, 691, __pyx_L26_except_error)
              __Pyx_XGOTREF(__pyx_t_5);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_3);
              __pyx_t_7 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 691, __pyx_L26_except_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 691, __pyx_L26_except_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_12 < 0) __PYX_ERR(10, 691, __pyx_L26_except_error)
              __pyx_t_2 = (!__pyx_t_12);
              if (unlikely(__pyx_t_2)) {
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_3);
                __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
                __PYX_ERR(10, 691, __pyx_L26_except_error)
              }
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L25_exception_handled;
            }
            __pyx_L26_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_L25_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__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 691, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            goto __pyx_L23;
          }
          __pyx_L23:;
        }
        goto __pyx_L33;
        __pyx_L20_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L33:;
      }

      /* "src/lxml/serializer.pxi":689
 *             data = bytes_out.getvalue()
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             with open(filename8, 'wb') as f:
 */
      goto __pyx_L19;
    }

    /* "src/lxml/serializer.pxi":694
 *                 f.write(data)
 *         else:
 *             f.write(data)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_1 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_1 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_data};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 694, __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_L19:;

    /* "src/lxml/serializer.pxi":695
 *         else:
 *             f.write(data)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if encoding is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":681
 * 
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 */
  }

  /* "src/lxml/serializer.pxi":697
 *         return
 * 
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":698
 * 
 *     if encoding is None:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
 */
    __pyx_v_c_enc = NULL;

    /* "src/lxml/serializer.pxi":697
 *         return
 * 
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
    goto __pyx_L34;
  }

  /* "src/lxml/serializer.pxi":700
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":701
 *     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_L34:;

  /* "src/lxml/serializer.pxi":702
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_2 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":703
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;

    /* "src/lxml/serializer.pxi":702
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
    goto __pyx_L35;
  }

  /* "src/lxml/serializer.pxi":705
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 * 
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":706
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _xcstr(doctype)             # <<<<<<<<<<<<<<
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 */
    __pyx_v_c_doctype = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L35:;

  /* "src/lxml/serializer.pxi":708
 *         c_doctype = _xcstr(doctype)
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)             # <<<<<<<<<<<<<<
 *     if writer is None:
 *         with nogil:
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_f, __pyx_v_c_enc, __pyx_v_compression, (&__pyx_v_c_buffer), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":709
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             error_result = _serialise_node(
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":710
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             error_result = _serialise_node(
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/serializer.pxi":711
 *     if writer is None:
 *         with nogil:
 *             error_result = _serialise_node(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *                 write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 */
          __pyx_v_error_result = __pyx_f_4lxml_5etree__serialise_node(__pyx_v_c_buffer, __pyx_v_c_doctype, __pyx_v_c_enc, __pyx_v_element->_c_node, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);
        }

        /* "src/lxml/serializer.pxi":710
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             error_result = _serialise_node(
 *                 c_buffer, c_doctype, c_enc, element._c_node, c_method,
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L39;
          }
          __pyx_L39:;
        }
    }

    /* "src/lxml/serializer.pxi":709
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer, close=False)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             error_result = _serialise_node(
 */
    goto __pyx_L36;
  }

  /* "src/lxml/serializer.pxi":715
 *                 write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 *     else:
 *         error_result = _serialise_node(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 */
  /*else*/ {

    /* "src/lxml/serializer.pxi":717
 *         error_result = _serialise_node(
 *             c_buffer, c_doctype, c_enc, element._c_node, c_method,
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
    __pyx_v_error_result = __pyx_f_4lxml_5etree__serialise_node(__pyx_v_c_buffer, __pyx_v_c_doctype, __pyx_v_c_enc, __pyx_v_element->_c_node, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);
  }
  __pyx_L36:;

  /* "src/lxml/serializer.pxi":719
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":720
 * 
 *     if writer is not None:
 *         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 == ((int)-1))) __PYX_ERR(10, 720, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":719
 *             write_xml_declaration, write_doctype, pretty_print, with_tail, standalone)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 */
  }

  /* "src/lxml/serializer.pxi":721
 *     if writer is not None:
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":722
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":721
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":669
 *     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_XDECREF(__pyx_t_7);
  __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;
}

/* "src/lxml/serializer.pxi":725
 * 
 * 
 * cdef int _serialise_node(tree.xmlOutputBuffer* c_buffer, const_xmlChar* c_doctype,             # <<<<<<<<<<<<<<
 *                          const_char* c_enc, xmlNode* c_node, int c_method,
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
 */

static int __pyx_f_4lxml_5etree__serialise_node(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_c_doctype, const char *__pyx_v_c_enc, xmlNode *__pyx_v_c_node, int __pyx_v_c_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_error_result;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/serializer.pxi":729
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
 *                          bint with_tail, int standalone) noexcept nogil:
 *     _writeNodeToBuffer(             # <<<<<<<<<<<<<<
 *         c_buffer, 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_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);

  /* "src/lxml/serializer.pxi":732
 *         c_buffer, c_node, c_enc, c_doctype, c_method,
 *         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;

  /* "src/lxml/serializer.pxi":733
 *         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)
 *         if error_result != -1:
 */
  __pyx_t_2 = (__pyx_v_error_result == XML_ERR_OK);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":734
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if error_result != -1:
 *             error_result = xmlerror.XML_ERR_OK
 */
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "src/lxml/serializer.pxi":735
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 */
    __pyx_t_2 = (__pyx_v_error_result != -1L);
    if (__pyx_t_2) {

      /* "src/lxml/serializer.pxi":736
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:
 *             error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_v_error_result = XML_ERR_OK;

      /* "src/lxml/serializer.pxi":735
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result != -1:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 */
    }

    /* "src/lxml/serializer.pxi":733
 *         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)
 *         if error_result != -1:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":738
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     return error_result
 * 
 */
  /*else*/ {
    (void)(xmlOutputBufferClose(__pyx_v_c_buffer));
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":739
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 *     return error_result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_error_result;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":725
 * 
 * 
 * cdef int _serialise_node(tree.xmlOutputBuffer* c_buffer, const_xmlChar* c_doctype,             # <<<<<<<<<<<<<<
 *                          const_char* c_enc, xmlNode* c_node, int c_method,
 *                          bint write_xml_declaration, bint write_doctype, bint pretty_print,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":742
 * 
 * 
 * cdef _FilelikeWriter _create_output_buffer(             # <<<<<<<<<<<<<<
 *         f, const_char* c_enc, int c_compression,
 *         tree.xmlOutputBuffer** c_buffer_ret, bint close):
 */

static struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *__pyx_v_f, const char *__pyx_v_c_enc, int __pyx_v_c_compression, xmlOutputBuffer **__pyx_v_c_buffer_ret, int __pyx_v_close) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  PyObject *__pyx_v_filename8 = 0;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  xmlChar const *__pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  xmlOutputBuffer *__pyx_t_16;
  const char *__pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_output_buffer", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "src/lxml/serializer.pxi":748
 *     cdef _FilelikeWriter writer
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL:
 *         raise LookupError(
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "src/lxml/serializer.pxi":749
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 */
  __pyx_t_1 = (__pyx_v_enchandler == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":751
 *     if enchandler is NULL:
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")             # <<<<<<<<<<<<<<
 *     try:
 *         f = _getFSPathOrObject(f)
 */
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = 127;
    __Pyx_INCREF(__pyx_kp_u_unknown_encoding);
    __pyx_t_3 += 19;
    __Pyx_GIVEREF(__pyx_kp_u_unknown_encoding);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_unknown_encoding);
    __pyx_t_1 = (__pyx_v_c_enc != NULL);
    if (__pyx_t_1) {
      __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_c_enc); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 751, __pyx_L1_error)
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_c_enc, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 751, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(__pyx_kp_u__12);
      __pyx_t_5 = __pyx_kp_u__12;
    }
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_4;
    __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u__25);
    __pyx_t_3 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__25);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__25);
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":750
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:
 *         raise LookupError(             # <<<<<<<<<<<<<<
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_LookupError, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(10, 750, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":749
 *     cdef bytes filename8
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 */
  }

  /* "src/lxml/serializer.pxi":752
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/serializer.pxi":753
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 753, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":754
 *     try:
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (
 */
      __pyx_t_1 = _isString(__pyx_v_f);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":755
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             if b'%' in filename8 and (
 *                     # Exclude absolute Windows paths and file:// URLs.
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 755, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(10, 755, __pyx_L4_error)
        __pyx_v_filename8 = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":756
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
 */
        __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_kp_b__63, __pyx_v_filename8, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(10, 756, __pyx_L4_error)
        if (__pyx_t_11) {
        } else {
          __pyx_t_1 = __pyx_t_11;
          goto __pyx_L12_bool_binop_done;
        }

        /* "src/lxml/serializer.pxi":758
 *             if b'%' in filename8 and (
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)             # <<<<<<<<<<<<<<
 *                     or filename8[:7].lower() == b'file://'):
 *                 # A file path (not a URL) containing the '%' URL escape character.
 */
        if (unlikely(__pyx_v_filename8 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
          __PYX_ERR(10, 758, __pyx_L4_error)
        }
        __pyx_t_12 = __Pyx_PyBytes_AsUString(__pyx_v_filename8); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(10, 758, __pyx_L4_error)
        __pyx_t_11 = __pyx_f_4lxml_5etree__isFilePath(((xmlChar const *)__pyx_t_12));
        __pyx_t_14 = (__pyx_t_11 != __pyx_e_4lxml_5etree_NO_FILE_PATH);
        if (__pyx_t_14) {
        } else {
          __pyx_t_13 = __pyx_t_14;
          goto __pyx_L15_bool_binop_done;
        }
        __pyx_t_14 = (__pyx_t_11 != __pyx_e_4lxml_5etree_ABS_WIN_FILE_PATH);
        __pyx_t_13 = __pyx_t_14;
        __pyx_L15_bool_binop_done:;
        __pyx_t_11 = __pyx_t_13;
        if (!__pyx_t_11) {
        } else {
          __pyx_t_1 = __pyx_t_11;
          goto __pyx_L12_bool_binop_done;
        }

        /* "src/lxml/serializer.pxi":759
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
 *                     or filename8[:7].lower() == b'file://'):             # <<<<<<<<<<<<<<
 *                 # A file path (not a URL) containing the '%' URL escape character.
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
 */
        if (unlikely(__pyx_v_filename8 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(10, 759, __pyx_L4_error)
        }
        __pyx_t_7 = PySequence_GetSlice(__pyx_v_filename8, 0, 7); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 759, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_lower); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 759, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_15 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_15 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_15, 0+__pyx_t_15);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 759, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_11 = (__Pyx_PyBytes_Equals(__pyx_t_2, __pyx_kp_b_file_2, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(10, 759, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_11;
        __pyx_L12_bool_binop_done:;

        /* "src/lxml/serializer.pxi":756
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
 */
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":762
 *                 # A file path (not a URL) containing the '%' URL escape character.
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
 *                 filename8 = filename8.replace(b'%', b'%25')             # <<<<<<<<<<<<<<
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
 */
          __pyx_t_2 = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyBytes_Type_replace, __pyx_v_filename8, __pyx_kp_b__63, __pyx_kp_b_25); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 762, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(10, 762, __pyx_L4_error)
          __Pyx_DECREF_SET(__pyx_v_filename8, ((PyObject*)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "src/lxml/serializer.pxi":756
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (             # <<<<<<<<<<<<<<
 *                     # Exclude absolute Windows paths and file:// URLs.
 *                     _isFilePath(<const xmlChar*>filename8) not in (NO_FILE_PATH, ABS_WIN_FILE_PATH)
 */
        }

        /* "src/lxml/serializer.pxi":763
 *                 # libxml2 uses URL-unescaping on these, so escape the path before passing it in.
 *                 filename8 = filename8.replace(b'%', b'%25')
 *             c_buffer = tree.xmlOutputBufferCreateFilename(             # <<<<<<<<<<<<<<
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:
 */
        __pyx_v_c_buffer = xmlOutputBufferCreateFilename(PyBytes_AS_STRING(__pyx_v_filename8), __pyx_v_enchandler, __pyx_v_c_compression);

        /* "src/lxml/serializer.pxi":765
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 */
        __pyx_t_1 = (__pyx_v_c_buffer == NULL);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":766
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError             # <<<<<<<<<<<<<<
 *             writer = None
 *         elif hasattr(f, 'write'):
 */
          __pyx_t_2 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 766, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "src/lxml/serializer.pxi":765
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, c_compression)
 *             if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 */
        }

        /* "src/lxml/serializer.pxi":767
 *             if c_buffer is NULL:
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None             # <<<<<<<<<<<<<<
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

        /* "src/lxml/serializer.pxi":754
 *     try:
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             if b'%' in filename8 and (
 */
        goto __pyx_L10;
      }

      /* "src/lxml/serializer.pxi":768
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)
 */
      __pyx_t_1 = __Pyx_HasAttr(__pyx_v_f, __pyx_n_u_write); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 768, __pyx_L4_error)
      if (likely(__pyx_t_1)) {

        /* "src/lxml/serializer.pxi":769
 *             writer = None
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 */
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_f);
        __Pyx_GIVEREF(__pyx_v_f);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f)) __PYX_ERR(10, 769, __pyx_L4_error);
        __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_c_compression); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_compression, __pyx_t_7) < 0) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_close); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_close, __pyx_t_7) < 0) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FilelikeWriter), __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 769, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/serializer.pxi":770
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(
 */
        __pyx_t_16 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, __pyx_v_enchandler); if (unlikely(__pyx_t_16 == ((xmlOutputBuffer *)NULL))) __PYX_ERR(10, 770, __pyx_L4_error)
        __pyx_v_c_buffer = __pyx_t_16;

        /* "src/lxml/serializer.pxi":768
 *                 python.PyErr_SetFromErrno(IOError)  # raises IOError
 *             writer = None
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer = _FilelikeWriter(f, compression=c_compression, close=close)
 *             c_buffer = writer._createOutputBuffer(enchandler)
 */
        goto __pyx_L10;
      }

      /* "src/lxml/serializer.pxi":772
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:
 */
      /*else*/ {

        /* "src/lxml/serializer.pxi":773
 *         else:
 *             raise TypeError(
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")             # <<<<<<<<<<<<<<
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
        __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 773, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = 0;
        __pyx_t_4 = 127;
        __Pyx_INCREF(__pyx_kp_u_File_or_filename_expected_got);
        __pyx_t_3 += 32;
        __Pyx_GIVEREF(__pyx_kp_u_File_or_filename_expected_got);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_File_or_filename_expected_got);
        __pyx_t_17 = _fqtypename(__pyx_v_f);
        __pyx_t_6 = __Pyx_ssize_strlen(__pyx_t_17); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 773, __pyx_L4_error)
        __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_17, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 773, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
        __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_INCREF(__pyx_kp_u__25);
        __pyx_t_3 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__25);
        PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__25);
        __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 773, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "src/lxml/serializer.pxi":772
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:
 */
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 772, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(10, 772, __pyx_L4_error)
      }
      __pyx_L10:;

      /* "src/lxml/serializer.pxi":752
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 */
    }
    __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_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":774
 *             raise TypeError(
 *                 f"File or filename expected, got '{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_7, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(10, 774, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "src/lxml/serializer.pxi":775
 *                 f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise
 *     c_buffer_ret[0] = c_buffer
 */
      (void)(xmlCharEncCloseFunc(__pyx_v_enchandler));

      /* "src/lxml/serializer.pxi":776
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise             # <<<<<<<<<<<<<<
 *     c_buffer_ret[0] = c_buffer
 *     return writer
 */
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_2);
      __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_2 = 0; 
      __PYX_ERR(10, 776, __pyx_L6_except_error)
    }

    /* "src/lxml/serializer.pxi":752
 *         raise LookupError(
 *             f"unknown encoding: '{c_enc.decode('UTF-8') if c_enc is not NULL else u''}'")
 *     try:             # <<<<<<<<<<<<<<
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):
 */
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "src/lxml/serializer.pxi":777
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise
 *     c_buffer_ret[0] = c_buffer             # <<<<<<<<<<<<<<
 *     return writer
 * 
 */
  (__pyx_v_c_buffer_ret[0]) = __pyx_v_c_buffer;

  /* "src/lxml/serializer.pxi":778
 *         raise
 *     c_buffer_ret[0] = c_buffer
 *     return writer             # <<<<<<<<<<<<<<
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __pyx_r = __pyx_v_writer;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":742
 * 
 * 
 * cdef _FilelikeWriter _create_output_buffer(             # <<<<<<<<<<<<<<
 *         f, const_char* c_enc, int c_compression,
 *         tree.xmlOutputBuffer** c_buffer_ret, bint close):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __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_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":780
 *     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;
  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 *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_ns_prefixes", 1);

  /* "src/lxml/serializer.pxi":781
 * 
 * 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.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_ns_prefixes); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(10, 781, __pyx_L1_error)
  __pyx_v_num_ns_prefixes = __pyx_t_1;

  /* "src/lxml/serializer.pxi":783
 *     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.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))             # <<<<<<<<<<<<<<
 *     if not c_ns_prefixes:
 *         raise MemoryError()
 */
  __pyx_v_c_ns_prefixes = ((xmlChar **)lxml_malloc((__pyx_v_num_ns_prefixes + 1), (sizeof(xmlChar *))));

  /* "src/lxml/serializer.pxi":784
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     i = 0
 */
  __pyx_t_2 = (!(__pyx_v_c_ns_prefixes != 0));
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/serializer.pxi":785
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     i = 0
 *     try:
 */
    PyErr_NoMemory(); __PYX_ERR(10, 785, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":784
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.lxml_malloc(num_ns_prefixes + 1, sizeof(xmlChar*))
 *     if not c_ns_prefixes:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     i = 0
 */
  }

  /* "src/lxml/serializer.pxi":786
 *     if not c_ns_prefixes:
 *         raise MemoryError()
 *     i = 0             # <<<<<<<<<<<<<<
 *     try:
 *         for prefix in ns_prefixes:
 */
  __pyx_v_i = 0;

  /* "src/lxml/serializer.pxi":787
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/serializer.pxi":788
 *     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 (likely(PyList_CheckExact(__pyx_v_ns_prefixes)) || PyTuple_CheckExact(__pyx_v_ns_prefixes)) {
        __pyx_t_6 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_1 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ns_prefixes); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 788, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 788, __pyx_L4_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 788, __pyx_L4_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(10, 788, __pyx_L4_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 788, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 788, __pyx_L4_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(10, 788, __pyx_L4_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 788, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_6);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(10, 788, __pyx_L4_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":789
 *     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_8 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 789, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":790
 *         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_ERR(10, 790, __pyx_L4_error)
        }
        __pyx_t_9 = __Pyx_PyBytes_GET_SIZE(__pyx_v_prefix_utf); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(10, 790, __pyx_L4_error)
        __pyx_v_c_prefix = xmlDictExists(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), __pyx_t_9);

        /* "src/lxml/serializer.pxi":791
 *              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_2 = (__pyx_v_c_prefix != 0);
        if (__pyx_t_2) {

          /* "src/lxml/serializer.pxi":793
 *              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);

          /* "src/lxml/serializer.pxi":794
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.lxml_free(c_ns_prefixes)
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "src/lxml/serializer.pxi":791
 *              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
 */
        }

        /* "src/lxml/serializer.pxi":788
 *     i = 0
 *     try:
 *         for prefix in ns_prefixes:             # <<<<<<<<<<<<<<
 *              prefix_utf = _utf8(prefix)
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), len(prefix_utf))
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":787
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "src/lxml/serializer.pxi":795
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.lxml_free(c_ns_prefixes)
 *         raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_ns_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_10) < 0) __PYX_ERR(10, 795, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "src/lxml/serializer.pxi":796
 *                  i += 1
 *     except:
 *         python.lxml_free(c_ns_prefixes)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
      lxml_free(__pyx_v_c_ns_prefixes);

      /* "src/lxml/serializer.pxi":797
 *     except:
 *         python.lxml_free(c_ns_prefixes)
 *         raise             # <<<<<<<<<<<<<<
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker
 */
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_8, __pyx_t_10);
      __pyx_t_6 = 0; __pyx_t_8 = 0; __pyx_t_10 = 0; 
      __PYX_ERR(10, 797, __pyx_L6_except_error)
    }

    /* "src/lxml/serializer.pxi":787
 *         raise MemoryError()
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 */
    __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_L9_try_end:;
  }

  /* "src/lxml/serializer.pxi":799
 *         raise
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker             # <<<<<<<<<<<<<<
 *     return c_ns_prefixes
 * 
 */
  (__pyx_v_c_ns_prefixes[__pyx_v_i]) = NULL;

  /* "src/lxml/serializer.pxi":800
 * 
 *     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;

  /* "src/lxml/serializer.pxi":780
 *     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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "src/lxml/serializer.pxi":802
 *     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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlOutputBuffer *__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_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  Py_UCS4 __pyx_t_19;
  const char *__pyx_t_20;
  Py_ssize_t __pyx_t_21;
  char const *__pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tofilelikeC14N", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "src/lxml/serializer.pxi":804
 * 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);

  /* "src/lxml/serializer.pxi":806
 *     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;

  /* "src/lxml/serializer.pxi":810
 *     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;

  /* "src/lxml/serializer.pxi":812
 *     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;

  /* "src/lxml/serializer.pxi":813
 * 
 *     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 == ((xmlDoc *)NULL))) __PYX_ERR(10, 813, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_1;

  /* "src/lxml/serializer.pxi":814
 *     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:*/ {

    /* "src/lxml/serializer.pxi":817
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         f = _getFSPathOrObject(f)
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(10, 817, __pyx_L4_error)
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":816
 *     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 == ((xmlChar **)NULL))) __PYX_ERR(10, 816, __pyx_L4_error)
      __pyx_t_2 = __pyx_t_4;
    } else {

      /* "src/lxml/serializer.pxi":817
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         f = _getFSPathOrObject(f)
 */
      __pyx_t_2 = NULL;
    }
    __pyx_v_c_inclusive_ns_prefixes = __pyx_t_2;

    /* "src/lxml/serializer.pxi":819
 *             if inclusive_ns_prefixes else NULL)
 * 
 *         f = _getFSPathOrObject(f)             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_f); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 819, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":820
 * 
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 */
    __pyx_t_3 = _isString(__pyx_v_f);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":821
 *         f = _getFSPathOrObject(f)
 *         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_ERR(10, 821, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_filename8 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":822
 *         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);

      /* "src/lxml/serializer.pxi":823
 *             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;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {

            /* "src/lxml/serializer.pxi":824
 *             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);
          }

          /* "src/lxml/serializer.pxi":823
 *             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
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L9;
            }
            __pyx_L9:;
          }
      }

      /* "src/lxml/serializer.pxi":820
 * 
 *         f = _getFSPathOrObject(f)
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":827
 *                     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 = __Pyx_HasAttr(__pyx_v_f, __pyx_n_u_write); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(10, 827, __pyx_L4_error)
    if (likely(__pyx_t_3)) {

      /* "src/lxml/serializer.pxi":828
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 828, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_f);
      __Pyx_GIVEREF(__pyx_v_f);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_f)) __PYX_ERR(10, 828, __pyx_L4_error);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 828, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 828, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_compression, __pyx_t_7) < 0) __PYX_ERR(10, 828, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FilelikeWriter), __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 828, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":829
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)             # <<<<<<<<<<<<<<
 *             try:
 *                 with writer.error_log:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, NULL); if (unlikely(__pyx_t_8 == ((xmlOutputBuffer *)NULL))) __PYX_ERR(10, 829, __pyx_L4_error)
      __pyx_v_c_buffer = __pyx_t_8;

      /* "src/lxml/serializer.pxi":830
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:             # <<<<<<<<<<<<<<
 *                 with writer.error_log:
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
 */
      /*try:*/ {

        /* "src/lxml/serializer.pxi":831
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
 *                 with writer.error_log:             # <<<<<<<<<<<<<<
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
 *                         c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
        /*with:*/ {
          __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_writer->error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 831, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_writer->error_log); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(10, 831, __pyx_L13_error)
          /*try:*/ {
            {
              (void)__pyx_t_11; (void)__pyx_t_12; (void)__pyx_t_13; /* mark used */
              /*try:*/ {

                /* "src/lxml/serializer.pxi":832
 *             try:
 *                 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);

                /* "src/lxml/serializer.pxi":831
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             try:
 *                 with writer.error_log:             # <<<<<<<<<<<<<<
 *                     bytes_count = c14n.xmlC14NDocSaveTo(
 *                         c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
              }
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_9) {
                __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__38, NULL);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 831, __pyx_L11_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              }
              goto __pyx_L16;
            }
            __pyx_L16:;
          }
          goto __pyx_L23;
          __pyx_L13_error:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L11_error;
          __pyx_L23:;
        }
      }

      /* "src/lxml/serializer.pxi":836
 *                         with_comments, c_buffer)
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *             if bytes_count < 0:
 *                 error = bytes_count
 */
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_v_error = xmlOutputBufferClose(__pyx_v_c_buffer);
          goto __pyx_L12;
        }
        __pyx_L11_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_16 = 0; __pyx_t_17 = 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;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_16, &__pyx_t_17);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_13, &__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __pyx_t_10 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
          {
            __pyx_v_error = xmlOutputBufferClose(__pyx_v_c_buffer);
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_16, __pyx_t_17);
          }
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ErrRestore(__pyx_t_9, __pyx_t_13, __pyx_t_12);
          __pyx_t_9 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
          __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
          goto __pyx_L4_error;
        }
        __pyx_L12:;
      }

      /* "src/lxml/serializer.pxi":837
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:             # <<<<<<<<<<<<<<
 *                 error = bytes_count
 *             elif error != -1:
 */
      __pyx_t_3 = (__pyx_v_bytes_count < 0);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":838
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:
 *                 error = bytes_count             # <<<<<<<<<<<<<<
 *             elif error != -1:
 *                 error = xmlerror.XML_ERR_OK
 */
        __pyx_v_error = __pyx_v_bytes_count;

        /* "src/lxml/serializer.pxi":837
 *             finally:
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:             # <<<<<<<<<<<<<<
 *                 error = bytes_count
 *             elif error != -1:
 */
        goto __pyx_L26;
      }

      /* "src/lxml/serializer.pxi":839
 *             if bytes_count < 0:
 *                 error = bytes_count
 *             elif error != -1:             # <<<<<<<<<<<<<<
 *                 error = xmlerror.XML_ERR_OK
 *         else:
 */
      __pyx_t_3 = (__pyx_v_error != -1L);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":840
 *                 error = bytes_count
 *             elif error != -1:
 *                 error = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 */
        __pyx_v_error = XML_ERR_OK;

        /* "src/lxml/serializer.pxi":839
 *             if bytes_count < 0:
 *                 error = bytes_count
 *             elif error != -1:             # <<<<<<<<<<<<<<
 *                 error = xmlerror.XML_ERR_OK
 *         else:
 */
      }
      __pyx_L26:;

      /* "src/lxml/serializer.pxi":827
 *                     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)
 */
      goto __pyx_L6;
    }

    /* "src/lxml/serializer.pxi":842
 *                 error = xmlerror.XML_ERR_OK
 *         else:
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")             # <<<<<<<<<<<<<<
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 */
    /*else*/ {
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 842, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_18 = 0;
      __pyx_t_19 = 127;
      __Pyx_INCREF(__pyx_kp_u_File_or_filename_expected_got);
      __pyx_t_18 += 32;
      __Pyx_GIVEREF(__pyx_kp_u_File_or_filename_expected_got);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_File_or_filename_expected_got);
      __pyx_t_20 = _fqtypename(__pyx_v_f);
      __pyx_t_21 = __Pyx_ssize_strlen(__pyx_t_20); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(10, 842, __pyx_L4_error)
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_20, 0, __pyx_t_21, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 842, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_19;
      __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u__25);
      __pyx_t_18 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__25);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__25);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 842, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 842, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(10, 842, __pyx_L4_error)
    }
    __pyx_L6:;
  }

  /* "src/lxml/serializer.pxi":844
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

      /* "src/lxml/serializer.pxi":845
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
      __pyx_t_3 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":846
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
        lxml_free(__pyx_v_c_inclusive_ns_prefixes);

        /* "src/lxml/serializer.pxi":845
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
      }
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_9 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_9);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_16, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_9);
      __pyx_t_14 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
      {

        /* "src/lxml/serializer.pxi":844
 *             raise TypeError(f"File or filename expected, got '{python._fqtypename(f).decode('UTF-8')}'")
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)
 */
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

        /* "src/lxml/serializer.pxi":845
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
        __pyx_t_3 = (__pyx_v_c_inclusive_ns_prefixes != NULL);
        if (__pyx_t_3) {

          /* "src/lxml/serializer.pxi":846
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.lxml_free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
          lxml_free(__pyx_v_c_inclusive_ns_prefixes);

          /* "src/lxml/serializer.pxi":845
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 */
        }
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_9);
      }
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_17, __pyx_t_16, __pyx_t_11);
      __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_9 = 0;
      __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_22;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/serializer.pxi":848
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":849
 * 
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if error < 0:
 */
    __pyx_t_10 = ((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_10 == ((int)-1))) __PYX_ERR(10, 849, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":848
 *             python.lxml_free(c_inclusive_ns_prefixes)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
 */
  }

  /* "src/lxml/serializer.pxi":851
 *         writer._exc_context._raise_if_stored()
 * 
 *     if error < 0:             # <<<<<<<<<<<<<<
 *         message = "C14N failed"
 *         if writer is not None:
 */
  __pyx_t_3 = (__pyx_v_error < 0);
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":852
 * 
 *     if error < 0:
 *         message = "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;

    /* "src/lxml/serializer.pxi":853
 *     if error < 0:
 *         message = "C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_writer) != Py_None);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":854
 *         message = "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;

      /* "src/lxml/serializer.pxi":855
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError(message)
 */
      __pyx_t_18 = PyObject_Length(((PyObject *)__pyx_v_errors)); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(10, 855, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_18 != 0);
      if (__pyx_t_3) {

        /* "src/lxml/serializer.pxi":856
 *             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)) __PYX_ERR(10, 856, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 856, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":855
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError(message)
 */
      }

      /* "src/lxml/serializer.pxi":853
 *     if error < 0:
 *         message = "C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
 */
    }

    /* "src/lxml/serializer.pxi":857
 *             if len(errors):
 *                 message = errors[0].message
 *         raise C14NError(message)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_C14NError), __pyx_v_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 857, __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_ERR(10, 857, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":851
 *         writer._exc_context._raise_if_stored()
 * 
 *     if error < 0:             # <<<<<<<<<<<<<<
 *         message = "C14N failed"
 *         if writer is not None:
 */
  }

  /* "src/lxml/serializer.pxi":802
 *     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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":862
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_54canonicalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_53canonicalize, "Convert XML to its C14N 2.0 serialised form.\n\n    If *out* is provided, it must be a file or file-like object that receives\n    the serialised canonical XML output (text, not bytes) through its ``.write()``\n    method.  To write to a file, open it in text mode with encoding \"utf-8\".\n    If *out* is not provided, this function returns the output as text string.\n\n    Either *xml_data* (an XML string, tree or Element) or *file*\n    (a file path or file-like object) must be provided as input.\n\n    The configuration options are the same as for the ``C14NWriterTarget``.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_54canonicalize = {"canonicalize", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_54canonicalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_53canonicalize};
static PyObject *__pyx_pw_4lxml_5etree_54canonicalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_xml_data = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_from_file = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("canonicalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xml_data,&__pyx_n_s_out,&__pyx_n_s_from_file,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xml_data);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 862, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 862, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_options, values + 0, kwd_pos_args, "canonicalize") < 0)) __PYX_ERR(10, 862, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_xml_data = values[0];
    __pyx_v_out = values[1];
    __pyx_v_from_file = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("canonicalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(10, 862, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("lxml.etree.canonicalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_53canonicalize(__pyx_self, __pyx_v_xml_data, __pyx_v_out, __pyx_v_from_file, __pyx_v_options);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_options);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_53canonicalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xml_data, PyObject *__pyx_v_out, PyObject *__pyx_v_from_file, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_sio = NULL;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_target = NULL;
  struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_parser = 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_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("canonicalize", 0);
  __Pyx_INCREF(__pyx_v_out);

  /* "src/lxml/serializer.pxi":875
 *     The configuration options are the same as for the ``C14NWriterTarget``.
 *     """
 *     if xml_data is None and from_file is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
 */
  __pyx_t_2 = (__pyx_v_xml_data == Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_from_file == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":876
 *     """
 *     if xml_data is None and from_file is None:
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")             # <<<<<<<<<<<<<<
 * 
 *     sio = None
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 876, __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_ERR(10, 876, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":875
 *     The configuration options are the same as for the ``C14NWriterTarget``.
 *     """
 *     if xml_data is None and from_file is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
 */
  }

  /* "src/lxml/serializer.pxi":878
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
 * 
 *     sio = None             # <<<<<<<<<<<<<<
 *     if out is None:
 *         sio = out = StringIO()
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_sio = Py_None;

  /* "src/lxml/serializer.pxi":879
 * 
 *     sio = None
 *     if out is None:             # <<<<<<<<<<<<<<
 *         sio = out = StringIO()
 * 
 */
  __pyx_t_1 = (__pyx_v_out == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":880
 *     sio = None
 *     if out is None:
 *         sio = out = StringIO()             # <<<<<<<<<<<<<<
 * 
 *     target = C14NWriterTarget(out.write, **options)
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree_StringIO);
    __pyx_t_4 = __pyx_v_4lxml_5etree_StringIO; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_sio, __pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":879
 * 
 *     sio = None
 *     if out is None:             # <<<<<<<<<<<<<<
 *         sio = out = StringIO()
 * 
 */
  }

  /* "src/lxml/serializer.pxi":882
 *         sio = out = StringIO()
 * 
 *     target = C14NWriterTarget(out.write, **options)             # <<<<<<<<<<<<<<
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(10, 882, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 882, __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_v_target = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/serializer.pxi":884
 *     target = C14NWriterTarget(out.write, **options)
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):             # <<<<<<<<<<<<<<
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None
 */
  __pyx_t_2 = (__pyx_v_xml_data != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyBaseString_Check(__pyx_v_xml_data); 
  __pyx_t_7 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":885
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):
 *         _tree_to_target(xml_data, target)             # <<<<<<<<<<<<<<
 *         return sio.getvalue() if sio is not None else None
 * 
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__tree_to_target(__pyx_v_xml_data, ((PyObject *)__pyx_v_target)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":886
 *     if xml_data is not None and not isinstance(xml_data, basestring):
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None             # <<<<<<<<<<<<<<
 * 
 *     cdef _FeedParser parser = XMLParser(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = (__pyx_v_sio != Py_None);
    if (__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sio, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 886, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_5 = Py_None;
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":884
 *     target = C14NWriterTarget(out.write, **options)
 * 
 *     if xml_data is not None and not isinstance(xml_data, basestring):             # <<<<<<<<<<<<<<
 *         _tree_to_target(xml_data, target)
 *         return sio.getvalue() if sio is not None else None
 */
  }

  /* "src/lxml/serializer.pxi":889
 * 
 *     cdef _FeedParser parser = XMLParser(
 *         target=target,             # <<<<<<<<<<<<<<
 *         attribute_defaults=True,
 *         collect_ids=False,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_target, ((PyObject *)__pyx_v_target)) < 0) __PYX_ERR(10, 889, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":890
 *     cdef _FeedParser parser = XMLParser(
 *         target=target,
 *         attribute_defaults=True,             # <<<<<<<<<<<<<<
 *         collect_ids=False,
 *     )
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_attribute_defaults, Py_True) < 0) __PYX_ERR(10, 889, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":891
 *         target=target,
 *         attribute_defaults=True,
 *         collect_ids=False,             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_collect_ids, Py_False) < 0) __PYX_ERR(10, 889, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":888
 *         return sio.getvalue() if sio is not None else None
 * 
 *     cdef _FeedParser parser = XMLParser(             # <<<<<<<<<<<<<<
 *         target=target,
 *         attribute_defaults=True,
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XMLParser), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":894
 *     )
 * 
 *     if xml_data is not None:             # <<<<<<<<<<<<<<
 *         parser.feed(xml_data)
 *         parser.close()
 */
  __pyx_t_1 = (__pyx_v_xml_data != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":895
 * 
 *     if xml_data is not None:
 *         parser.feed(xml_data)             # <<<<<<<<<<<<<<
 *         parser.close()
 *     elif from_file is not None:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_parser->__pyx_base.__pyx_vtab)->feed(__pyx_v_parser, __pyx_v_xml_data, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":896
 *     if xml_data is not None:
 *         parser.feed(xml_data)
 *         parser.close()             # <<<<<<<<<<<<<<
 *     elif from_file is not None:
 *         try:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_parser->__pyx_base.__pyx_vtab)->close(__pyx_v_parser, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":894
 *     )
 * 
 *     if xml_data is not None:             # <<<<<<<<<<<<<<
 *         parser.feed(xml_data)
 *         parser.close()
 */
    goto __pyx_L10;
  }

  /* "src/lxml/serializer.pxi":897
 *         parser.feed(xml_data)
 *         parser.close()
 *     elif from_file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
 */
  __pyx_t_1 = (__pyx_v_from_file != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":898
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/serializer.pxi":899
 *     elif from_file is not None:
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult:
 *             pass
 */
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_from_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), Py_None)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 899, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":898
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
 */
      }
      __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_L16_try_end;
      __pyx_L11_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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":900
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
      __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 900, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_5, __pyx_t_4);
      __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0;
      if (__pyx_t_6) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;

      /* "src/lxml/serializer.pxi":898
 *         parser.close()
 *     elif from_file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             _parseDocument(from_file, parser, base_url=None)
 *         except _TargetParserResult:
 */
      __pyx_L13_except_error:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L12_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_L16_try_end:;
    }

    /* "src/lxml/serializer.pxi":897
 *         parser.feed(xml_data)
 *         parser.close()
 *     elif from_file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             _parseDocument(from_file, parser, base_url=None)
 */
  }
  __pyx_L10:;

  /* "src/lxml/serializer.pxi":903
 *             pass
 * 
 *     return sio.getvalue() if sio is not None else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_sio != Py_None);
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sio, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_4 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_4 = Py_None;
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":862
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
 */

  /* 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_8);
  __Pyx_AddTraceback("lxml.etree.canonicalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sio);
  __Pyx_XDECREF((PyObject *)__pyx_v_target);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":906
 * 
 * 
 * cdef _tree_to_target(element, target):             # <<<<<<<<<<<<<<
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
 */

static PyObject *__pyx_f_4lxml_5etree__tree_to_target(PyObject *__pyx_v_element, PyObject *__pyx_v_target) {
  PyObject *__pyx_v_event = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_v_text = 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)(PyObject *);
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tree_to_target", 1);

  /* "src/lxml/serializer.pxi":907
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_element);
  __Pyx_GIVEREF(__pyx_v_element);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_element)) __PYX_ERR(10, 907, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_events, __pyx_tuple__65) < 0) __PYX_ERR(10, 907, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_iterwalk), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 907, __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(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_ERR(10, 907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 907, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 907, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 907, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 907, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 907, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 907, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 907, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(10, 907, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 907, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 907, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 907, __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_ERR(10, 907, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      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_ERR(10, 907, __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_ERR(10, 907, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":908
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_XDECREF_SET(__pyx_v_text, Py_None);

    /* "src/lxml/serializer.pxi":909
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 909, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":910
 *         text = None
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)             # <<<<<<<<<<<<<<
 *             text = elem.text
 *         elif event == 'end':
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_start); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_attrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_1, __pyx_t_7};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 2+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 910, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":911
 *         if event == 'start':
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text             # <<<<<<<<<<<<<<
 *         elif event == 'end':
 *             target.end(elem.tag)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":909
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = None
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 */
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":912
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             target.end(elem.tag)
 *             text = elem.tail
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_end, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 912, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":913
 *             text = elem.text
 *         elif event == 'end':
 *             target.end(elem.tag)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         elif event == 'start-ns':
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_end); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 913, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":914
 *         elif event == 'end':
 *             target.end(elem.tag)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":912
 *             target.start(elem.tag, elem.attrib)
 *             text = elem.text
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             target.end(elem.tag)
 *             text = elem.tail
 */
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":915
 *             target.end(elem.tag)
 *             text = elem.tail
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             target.start_ns(*elem)
 *             continue
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 915, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":916
 *             text = elem.tail
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)             # <<<<<<<<<<<<<<
 *             continue
 *         elif event == 'comment':
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_start_ns_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_v_elem); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":917
 *         elif event == 'start-ns':
 *             target.start_ns(*elem)
 *             continue             # <<<<<<<<<<<<<<
 *         elif event == 'comment':
 *             target.comment(elem.text)
 */
      goto __pyx_L3_continue;

      /* "src/lxml/serializer.pxi":915
 *             target.end(elem.tag)
 *             text = elem.tail
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             target.start_ns(*elem)
 *             continue
 */
    }

    /* "src/lxml/serializer.pxi":918
 *             target.start_ns(*elem)
 *             continue
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             target.comment(elem.text)
 *             text = elem.tail
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_comment, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 918, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":919
 *             continue
 *         elif event == 'comment':
 *             target.comment(elem.text)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         elif event == 'pi':
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_comment); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 919, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 919, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 919, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":920
 *         elif event == 'comment':
 *             target.comment(elem.text)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tail); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":918
 *             target.start_ns(*elem)
 *             continue
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             target.comment(elem.text)
 *             text = elem.tail
 */
      goto __pyx_L7;
    }

    /* "src/lxml/serializer.pxi":921
 *             target.comment(elem.text)
 *             text = elem.tail
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_pi, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 921, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":922
 *             text = elem.tail
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)             # <<<<<<<<<<<<<<
 *             text = elem.tail
 *         if text:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_target); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_1};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 2+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 922, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":923
 *         elif event == 'pi':
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail             # <<<<<<<<<<<<<<
 *         if text:
 *             target.data(text)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tail); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":921
 *             target.comment(elem.text)
 *             text = elem.tail
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 */
    }
    __pyx_L7:;

    /* "src/lxml/serializer.pxi":924
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 *         if text:             # <<<<<<<<<<<<<<
 *             target.data(text)
 *     return target.close()
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(10, 924, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "src/lxml/serializer.pxi":925
 *             text = elem.tail
 *         if text:
 *             target.data(text)             # <<<<<<<<<<<<<<
 *     return target.close()
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_text};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":924
 *             target.pi(elem.target, elem.text)
 *             text = elem.tail
 *         if text:             # <<<<<<<<<<<<<<
 *             target.data(text)
 *     return target.close()
 */
    }

    /* "src/lxml/serializer.pxi":907
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":926
 *         if text:
 *             target.data(text)
 *     return target.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_close); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = NULL;
  __pyx_t_11 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_11 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":906
 * 
 * 
 * cdef _tree_to_target(element, target):             # <<<<<<<<<<<<<<
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):
 *         text = 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._tree_to_target", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":968
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_write = 0;
  PyObject *__pyx_v_with_comments = 0;
  PyObject *__pyx_v_strip_text = 0;
  PyObject *__pyx_v_rewrite_prefixes = 0;
  PyObject *__pyx_v_qname_aware_tags = 0;
  PyObject *__pyx_v_qname_aware_attrs = 0;
  PyObject *__pyx_v_exclude_attrs = 0;
  PyObject *__pyx_v_exclude_tags = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_write,&__pyx_n_s_with_comments,&__pyx_n_s_strip_text,&__pyx_n_s_rewrite_prefixes,&__pyx_n_s_qname_aware_tags,&__pyx_n_s_qname_aware_attrs,&__pyx_n_s_exclude_attrs,&__pyx_n_s_exclude_tags,0};

    /* "src/lxml/serializer.pxi":969
 * 
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,             # <<<<<<<<<<<<<<
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):
 */
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/serializer.pxi":970
 *     def __init__(self, write, *,
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,             # <<<<<<<<<<<<<<
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write
 */
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[5] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/serializer.pxi":971
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):             # <<<<<<<<<<<<<<
 *         self._write = write
 *         self._data = []
 */
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[7] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_write)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 968, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 7)) {
        Py_ssize_t index;
        for (index = 1; index < 8 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 968, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(10, 968, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_write = values[0];
    __pyx_v_with_comments = values[1];
    __pyx_v_strip_text = values[2];
    __pyx_v_rewrite_prefixes = values[3];
    __pyx_v_qname_aware_tags = values[4];
    __pyx_v_qname_aware_attrs = values[5];
    __pyx_v_exclude_attrs = values[6];
    __pyx_v_exclude_tags = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 968, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_write, __pyx_v_with_comments, __pyx_v_strip_text, __pyx_v_rewrite_prefixes, __pyx_v_qname_aware_tags, __pyx_v_qname_aware_attrs, __pyx_v_exclude_attrs, __pyx_v_exclude_tags);

  /* "src/lxml/serializer.pxi":968
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16C14NWriterTarget___init__(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_write, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_strip_text, PyObject *__pyx_v_rewrite_prefixes, PyObject *__pyx_v_qname_aware_tags, PyObject *__pyx_v_qname_aware_attrs, PyObject *__pyx_v_exclude_attrs, PyObject *__pyx_v_exclude_tags) {
  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("__init__", 1);

  /* "src/lxml/serializer.pxi":972
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write             # <<<<<<<<<<<<<<
 *         self._data = []
 *         self._with_comments = with_comments
 */
  __Pyx_INCREF(__pyx_v_write);
  __Pyx_GIVEREF(__pyx_v_write);
  __Pyx_GOTREF(__pyx_v_self->_write);
  __Pyx_DECREF(__pyx_v_self->_write);
  __pyx_v_self->_write = __pyx_v_write;

  /* "src/lxml/serializer.pxi":973
 *                  exclude_attrs=None, exclude_tags=None):
 *         self._write = write
 *         self._data = []             # <<<<<<<<<<<<<<
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 973, __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;

  /* "src/lxml/serializer.pxi":974
 *         self._write = write
 *         self._data = []
 *         self._with_comments = with_comments             # <<<<<<<<<<<<<<
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 974, __pyx_L1_error)
  __pyx_v_self->_with_comments = __pyx_t_2;

  /* "src/lxml/serializer.pxi":975
 *         self._data = []
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text             # <<<<<<<<<<<<<<
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_text); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 975, __pyx_L1_error)
  __pyx_v_self->_strip_text = __pyx_t_2;

  /* "src/lxml/serializer.pxi":976
 *         self._with_comments = with_comments
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None             # <<<<<<<<<<<<<<
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_exclude_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 976, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = PySet_New(__pyx_v_exclude_attrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 976, __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;
  }
  if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_1))) __PYX_ERR(10, 976, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exclude_attrs);
  __Pyx_DECREF(__pyx_v_self->_exclude_attrs);
  __pyx_v_self->_exclude_attrs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":977
 *         self._strip_text = strip_text
 *         self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None             # <<<<<<<<<<<<<<
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_exclude_tags); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 977, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = PySet_New(__pyx_v_exclude_tags); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 977, __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;
  }
  if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_1))) __PYX_ERR(10, 977, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exclude_tags);
  __Pyx_DECREF(__pyx_v_self->_exclude_tags);
  __pyx_v_self->_exclude_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":979
 *         self._exclude_tags = set(exclude_tags) if exclude_tags else None
 * 
 *         self._rewrite_prefixes = rewrite_prefixes             # <<<<<<<<<<<<<<
 *         if qname_aware_tags:
 *             self._qname_aware_tags = set(qname_aware_tags)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rewrite_prefixes); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 979, __pyx_L1_error)
  __pyx_v_self->_rewrite_prefixes = __pyx_t_2;

  /* "src/lxml/serializer.pxi":980
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:             # <<<<<<<<<<<<<<
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_qname_aware_tags); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 980, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":981
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:
 *             self._qname_aware_tags = set(qname_aware_tags)             # <<<<<<<<<<<<<<
 *         else:
 *             self._qname_aware_tags = None
 */
    __pyx_t_1 = PySet_New(__pyx_v_qname_aware_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_qname_aware_tags);
    __Pyx_DECREF(__pyx_v_self->_qname_aware_tags);
    __pyx_v_self->_qname_aware_tags = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":980
 * 
 *         self._rewrite_prefixes = rewrite_prefixes
 *         if qname_aware_tags:             # <<<<<<<<<<<<<<
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":983
 *             self._qname_aware_tags = set(qname_aware_tags)
 *         else:
 *             self._qname_aware_tags = None             # <<<<<<<<<<<<<<
 *         if qname_aware_attrs:
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_qname_aware_tags);
    __Pyx_DECREF(__pyx_v_self->_qname_aware_tags);
    __pyx_v_self->_qname_aware_tags = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":984
 *         else:
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:             # <<<<<<<<<<<<<<
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_qname_aware_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 984, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":985
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection             # <<<<<<<<<<<<<<
 *         else:
 *             self._find_qname_aware_attrs = None
 */
    __pyx_t_1 = PySet_New(__pyx_v_qname_aware_attrs); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intersection); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 985, __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->_find_qname_aware_attrs);
    __Pyx_DECREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_v_self->_find_qname_aware_attrs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":984
 *         else:
 *             self._qname_aware_tags = None
 *         if qname_aware_attrs:             # <<<<<<<<<<<<<<
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":987
 *             self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
 *         else:
 *             self._find_qname_aware_attrs = None             # <<<<<<<<<<<<<<
 * 
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_find_qname_aware_attrs);
    __Pyx_DECREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_v_self->_find_qname_aware_attrs = Py_None;
  }
  __pyx_L4:;

  /* "src/lxml/serializer.pxi":990
 * 
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
 *         self._declared_ns_stack = [[             # <<<<<<<<<<<<<<
 *             ("http://www.w3.org/XML/1998/namespace", "xml"),
 *         ]]
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_tuple__66)) __PYX_ERR(10, 990, __pyx_L1_error);
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(10, 990, __pyx_L1_error);
  __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_declared_ns_stack);
  __Pyx_DECREF(__pyx_v_self->_declared_ns_stack);
  __pyx_v_self->_declared_ns_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":994
 *         ]]
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []             # <<<<<<<<<<<<<<
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 994, __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;

  /* "src/lxml/serializer.pxi":995
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []
 *         if not rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rewrite_prefixes); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 995, __pyx_L1_error)
  __pyx_t_4 = (!__pyx_t_2);
  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":996
 *         self._ns_stack = []
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)             # <<<<<<<<<<<<<<
 *         self._ns_stack.append([])
 *         self._prefix_map = {}
 */
    if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 996, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(10, 996, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":995
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 *         self._ns_stack = []
 *         if not rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
 */
  }

  /* "src/lxml/serializer.pxi":997
 *         if not rewrite_prefixes:
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])             # <<<<<<<<<<<<<<
 *         self._prefix_map = {}
 *         self._preserve_space = [False]
 */
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(10, 997, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(10, 997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":998
 *             self._ns_stack.append(_DEFAULT_NAMESPACE_PREFIXES_ITEMS)
 *         self._ns_stack.append([])
 *         self._prefix_map = {}             # <<<<<<<<<<<<<<
 *         self._preserve_space = [False]
 *         self._pending_start = None
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_prefix_map);
  __Pyx_DECREF(__pyx_v_self->_prefix_map);
  __pyx_v_self->_prefix_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":999
 *         self._ns_stack.append([])
 *         self._prefix_map = {}
 *         self._preserve_space = [False]             # <<<<<<<<<<<<<<
 *         self._pending_start = None
 *         self._ignored_depth = 0
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_False)) __PYX_ERR(10, 999, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_preserve_space);
  __Pyx_DECREF(__pyx_v_self->_preserve_space);
  __pyx_v_self->_preserve_space = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1000
 *         self._prefix_map = {}
 *         self._preserve_space = [False]
 *         self._pending_start = None             # <<<<<<<<<<<<<<
 *         self._ignored_depth = 0
 *         self._root_seen = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_pending_start);
  __Pyx_DECREF(__pyx_v_self->_pending_start);
  __pyx_v_self->_pending_start = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":1001
 *         self._preserve_space = [False]
 *         self._pending_start = None
 *         self._ignored_depth = 0             # <<<<<<<<<<<<<<
 *         self._root_seen = False
 *         self._root_done = False
 */
  __pyx_v_self->_ignored_depth = 0;

  /* "src/lxml/serializer.pxi":1002
 *         self._pending_start = None
 *         self._ignored_depth = 0
 *         self._root_seen = False             # <<<<<<<<<<<<<<
 *         self._root_done = False
 * 
 */
  __pyx_v_self->_root_seen = 0;

  /* "src/lxml/serializer.pxi":1003
 *         self._ignored_depth = 0
 *         self._root_seen = False
 *         self._root_done = False             # <<<<<<<<<<<<<<
 * 
 *     def _iter_namespaces(self, ns_stack):
 */
  __pyx_v_self->_root_done = 0;

  /* "src/lxml/serializer.pxi":968
 *     cdef bint _root_done
 * 
 *     def __init__(self, write, *,             # <<<<<<<<<<<<<<
 *                  with_comments=False, strip_text=False, rewrite_prefixes=False,
 *                  qname_aware_tags=None, qname_aware_attrs=None,
 */

  /* 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.C14NWriterTarget.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1005
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces = {"_iter_namespaces", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ns_stack = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iter_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns_stack,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ns_stack)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1005, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_iter_namespaces") < 0)) __PYX_ERR(10, 1005, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_ns_stack = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_iter_namespaces", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1005, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_ns_stack);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_2_iter_namespaces(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_ns_stack) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iter_namespaces", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1005, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_ns_stack = __pyx_v_ns_stack;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ns_stack);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ns_stack);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1, __pyx_codeobj__67, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter_namespaces, __pyx_n_s_C14NWriterTarget__iter_namespace, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1005, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_16C14NWriterTarget_4generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iter_namespaces", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1005, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1006
 * 
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):             # <<<<<<<<<<<<<<
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_reversed, __pyx_cur_scope->__pyx_v_ns_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1006, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1006, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 1006, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1006, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1006, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 1006, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1006, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(10, 1006, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_namespaces);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_namespaces, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1007
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces             # <<<<<<<<<<<<<<
 *                 yield from namespaces
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_namespaces); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(10, 1007, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "src/lxml/serializer.pxi":1008
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces             # <<<<<<<<<<<<<<
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
 */
      __pyx_r = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_namespaces);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_t_2);
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L7_resume_from_yield_from:;
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
        __pyx_cur_scope->__pyx_t_0 = 0;
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1008, __pyx_L1_error)
      } else {
        PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
          else __PYX_ERR(10, 1008, __pyx_L1_error)
        }
      }

      /* "src/lxml/serializer.pxi":1007
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces             # <<<<<<<<<<<<<<
 *                 yield from namespaces
 * 
 */
    }

    /* "src/lxml/serializer.pxi":1006
 * 
 *     def _iter_namespaces(self, ns_stack):
 *         for namespaces in reversed(ns_stack):             # <<<<<<<<<<<<<<
 *             if namespaces:  # almost no element declares new namespaces
 *                 yield from namespaces
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1005
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_iter_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1010
 *                 yield from namespaces
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):             # <<<<<<<<<<<<<<
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 */

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefixed_name) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_UCS4 __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_resolve_prefix_name", 1);

  /* "src/lxml/serializer.pxi":1011
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)             # <<<<<<<<<<<<<<
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefixed_name, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 1011, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    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_ERR(10, 1011, __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_ERR(10, 1011, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_prefix = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1012
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iter_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_self->_ns_stack};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1012, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1012, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1012, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1012, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(10, 1012, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1012, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1012, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(10, 1012, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1012, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(10, 1012, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1012, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_9), 2) < 0) __PYX_ERR(10, 1012, __pyx_L1_error)
      __pyx_t_5 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_5 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(10, 1012, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1013
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:             # <<<<<<<<<<<<<<
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_p, __pyx_v_prefix, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1013, __pyx_L1_error)
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(10, 1013, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_10) {

      /* "src/lxml/serializer.pxi":1014
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = 0;
      __pyx_t_12 = 127;
      __Pyx_INCREF(__pyx_kp_u__18);
      __pyx_t_11 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__18);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__18);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_uri, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
      __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u__19);
      __pyx_t_11 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__19);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__19);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
      __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1014, __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;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1013
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:             # <<<<<<<<<<<<<<
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 */
    }

    /* "src/lxml/serializer.pxi":1012
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1015
 *             if p == prefix:
 *                 return f'{{{uri}}}{name}'
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')             # <<<<<<<<<<<<<<
 * 
 *     cdef _qname(self, qname, uri=None):
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = 0;
  __pyx_t_12 = 127;
  __Pyx_INCREF(__pyx_kp_u_Prefix);
  __pyx_t_7 += 7;
  __Pyx_GIVEREF(__pyx_kp_u_Prefix);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Prefix);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_of_QName);
  __pyx_t_7 += 11;
  __Pyx_GIVEREF(__pyx_kp_u_of_QName);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_of_QName);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_prefixed_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_is_not_declared_in_scope);
  __pyx_t_7 += 26;
  __Pyx_GIVEREF(__pyx_kp_u_is_not_declared_in_scope);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_is_not_declared_in_scope);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_7, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(10, 1015, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1010
 *                 yield from namespaces
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):             # <<<<<<<<<<<<<<
 *         prefix, name = prefixed_name.split(':', 1)
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 */

  /* 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_9);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._resolve_prefix_name", __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_uri);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1017
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 */

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__qname(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_qname, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args) {
  PyObject *__pyx_v_uri = ((PyObject *)Py_None);
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_prefixes_seen = NULL;
  PyObject *__pyx_v_u = 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)(PyObject *);
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_UCS4 __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("_qname", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_uri = __pyx_optional_args->uri;
    }
  }
  __Pyx_INCREF(__pyx_v_uri);

  /* "src/lxml/serializer.pxi":1018
 * 
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:             # <<<<<<<<<<<<<<
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_uri == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1019
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)             # <<<<<<<<<<<<<<
 *         else:
 *             tag = qname
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_qname, 0, 1, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u__18, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1019, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_qname, 1, 0, NULL, NULL, &__pyx_slice__69, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rsplit); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_kp_u__12);
      __Pyx_GIVEREF(__pyx_kp_u__12);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__12)) __PYX_ERR(10, 1019, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_qname);
      __Pyx_GIVEREF(__pyx_v_qname);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_qname)) __PYX_ERR(10, 1019, __pyx_L1_error);
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1019, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(10, 1019, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(10, 1019, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_uri, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_tag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1018
 * 
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:             # <<<<<<<<<<<<<<
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/serializer.pxi":1021
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 *         else:
 *             tag = qname             # <<<<<<<<<<<<<<
 * 
 *         prefixes_seen = set()
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_qname);
    __pyx_v_tag = __pyx_v_qname;
  }
  __pyx_L3:;

  /* "src/lxml/serializer.pxi":1023
 *             tag = qname
 * 
 *         prefixes_seen = set()             # <<<<<<<<<<<<<<
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefixes_seen = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1024
 * 
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iter_namespaces); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_self->_declared_ns_stack};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1024, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1024, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(10, 1024, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1024, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1024, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(10, 1024, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1024, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_9(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(10, 1024, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1024, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_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_ERR(10, 1024, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1024, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 1024, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_10), 2) < 0) __PYX_ERR(10, 1024, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(10, 1024, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":1025
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_u, __pyx_v_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1025, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(10, 1025, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_v_prefix, __pyx_v_prefixes_seen, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(10, 1025, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_11;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1026
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri             # <<<<<<<<<<<<<<
 *             prefixes_seen.add(prefix)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1026, __pyx_L1_error)
      if (__pyx_t_1) {
        __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1026, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = 0;
        __pyx_t_13 = 127;
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1026, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13;
        __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(__pyx_kp_u__17);
        __pyx_t_12 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__17);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u__17);
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1026, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13;
        __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1026, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(__pyx_v_tag);
        __pyx_t_2 = __pyx_v_tag;
      }
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1026, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(10, 1026, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_tag);
      __Pyx_GIVEREF(__pyx_v_tag);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag)) __PYX_ERR(10, 1026, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_uri)) __PYX_ERR(10, 1026, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1025
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):
 *             if u == uri and prefix not in prefixes_seen:             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)
 */
    }

    /* "src/lxml/serializer.pxi":1027
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 *             prefixes_seen.add(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # Not declared yet => add new declaration.
 */
    __pyx_t_14 = PySet_Add(__pyx_v_prefixes_seen, __pyx_v_prefix); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(10, 1027, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1024
 * 
 *         prefixes_seen = set()
 *         for u, prefix in self._iter_namespaces(self._declared_ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri and prefix not in prefixes_seen:
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1030
 * 
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]
 */
  if (__pyx_v_self->_rewrite_prefixes) {

    /* "src/lxml/serializer.pxi":1031
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:             # <<<<<<<<<<<<<<
 *                 prefix = self._prefix_map[uri]
 *             else:
 */
    if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(10, 1031, __pyx_L1_error)
    }
    __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_uri, __pyx_v_self->_prefix_map, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1031, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1032
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
 */
      if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(10, 1032, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_self->_prefix_map, __pyx_v_uri); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1032, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1031
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:
 *             if uri in self._prefix_map:             # <<<<<<<<<<<<<<
 *                 prefix = self._prefix_map[uri]
 *             else:
 */
      goto __pyx_L15;
    }

    /* "src/lxml/serializer.pxi":1034
 *                 prefix = self._prefix_map[uri]
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'             # <<<<<<<<<<<<<<
 *             self._declared_ns_stack[-1].append((uri, prefix))
 *             return f'{prefix}:{tag}', tag, uri
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_self->_prefix_map;
      __Pyx_INCREF(__pyx_t_4);
      if (unlikely(__pyx_t_4 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(10, 1034, __pyx_L1_error)
      }
      __pyx_t_8 = PyDict_Size(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1034, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_8, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_n_u_n, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_3);
      if (unlikely(__pyx_v_self->_prefix_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(10, 1034, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_prefix_map, __pyx_v_uri, __pyx_t_3) < 0))) __PYX_ERR(10, 1034, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L15:;

    /* "src/lxml/serializer.pxi":1035
 *             else:
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
 *             self._declared_ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 *             return f'{prefix}:{tag}', tag, uri
 * 
 */
    if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(10, 1035, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_self->_declared_ns_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_uri)) __PYX_ERR(10, 1035, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_prefix);
    __Pyx_GIVEREF(__pyx_v_prefix);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_prefix)) __PYX_ERR(10, 1035, __pyx_L1_error);
    __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(10, 1035, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1036
 *                 prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
 *             self._declared_ns_stack[-1].append((uri, prefix))
 *             return f'{prefix}:{tag}', tag, uri             # <<<<<<<<<<<<<<
 * 
 *         if not uri and '' not in prefixes_seen:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_13 = 127;
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_kp_u__17);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__17);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__17);
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(10, 1036, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tag)) __PYX_ERR(10, 1036, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_uri)) __PYX_ERR(10, 1036, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1030
 * 
 *         # Not declared yet => add new declaration.
 *         if self._rewrite_prefixes:             # <<<<<<<<<<<<<<
 *             if uri in self._prefix_map:
 *                 prefix = self._prefix_map[uri]
 */
  }

  /* "src/lxml/serializer.pxi":1038
 *             return f'{prefix}:{tag}', tag, uri
 * 
 *         if not uri and '' not in prefixes_seen:             # <<<<<<<<<<<<<<
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri
 */
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(10, 1038, __pyx_L1_error)
  __pyx_t_15 = (!__pyx_t_11);
  if (__pyx_t_15) {
  } else {
    __pyx_t_1 = __pyx_t_15;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_15 = (__Pyx_PySet_ContainsTF(__pyx_kp_u__12, __pyx_v_prefixes_seen, Py_NE)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(10, 1038, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_15;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1040
 *         if not uri and '' not in prefixes_seen:
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_tag)) __PYX_ERR(10, 1040, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tag)) __PYX_ERR(10, 1040, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_uri)) __PYX_ERR(10, 1040, __pyx_L1_error);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1038
 *             return f'{prefix}:{tag}', tag, uri
 * 
 *         if not uri and '' not in prefixes_seen:             # <<<<<<<<<<<<<<
 *             # No default namespace declared => no prefix needed.
 *             return tag, tag, uri
 */
  }

  /* "src/lxml/serializer.pxi":1042
 *             return tag, tag, uri
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iter_namespaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->_ns_stack};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1042, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1042, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(10, 1042, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1042, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(10, 1042, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(10, 1042, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1042, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 1042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_10), 2) < 0) __PYX_ERR(10, 1042, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L22_unpacking_done;
      __pyx_L21_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(10, 1042, __pyx_L1_error)
      __pyx_L22_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/serializer.pxi":1043
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:             # <<<<<<<<<<<<<<
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_u, __pyx_v_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1043, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1043, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1044
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
 */
      if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(10, 1044, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_declared_ns_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_uri)) __PYX_ERR(10, 1044, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_prefix)) __PYX_ERR(10, 1044, __pyx_L1_error);
      __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(10, 1044, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/serializer.pxi":1045
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         if not uri:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1045, __pyx_L1_error)
      if (__pyx_t_1) {
        __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_12 = 0;
        __pyx_t_13 = 127;
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_prefix, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13;
        __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_INCREF(__pyx_kp_u__17);
        __pyx_t_12 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__17);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__17);
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13;
        __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __pyx_t_2;
        __pyx_t_2 = 0;
      } else {
        __Pyx_INCREF(__pyx_v_tag);
        __pyx_t_5 = __pyx_v_tag;
      }
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5)) __PYX_ERR(10, 1045, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_tag);
      __Pyx_GIVEREF(__pyx_v_tag);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_tag)) __PYX_ERR(10, 1045, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_uri)) __PYX_ERR(10, 1045, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1043
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):
 *             if u == uri:             # <<<<<<<<<<<<<<
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 */
    }

    /* "src/lxml/serializer.pxi":1042
 *             return tag, tag, uri
 * 
 *         for u, prefix in self._iter_namespaces(self._ns_stack):             # <<<<<<<<<<<<<<
 *             if u == uri:
 *                 self._declared_ns_stack[-1].append((uri, prefix))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1047
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
 *         if not uri:             # <<<<<<<<<<<<<<
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1047, __pyx_L1_error)
  __pyx_t_15 = (!__pyx_t_1);
  if (__pyx_t_15) {

    /* "src/lxml/serializer.pxi":1050
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
 *             return tag, tag, uri             # <<<<<<<<<<<<<<
 * 
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(10, 1050, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag)) __PYX_ERR(10, 1050, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_uri);
    __Pyx_GIVEREF(__pyx_v_uri);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_uri)) __PYX_ERR(10, 1050, __pyx_L1_error);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1047
 *                 return f'{prefix}:{tag}' if prefix else tag, tag, uri
 * 
 *         if not uri:             # <<<<<<<<<<<<<<
 *             # As soon as a default namespace is defined,
 *             # anything that has no namespace (and thus, no prefix) goes there.
 */
  }

  /* "src/lxml/serializer.pxi":1052
 *             return tag, tag, uri
 * 
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')             # <<<<<<<<<<<<<<
 * 
 *     def data(self, data):
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = 0;
  __pyx_t_13 = 127;
  __Pyx_INCREF(__pyx_kp_u_Namespace);
  __pyx_t_8 += 11;
  __Pyx_GIVEREF(__pyx_kp_u_Namespace);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Namespace);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_uri, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13;
  __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_kp_u_of_name);
  __pyx_t_8 += 11;
  __Pyx_GIVEREF(__pyx_kp_u_of_name);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_of_name);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_tag, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_13;
  __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_kp_u_is_not_declared_in_scope);
  __pyx_t_8 += 26;
  __Pyx_GIVEREF(__pyx_kp_u_is_not_declared_in_scope);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_is_not_declared_in_scope);
  __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_8, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1052, __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_ERR(10, 1052, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1017
 *         raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')
 * 
 *     cdef _qname(self, qname, uri=None):             # <<<<<<<<<<<<<<
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_prefixes_seen);
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1054
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_6data = {"data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1054, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "data") < 0)) __PYX_ERR(10, 1054, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1054, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_5data(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  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("data", 1);

  /* "src/lxml/serializer.pxi":1055
 * 
 *     def data(self, data):
 *         if not self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._data.append(data)
 * 
 */
  __pyx_t_1 = (!(__pyx_v_self->_ignored_depth != 0));
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1056
 *     def data(self, data):
 *         if not self._ignored_depth:
 *             self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _flush(self):
 */
    if (unlikely(__pyx_v_self->_data == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 1056, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(10, 1056, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1055
 * 
 *     def data(self, data):
 *         if not self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._data.append(data)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1054
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1058
 *             self._data.append(data)
 * 
 *     cdef _flush(self):             # <<<<<<<<<<<<<<
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
 */

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__flush(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_attrs = NULL;
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_qname_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 1);

  /* "src/lxml/serializer.pxi":1059
 * 
 *     cdef _flush(self):
 *         cdef unicode data = ''.join(self._data)             # <<<<<<<<<<<<<<
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:
 */
  __pyx_t_1 = __pyx_v_self->_data;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__12, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_data = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1060
 *     cdef _flush(self):
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]             # <<<<<<<<<<<<<<
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
 */
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(10, 1060, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(10, 1060, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1061
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:             # <<<<<<<<<<<<<<
 *             data = data.strip()
 *         if self._pending_start is not None:
 */
  if (__pyx_v_self->_strip_text) {
  } else {
    __pyx_t_3 = __pyx_v_self->_strip_text;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(10, 1061, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_preserve_space, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(10, 1061, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1062
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()             # <<<<<<<<<<<<<<
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 */
    __pyx_t_2 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyUnicode_Type_strip, __pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_2))) __PYX_ERR(10, 1062, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_data, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1061
 *         cdef unicode data = ''.join(self._data)
 *         del self._data[:]
 *         if self._strip_text and not self._preserve_space[-1]:             # <<<<<<<<<<<<<<
 *             data = data.strip()
 *         if self._pending_start is not None:
 */
  }

  /* "src/lxml/serializer.pxi":1063
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
 *         if self._pending_start is not None:             # <<<<<<<<<<<<<<
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 */
  __pyx_t_3 = (__pyx_v_self->_pending_start != ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1064
 *             data = data.strip()
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None             # <<<<<<<<<<<<<<
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
 */
    __pyx_t_2 = __pyx_v_self->_pending_start;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = Py_None;
    __Pyx_INCREF(__pyx_t_1);
    if (likely(__pyx_t_2 != Py_None)) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1064, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyTuple_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_ERR(10, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 1064, __pyx_L1_error)
    }
    __pyx_v_tag = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_attrs = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_new_namespaces = __pyx_t_8;
    __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_pending_start);
    __Pyx_DECREF(__pyx_v_self->_pending_start);
    __pyx_v_self->_pending_start = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1065
 *         if self._pending_start is not None:
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None             # <<<<<<<<<<<<<<
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:
 */
    if (unlikely(__pyx_v_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(10, 1065, __pyx_L1_error)
    }
    __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_kp_u__17, __pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(10, 1065, __pyx_L1_error)
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
    __pyx_t_8 = __pyx_v_4lxml_5etree__looks_like_prefix_name; __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_data};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(10, 1065, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_5;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_v_data);
      __pyx_t_1 = __pyx_v_data;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    }
    __pyx_v_qname_text = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1066
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)             # <<<<<<<<<<<<<<
 *             if qname_text is not None:
 *                 return
 */
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.qname_text = __pyx_v_qname_text;
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_start(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_new_namespaces, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1067
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:             # <<<<<<<<<<<<<<
 *                 return
 *         if data and self._root_seen:
 */
    __pyx_t_3 = (__pyx_v_qname_text != Py_None);
    if (__pyx_t_3) {

      /* "src/lxml/serializer.pxi":1068
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:
 *                 return             # <<<<<<<<<<<<<<
 *         if data and self._root_seen:
 *             self._write(_escape_cdata_c14n(data))
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "src/lxml/serializer.pxi":1067
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 *             self._start(tag, attrs, new_namespaces, qname_text)
 *             if qname_text is not None:             # <<<<<<<<<<<<<<
 *                 return
 *         if data and self._root_seen:
 */
    }

    /* "src/lxml/serializer.pxi":1063
 *         if self._strip_text and not self._preserve_space[-1]:
 *             data = data.strip()
 *         if self._pending_start is not None:             # <<<<<<<<<<<<<<
 *             (tag, attrs, new_namespaces), self._pending_start = self._pending_start, None
 *             qname_text = data if ':' in data and _looks_like_prefix_name(data) else None
 */
  }

  /* "src/lxml/serializer.pxi":1069
 *             if qname_text is not None:
 *                 return
 *         if data and self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write(_escape_cdata_c14n(data))
 * 
 */
  __pyx_t_5 = (__pyx_v_data != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_data) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_3 = __pyx_v_self->_root_seen;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1070
 *                 return
 *         if data and self._root_seen:
 *             self._write(_escape_cdata_c14n(data))             # <<<<<<<<<<<<<<
 * 
 *     def start_ns(self, prefix, uri):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_8 = __pyx_v_self->_write; __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1070, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1069
 *             if qname_text is not None:
 *                 return
 *         if data and self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write(_escape_cdata_c14n(data))
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1058
 *             self._data.append(data)
 * 
 *     cdef _flush(self):             # <<<<<<<<<<<<<<
 *         cdef unicode data = ''.join(self._data)
 *         del 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_qname_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1072
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_8start_ns = {"start_ns", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_ns (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_prefix)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1072, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1072, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("start_ns", 1, 2, 2, 1); __PYX_ERR(10, 1072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "start_ns") < 0)) __PYX_ERR(10, 1072, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start_ns", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 1072, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start_ns", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_prefix, __pyx_v_uri);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_7start_ns(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  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("start_ns", 1);

  /* "src/lxml/serializer.pxi":1073
 * 
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         # we may have to resolve qnames in text content
 */
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1074
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         # we may have to resolve qnames in text content
 *         if self._data:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1073
 * 
 *     def start_ns(self, prefix, uri):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         # we may have to resolve qnames in text content
 */
  }

  /* "src/lxml/serializer.pxi":1076
 *             return
 *         # we may have to resolve qnames in text content
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1077
 *         # we may have to resolve qnames in text content
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1076
 *             return
 *         # we may have to resolve qnames in text content
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))
 */
  }

  /* "src/lxml/serializer.pxi":1078
 *         if self._data:
 *             self._flush()
 *         self._ns_stack[-1].append((uri, prefix))             # <<<<<<<<<<<<<<
 * 
 *     def start(self, tag, attrs):
 */
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(10, 1078, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_ns_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_uri);
  __Pyx_GIVEREF(__pyx_v_uri);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_uri)) __PYX_ERR(10, 1078, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_prefix)) __PYX_ERR(10, 1078, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 1078, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1072
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */

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

/* "src/lxml/serializer.pxi":1080
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_10start = {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrs,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1080, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrs)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1080, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("start", 1, 2, 2, 1); __PYX_ERR(10, 1080, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "start") < 0)) __PYX_ERR(10, 1080, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrs = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 1080, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_9start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs) {
  PyObject *__pyx_v_new_namespaces = 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("start", 1);

  /* "src/lxml/serializer.pxi":1081
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
 */
  __pyx_t_2 = (__pyx_v_self->_exclude_tags != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/serializer.pxi":1082
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):             # <<<<<<<<<<<<<<
 *             self._ignored_depth += 1
 *             return
 */
  __pyx_t_2 = (__pyx_v_self->_ignored_depth != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_exclude_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(10, 1082, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_self->_exclude_tags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1082, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/serializer.pxi":1081
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
 */
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1083
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1             # <<<<<<<<<<<<<<
 *             return
 *         if self._data:
 */
    __pyx_v_self->_ignored_depth = (__pyx_v_self->_ignored_depth + 1);

    /* "src/lxml/serializer.pxi":1084
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
 *             return             # <<<<<<<<<<<<<<
 *         if self._data:
 *             self._flush()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1081
 * 
 *     def start(self, tag, attrs):
 *         if self._exclude_tags is not None and (             # <<<<<<<<<<<<<<
 *                 self._ignored_depth or tag in self._exclude_tags):
 *             self._ignored_depth += 1
 */
  }

  /* "src/lxml/serializer.pxi":1085
 *             self._ignored_depth += 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1086
 *             return
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 * 
 *         new_namespaces = []
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1085
 *             self._ignored_depth += 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1088
 *             self._flush()
 * 
 *         new_namespaces = []             # <<<<<<<<<<<<<<
 *         self._declared_ns_stack.append(new_namespaces)
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_new_namespaces = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1089
 * 
 *         new_namespaces = []
 *         self._declared_ns_stack.append(new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:
 */
  if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(10, 1089, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_declared_ns_stack, __pyx_v_new_namespaces); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 1089, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1091
 *         self._declared_ns_stack.append(new_namespaces)
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:             # <<<<<<<<<<<<<<
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
 */
  __pyx_t_2 = (__pyx_v_self->_qname_aware_tags != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_qname_aware_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(10, 1091, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_tag, __pyx_v_self->_qname_aware_tags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1091, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1093
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)             # <<<<<<<<<<<<<<
 *             return
 *         self._start(tag, attrs, new_namespaces)
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag)) __PYX_ERR(10, 1093, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_attrs);
    __Pyx_GIVEREF(__pyx_v_attrs);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_attrs)) __PYX_ERR(10, 1093, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_new_namespaces);
    __Pyx_GIVEREF(__pyx_v_new_namespaces);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_new_namespaces)) __PYX_ERR(10, 1093, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_pending_start);
    __Pyx_DECREF(__pyx_v_self->_pending_start);
    __pyx_v_self->_pending_start = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1094
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
 *             return             # <<<<<<<<<<<<<<
 *         self._start(tag, attrs, new_namespaces)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1091
 *         self._declared_ns_stack.append(new_namespaces)
 * 
 *         if self._qname_aware_tags is not None and tag in self._qname_aware_tags:             # <<<<<<<<<<<<<<
 *             # Need to parse text first to see if it requires a prefix declaration.
 *             self._pending_start = (tag, attrs, new_namespaces)
 */
  }

  /* "src/lxml/serializer.pxi":1095
 *             self._pending_start = (tag, attrs, new_namespaces)
 *             return
 *         self._start(tag, attrs, new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_start(__pyx_v_self, __pyx_v_tag, __pyx_v_attrs, __pyx_v_new_namespaces, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1080
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 */

  /* 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.C14NWriterTarget.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1123
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(
 *             qnames, key=lambda n: n.split('}', 1))}             # <<<<<<<<<<<<<<
 * 
 *         # Write namespace declarations in prefix order ...
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_6_start_lambda = {"lambda", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_6_start_lambda(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_n = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1123, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "lambda") < 0)) __PYX_ERR(10, 1123, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_n = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1123, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._start.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, __pyx_v_n);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) {
  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("lambda", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1123, __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;

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

/* "src/lxml/serializer.pxi":1097
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 */

static PyObject *__pyx_f_4lxml_5etree_16C14NWriterTarget__start(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_new_namespaces, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args) {
  PyObject *__pyx_v_qname_text = ((PyObject *)Py_None);
  PyObject *__pyx_v_qnames = NULL;
  PyObject *__pyx_v_resolved_names = NULL;
  PyObject *__pyx_v_qname = NULL;
  PyObject *__pyx_v_qattrs = NULL;
  PyObject *__pyx_v_attr_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_parsed_qnames = NULL;
  PyObject *__pyx_v_attr_list = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_attr_qname = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_v_space_behaviour = NULL;
  PyObject *__pyx_v_write = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_v = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_n = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_uri = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_prefix = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_v = 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;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  PyObject *__pyx_t_16 = NULL;
  Py_UCS4 __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_qname_text = __pyx_optional_args->qname_text;
    }
  }
  __Pyx_INCREF(__pyx_v_attrs);

  /* "src/lxml/serializer.pxi":1098
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_exclude_attrs != ((PyObject*)Py_None));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1098, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1099
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}             # <<<<<<<<<<<<<<
 * 
 *         qnames = {tag, *attrs}
 */
    { /* enter inner scope */
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1099, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = 0;
      if (unlikely(__pyx_v_attrs == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(10, 1099, __pyx_L8_error)
      }
      __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_attrs, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1099, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_8;
      __pyx_t_8 = 0;
      while (1) {
        __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, &__pyx_t_9, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_10 == 0)) break;
        if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(10, 1099, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_k, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_v, __pyx_t_9);
        __pyx_t_9 = 0;
        if (unlikely(__pyx_v_self->_exclude_attrs == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(10, 1099, __pyx_L8_error)
        }
        __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_9genexpr11__pyx_v_k, __pyx_v_self->_exclude_attrs, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1099, __pyx_L8_error)
        if (__pyx_t_1) {
          if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr11__pyx_v_k, (PyObject*)__pyx_9genexpr11__pyx_v_v))) __PYX_ERR(10, 1099, __pyx_L8_error)
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k); __pyx_9genexpr11__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_v); __pyx_9genexpr11__pyx_v_v = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k); __pyx_9genexpr11__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_v); __pyx_9genexpr11__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1098
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):
 *         if self._exclude_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1101
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 * 
 *         qnames = {tag, *attrs}             # <<<<<<<<<<<<<<
 *         resolved_names = {}
 * 
 */
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PySet_Add(__pyx_t_4, __pyx_v_tag) < 0) __PYX_ERR(10, 1101, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_attrs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after * must be an iterable, not NoneType");
    __PYX_ERR(10, 1101, __pyx_L1_error)
  }
  if (__Pyx_PySet_Update(__pyx_t_3, __pyx_v_attrs) < 0) __PYX_ERR(10, 1101, __pyx_L1_error)
  __pyx_v_qnames = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1102
 * 
 *         qnames = {tag, *attrs}
 *         resolved_names = {}             # <<<<<<<<<<<<<<
 * 
 *         # Resolve prefixes in attribute and tag text.
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_resolved_names = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1105
 * 
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 */
  __pyx_t_1 = (__pyx_v_qname_text != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1106
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)             # <<<<<<<<<<<<<<
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_resolve_prefix_name(__pyx_v_self, __pyx_v_qname_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_qname = __pyx_t_3;
    if (unlikely((PyDict_SetItem(__pyx_v_resolved_names, __pyx_v_qname_text, __pyx_t_3) < 0))) __PYX_ERR(10, 1106, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1107
 *         if qname_text is not None:
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)             # <<<<<<<<<<<<<<
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
 */
    __pyx_t_11 = PySet_Add(__pyx_v_qnames, __pyx_v_qname); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1107, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1105
 * 
 *         # Resolve prefixes in attribute and tag text.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 */
  }

  /* "src/lxml/serializer.pxi":1108
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 */
  __pyx_t_2 = (__pyx_v_self->_find_qname_aware_attrs != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1108, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1109
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)             # <<<<<<<<<<<<<<
 *             if qattrs:
 *                 for attr_name in qattrs:
 */
    __Pyx_INCREF(__pyx_v_self->_find_qname_aware_attrs);
    __pyx_t_4 = __pyx_v_self->_find_qname_aware_attrs; __pyx_t_9 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_attrs};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_v_qattrs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1110
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:             # <<<<<<<<<<<<<<
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_qattrs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1110, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1111
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 *                 for attr_name in qattrs:             # <<<<<<<<<<<<<<
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
 */
      if (likely(PyList_CheckExact(__pyx_v_qattrs)) || PyTuple_CheckExact(__pyx_v_qattrs)) {
        __pyx_t_3 = __pyx_v_qattrs; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_12 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_qattrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1111, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1111, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_12)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1111, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1111, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1111, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1111, __pyx_L1_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1111, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1111, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_12(__pyx_t_3);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(10, 1111, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/serializer.pxi":1112
 *             if qattrs:
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]             # <<<<<<<<<<<<<<
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_attrs, __pyx_v_attr_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/serializer.pxi":1113
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):             # <<<<<<<<<<<<<<
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)
 */
        __Pyx_INCREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
        __pyx_t_9 = __pyx_v_4lxml_5etree__looks_like_prefix_name; __pyx_t_8 = NULL;
        __pyx_t_7 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
            __pyx_t_7 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_value};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1113, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1113, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":1114
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)             # <<<<<<<<<<<<<<
 *                         qnames.add(qname)
 *             else:
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_resolve_prefix_name(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1114, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_XDECREF_SET(__pyx_v_qname, __pyx_t_4);
          if (unlikely((PyDict_SetItem(__pyx_v_resolved_names, __pyx_v_value, __pyx_t_4) < 0))) __PYX_ERR(10, 1114, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "src/lxml/serializer.pxi":1115
 *                     if _looks_like_prefix_name(value):
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)             # <<<<<<<<<<<<<<
 *             else:
 *                 qattrs = None
 */
          __pyx_t_11 = PySet_Add(__pyx_v_qnames, __pyx_v_qname); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1115, __pyx_L1_error)

          /* "src/lxml/serializer.pxi":1113
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):             # <<<<<<<<<<<<<<
 *                         qname = resolved_names[value] = self._resolve_prefix_name(value)
 *                         qnames.add(qname)
 */
        }

        /* "src/lxml/serializer.pxi":1111
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 *                 for attr_name in qattrs:             # <<<<<<<<<<<<<<
 *                     value = attrs[attr_name]
 *                     if _looks_like_prefix_name(value):
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":1110
 *         if self._find_qname_aware_attrs is not None and attrs:
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:             # <<<<<<<<<<<<<<
 *                 for attr_name in qattrs:
 *                     value = attrs[attr_name]
 */
      goto __pyx_L17;
    }

    /* "src/lxml/serializer.pxi":1117
 *                         qnames.add(qname)
 *             else:
 *                 qattrs = None             # <<<<<<<<<<<<<<
 *         else:
 *             qattrs = None
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_qattrs, Py_None);
    }
    __pyx_L17:;

    /* "src/lxml/serializer.pxi":1108
 *             qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
 *             qnames.add(qname)
 *         if self._find_qname_aware_attrs is not None and attrs:             # <<<<<<<<<<<<<<
 *             qattrs = self._find_qname_aware_attrs(attrs)
 *             if qattrs:
 */
    goto __pyx_L14;
  }

  /* "src/lxml/serializer.pxi":1119
 *                 qattrs = None
 *         else:
 *             qattrs = None             # <<<<<<<<<<<<<<
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_qattrs = Py_None;
  }
  __pyx_L14:;

  /* "src/lxml/serializer.pxi":1122
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(             # <<<<<<<<<<<<<<
 *             qnames, key=lambda n: n.split('}', 1))}
 * 
 */
  { /* enter inner scope */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1122, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/serializer.pxi":1123
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(
 *             qnames, key=lambda n: n.split('}', 1))}             # <<<<<<<<<<<<<<
 * 
 *         # Write namespace declarations in prefix order ...
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1122, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_qnames);
    __Pyx_GIVEREF(__pyx_v_qnames);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_qnames)) __PYX_ERR(10, 1122, __pyx_L24_error);
    __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1123, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_6_start_lambda, 0, __pyx_n_s_C14NWriterTarget__start_locals_l, NULL, __pyx_n_s_lxml_etree, __pyx_d, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1123, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_key, __pyx_t_8) < 0) __PYX_ERR(10, 1123, __pyx_L24_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "src/lxml/serializer.pxi":1122
 * 
 *         # Assign prefixes in lexicographical order of used URIs.
 *         parsed_qnames = {n: self._qname(n) for n in sorted(             # <<<<<<<<<<<<<<
 *             qnames, key=lambda n: n.split('}', 1))}
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1122, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_9 = __pyx_t_8; __Pyx_INCREF(__pyx_t_9);
      __pyx_t_6 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1122, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1122, __pyx_L24_error)
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_9))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1122, __pyx_L24_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1122, __pyx_L24_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1122, __pyx_L24_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1122, __pyx_L24_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1122, __pyx_L24_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1122, __pyx_L24_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_12(__pyx_t_9);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(10, 1122, __pyx_L24_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_n, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_qname(__pyx_v_self, __pyx_9genexpr12__pyx_v_n, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1122, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr12__pyx_v_n, (PyObject*)__pyx_t_8))) __PYX_ERR(10, 1122, __pyx_L24_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_n); __pyx_9genexpr12__pyx_v_n = 0;
    goto __pyx_L28_exit_scope;
    __pyx_L24_error:;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_n); __pyx_9genexpr12__pyx_v_n = 0;
    goto __pyx_L1_error;
    __pyx_L28_exit_scope:;
  } /* exit inner scope */
  __pyx_v_parsed_qnames = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1126
 * 
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_new_namespaces); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1126, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1127
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:
 *             attr_list = [             # <<<<<<<<<<<<<<
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces
 */
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1127, __pyx_L32_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/serializer.pxi":1129
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces             # <<<<<<<<<<<<<<
 *             ]
 *             attr_list.sort()
 */
      if (likely(PyList_CheckExact(__pyx_v_new_namespaces)) || PyTuple_CheckExact(__pyx_v_new_namespaces)) {
        __pyx_t_9 = __pyx_v_new_namespaces; __Pyx_INCREF(__pyx_t_9);
        __pyx_t_6 = 0;
        __pyx_t_12 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_new_namespaces); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1129, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1129, __pyx_L32_error)
      }
      for (;;) {
        if (likely(!__pyx_t_12)) {
          if (likely(PyList_CheckExact(__pyx_t_9))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1129, __pyx_L32_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1129, __pyx_L32_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1129, __pyx_L32_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1129, __pyx_L32_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1129, __pyx_L32_error)
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1129, __pyx_L32_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_12(__pyx_t_9);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(10, 1129, __pyx_L32_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
          PyObject* sequence = __pyx_t_8;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(10, 1129, __pyx_L32_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_13);
          #else
          __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1129, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1129, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1129, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
          index = 0; __pyx_t_4 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_4)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(10, 1129, __pyx_L32_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L36_unpacking_done;
          __pyx_L35_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(10, 1129, __pyx_L32_error)
          __pyx_L36_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_uri, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_prefix, __pyx_t_13);
        __pyx_t_13 = 0;

        /* "src/lxml/serializer.pxi":1128
 *         if new_namespaces:
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)             # <<<<<<<<<<<<<<
 *                 for uri, prefix in new_namespaces
 *             ]
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_9genexpr13__pyx_v_prefix); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1128, __pyx_L32_error)
        if (__pyx_t_1) {
          __pyx_t_13 = PyNumber_Add(__pyx_kp_u_xmlns, __pyx_9genexpr13__pyx_v_prefix); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1128, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_8 = __pyx_t_13;
          __pyx_t_13 = 0;
        } else {
          __Pyx_INCREF(__pyx_n_u_xmlns_2);
          __pyx_t_8 = __pyx_n_u_xmlns_2;
        }
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1128, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_8);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8)) __PYX_ERR(10, 1128, __pyx_L32_error);
        __Pyx_INCREF(__pyx_9genexpr13__pyx_v_uri);
        __Pyx_GIVEREF(__pyx_9genexpr13__pyx_v_uri);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_9genexpr13__pyx_v_uri)) __PYX_ERR(10, 1128, __pyx_L32_error);
        __pyx_t_8 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_13))) __PYX_ERR(10, 1127, __pyx_L32_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

        /* "src/lxml/serializer.pxi":1129
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 *                 for uri, prefix in new_namespaces             # <<<<<<<<<<<<<<
 *             ]
 *             attr_list.sort()
 */
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_prefix); __pyx_9genexpr13__pyx_v_prefix = 0;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_uri); __pyx_9genexpr13__pyx_v_uri = 0;
      goto __pyx_L38_exit_scope;
      __pyx_L32_error:;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_prefix); __pyx_9genexpr13__pyx_v_prefix = 0;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_uri); __pyx_9genexpr13__pyx_v_uri = 0;
      goto __pyx_L1_error;
      __pyx_L38_exit_scope:;
    } /* exit inner scope */
    __pyx_v_attr_list = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1131
 *                 for uri, prefix in new_namespaces
 *             ]
 *             attr_list.sort()             # <<<<<<<<<<<<<<
 *         else:
 *             # almost always empty
 */
    __pyx_t_11 = PyList_Sort(__pyx_v_attr_list); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1131, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1126
 * 
 *         # Write namespace declarations in prefix order ...
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             attr_list = [
 *                 ('xmlns:' + prefix if prefix else 'xmlns', uri)
 */
    goto __pyx_L29;
  }

  /* "src/lxml/serializer.pxi":1134
 *         else:
 *             # almost always empty
 *             attr_list = []             # <<<<<<<<<<<<<<
 * 
 *         # ... followed by attributes in URI+name order
 */
  /*else*/ {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_attr_list = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L29:;

  /* "src/lxml/serializer.pxi":1137
 * 
 *         # ... followed by attributes in URI+name order
 *         if attrs:             # <<<<<<<<<<<<<<
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attrs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1137, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1138
 *         # ... followed by attributes in URI+name order
 *         if attrs:
 *             for k, v in sorted(attrs.items()):             # <<<<<<<<<<<<<<
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrs, __pyx_n_s_items); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __pyx_t_13 = PySequence_List(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = ((PyObject*)__pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_11 = PyList_Sort(__pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1138, __pyx_L1_error)
    __pyx_t_13 = __pyx_t_3; __Pyx_INCREF(__pyx_t_13);
    __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1138, __pyx_L1_error)
        #endif
        if (__pyx_t_6 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1138, __pyx_L1_error)
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_13, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 1138, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_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_ERR(10, 1138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1138, __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_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
        index = 0; __pyx_t_9 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_9)) goto __pyx_L42_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_8 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L42_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) __PYX_ERR(10, 1138, __pyx_L1_error)
        __pyx_t_15 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L43_unpacking_done;
        __pyx_L42_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_15 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(10, 1138, __pyx_L1_error)
        __pyx_L43_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "src/lxml/serializer.pxi":1139
 *         if attrs:
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:             # <<<<<<<<<<<<<<
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 */
      __pyx_t_2 = (__pyx_v_qattrs != Py_None);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L45_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_k, __pyx_v_qattrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1139, __pyx_L1_error)
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L45_bool_binop_done;
      }
      __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_v, __pyx_v_resolved_names, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(10, 1139, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_L45_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1140
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]             # <<<<<<<<<<<<<<
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 *                 # No prefix for attributes in default ('') namespace.
 */
        __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_resolved_names, __pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1140, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1140, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1140, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/serializer.pxi":1139
 *         if attrs:
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:             # <<<<<<<<<<<<<<
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 */
      }

      /* "src/lxml/serializer.pxi":1141
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
 *                 attr_qname, attr_name, uri = parsed_qnames[k]             # <<<<<<<<<<<<<<
 *                 # No prefix for attributes in default ('') namespace.
 *                 attr_list.append((attr_qname if uri else attr_name, v))
 */
      __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1141, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 1141, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
        index = 0; __pyx_t_8 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 2; __pyx_t_4 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_4)) goto __pyx_L48_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 3) < 0) __PYX_ERR(10, 1141, __pyx_L1_error)
        __pyx_t_15 = NULL;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L49_unpacking_done;
        __pyx_L48_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(10, 1141, __pyx_L1_error)
        __pyx_L49_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_attr_qname, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1143
 *                 attr_qname, attr_name, uri = parsed_qnames[k]
 *                 # No prefix for attributes in default ('') namespace.
 *                 attr_list.append((attr_qname if uri else attr_name, v))             # <<<<<<<<<<<<<<
 * 
 *         # Honour xml:space attributes.
 */
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_uri); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1143, __pyx_L1_error)
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_v_attr_qname);
        __pyx_t_3 = __pyx_v_attr_qname;
      } else {
        __Pyx_INCREF(__pyx_v_attr_name);
        __pyx_t_3 = __pyx_v_attr_name;
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(10, 1143, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_v)) __PYX_ERR(10, 1143, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_attr_list, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1143, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1138
 *         # ... followed by attributes in URI+name order
 *         if attrs:
 *             for k, v in sorted(attrs.items()):             # <<<<<<<<<<<<<<
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 *                     v = parsed_qnames[resolved_names[v]][0]
 */
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "src/lxml/serializer.pxi":1137
 * 
 *         # ... followed by attributes in URI+name order
 *         if attrs:             # <<<<<<<<<<<<<<
 *             for k, v in sorted(attrs.items()):
 *                 if qattrs is not None and k in qattrs and v in resolved_names:
 */
  }

  /* "src/lxml/serializer.pxi":1146
 * 
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')             # <<<<<<<<<<<<<<
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrs, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_http_www_w3_org_XML_1998_namesp};
    __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_space_behaviour = __pyx_t_13;
  __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1147
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(             # <<<<<<<<<<<<<<
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])
 */
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(10, 1147, __pyx_L1_error)
  }

  /* "src/lxml/serializer.pxi":1148
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour             # <<<<<<<<<<<<<<
 *             else self._preserve_space[-1])
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_space_behaviour); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1148, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_space_behaviour, __pyx_n_u_preserve, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1148, __pyx_L1_error)
    __pyx_t_13 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {

    /* "src/lxml/serializer.pxi":1149
 *         self._preserve_space.append(
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])             # <<<<<<<<<<<<<<
 * 
 *         # Write the tag.
 */
    if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(10, 1149, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_preserve_space, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/serializer.pxi":1147
 *         # Honour xml:space attributes.
 *         space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
 *         self._preserve_space.append(             # <<<<<<<<<<<<<<
 *             space_behaviour == 'preserve' if space_behaviour
 *             else self._preserve_space[-1])
 */
  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_self->_preserve_space, __pyx_t_13); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1152
 * 
 *         # Write the tag.
 *         write = self._write             # <<<<<<<<<<<<<<
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:
 */
  __pyx_t_13 = __pyx_v_self->_write;
  __Pyx_INCREF(__pyx_t_13);
  __pyx_v_write = __pyx_t_13;
  __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1153
 *         # Write the tag.
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])             # <<<<<<<<<<<<<<
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 */
  __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_v_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_kp_u__71, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_write);
  __pyx_t_3 = __pyx_v_write; __pyx_t_9 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4};
    __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1154
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:             # <<<<<<<<<<<<<<
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')
 */
  __pyx_t_1 = (PyList_GET_SIZE(__pyx_v_attr_list) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1155
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))             # <<<<<<<<<<<<<<
 *         write('>')
 * 
 */
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1155, __pyx_L54_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_v_attr_list; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1155, __pyx_L54_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(10, 1155, __pyx_L54_error)
        #else
        __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
          PyObject* sequence = __pyx_t_9;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(10, 1155, __pyx_L54_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_14);
          #else
          __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1155, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1155, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_14);
          #endif
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_16 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(10, 1155, __pyx_L54_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_16);
          index = 0; __pyx_t_8 = __pyx_t_15(__pyx_t_16); if (unlikely(!__pyx_t_8)) goto __pyx_L57_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_8);
          index = 1; __pyx_t_14 = __pyx_t_15(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L57_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_14);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_16), 2) < 0) __PYX_ERR(10, 1155, __pyx_L54_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          goto __pyx_L58_unpacking_done;
          __pyx_L57_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(10, 1155, __pyx_L54_error)
          __pyx_L58_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_k, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_v, __pyx_t_14);
        __pyx_t_14 = 0;
        __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_5 = 0;
        __pyx_t_17 = 127;
        __Pyx_INCREF(__pyx_kp_u__11);
        __pyx_t_5 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__11);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u__11);
        __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_9genexpr14__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_17;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_14);
        __pyx_t_14 = 0;
        __Pyx_INCREF(__pyx_kp_u__72);
        __pyx_t_5 += 2;
        __Pyx_GIVEREF(__pyx_kp_u__72);
        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u__72);
        __pyx_t_14 = __pyx_f_4lxml_5etree__escape_attrib_c14n(__pyx_9genexpr14__pyx_v_v); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_17;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_INCREF(__pyx_kp_u__26);
        __pyx_t_5 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__26);
        PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_kp_u__26);
        __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, __pyx_t_5, __pyx_t_17); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(10, 1155, __pyx_L54_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_k); __pyx_9genexpr14__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_v); __pyx_9genexpr14__pyx_v_v = 0;
      goto __pyx_L60_exit_scope;
      __pyx_L54_error:;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_k); __pyx_9genexpr14__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_v); __pyx_9genexpr14__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L60_exit_scope:;
    } /* exit inner scope */
    __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__12, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_write);
    __pyx_t_3 = __pyx_v_write; __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_4};
      __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1155, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "src/lxml/serializer.pxi":1154
 *         write = self._write
 *         write('<' + parsed_qnames[tag][0])
 *         if attr_list:             # <<<<<<<<<<<<<<
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')
 */
  }

  /* "src/lxml/serializer.pxi":1156
 *         if attr_list:
 *             write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
 *         write('>')             # <<<<<<<<<<<<<<
 * 
 *         # Write the resolved qname text content.
 */
  __Pyx_INCREF(__pyx_v_write);
  __pyx_t_3 = __pyx_v_write; __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u__29};
    __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1159
 * 
 *         # Write the resolved qname text content.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
 */
  __pyx_t_1 = (__pyx_v_qname_text != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1160
 *         # Write the resolved qname text content.
 *         if qname_text is not None:
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))             # <<<<<<<<<<<<<<
 * 
 *         self._root_seen = True
 */
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_resolved_names, __pyx_v_qname_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_parsed_qnames, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_write);
    __pyx_t_3 = __pyx_v_write; __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_4};
      __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "src/lxml/serializer.pxi":1159
 * 
 *         # Write the resolved qname text content.
 *         if qname_text is not None:             # <<<<<<<<<<<<<<
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1162
 *             write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))
 * 
 *         self._root_seen = True             # <<<<<<<<<<<<<<
 *         self._ns_stack.append([])
 * 
 */
  __pyx_v_self->_root_seen = 1;

  /* "src/lxml/serializer.pxi":1163
 * 
 *         self._root_seen = True
 *         self._ns_stack.append([])             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
 */
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(10, 1163, __pyx_L1_error)
  }
  __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(10, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_13); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "src/lxml/serializer.pxi":1097
 *         self._start(tag, attrs, new_namespaces)
 * 
 *     cdef _start(self, tag, attrs, new_namespaces, qname_text=None):             # <<<<<<<<<<<<<<
 *         if self._exclude_attrs is not None and attrs:
 *             attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget._start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_qnames);
  __Pyx_XDECREF(__pyx_v_resolved_names);
  __Pyx_XDECREF(__pyx_v_qname);
  __Pyx_XDECREF(__pyx_v_qattrs);
  __Pyx_XDECREF(__pyx_v_attr_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_parsed_qnames);
  __Pyx_XDECREF(__pyx_v_attr_list);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_attr_qname);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XDECREF(__pyx_v_space_behaviour);
  __Pyx_XDECREF(__pyx_v_write);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_v);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_n);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_uri);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1165
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_12end = {"end", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1165, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "end") < 0)) __PYX_ERR(10, 1165, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("end", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1165, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_tag);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_11end(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  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;
  Py_UCS4 __pyx_t_5;
  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("end", 1);

  /* "src/lxml/serializer.pxi":1166
 * 
 *     def end(self, tag):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._ignored_depth -= 1
 *             return
 */
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1167
 *     def end(self, tag):
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1             # <<<<<<<<<<<<<<
 *             return
 *         if self._data:
 */
    __pyx_v_self->_ignored_depth = (__pyx_v_self->_ignored_depth - 1);

    /* "src/lxml/serializer.pxi":1168
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 *             return             # <<<<<<<<<<<<<<
 *         if self._data:
 *             self._flush()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1166
 * 
 *     def end(self, tag):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             self._ignored_depth -= 1
 *             return
 */
  }

  /* "src/lxml/serializer.pxi":1169
 *             self._ignored_depth -= 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1170
 *             return
 *         if self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1169
 *             self._ignored_depth -= 1
 *             return
 *         if self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
 */
  }

  /* "src/lxml/serializer.pxi":1171
 *         if self._data:
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')             # <<<<<<<<<<<<<<
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_5 = 127;
  __Pyx_INCREF(__pyx_kp_u__73);
  __pyx_t_4 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__73);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__73);
  __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_qname(__pyx_v_self, __pyx_v_tag, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_4 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__29);
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_3 = __pyx_v_self->_write; __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1172
 *             self._flush()
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()             # <<<<<<<<<<<<<<
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()
 */
  if (unlikely(__pyx_v_self->_preserve_space == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(10, 1172, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_preserve_space); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1173
 *         self._write(f'</{self._qname(tag)[0]}>')
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1             # <<<<<<<<<<<<<<
 *         self._declared_ns_stack.pop()
 *         self._ns_stack.pop()
 */
  __pyx_t_2 = __pyx_v_self->_preserve_space;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(10, 1173, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->_root_done = (__pyx_t_4 == 1);

  /* "src/lxml/serializer.pxi":1174
 *         self._preserve_space.pop()
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()             # <<<<<<<<<<<<<<
 *         self._ns_stack.pop()
 * 
 */
  if (unlikely(__pyx_v_self->_declared_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(10, 1174, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_declared_ns_stack); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1175
 *         self._root_done = len(self._preserve_space) == 1
 *         self._declared_ns_stack.pop()
 *         self._ns_stack.pop()             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, text):
 */
  if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(10, 1175, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_self->_ns_stack); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1165
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1177
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_14comment = {"comment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1177, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "comment") < 0)) __PYX_ERR(10, 1177, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("comment", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1177, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_text);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_13comment(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self, PyObject *__pyx_v_text) {
  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_t_6;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("comment", 1);

  /* "src/lxml/serializer.pxi":1178
 * 
 *     def comment(self, text):
 *         if not self._with_comments:             # <<<<<<<<<<<<<<
 *             return
 *         if self._ignored_depth:
 */
  __pyx_t_1 = (!__pyx_v_self->_with_comments);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1179
 *     def comment(self, text):
 *         if not self._with_comments:
 *             return             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1178
 * 
 *     def comment(self, text):
 *         if not self._with_comments:             # <<<<<<<<<<<<<<
 *             return
 *         if self._ignored_depth:
 */
  }

  /* "src/lxml/serializer.pxi":1180
 *         if not self._with_comments:
 *             return
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
 */
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1181
 *             return
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         if self._root_done:
 *             self._write('\n')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1180
 *         if not self._with_comments:
 *             return
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
 */
  }

  /* "src/lxml/serializer.pxi":1182
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 */
  if (__pyx_v_self->_root_done) {

    /* "src/lxml/serializer.pxi":1183
 *             return
 *         if self._root_done:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 *         elif self._root_seen and self._data:
 *             self._flush()
 */
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_3 = __pyx_v_self->_write; __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u__21};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1182
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":1184
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 */
  if (__pyx_v_self->_root_seen) {
  } else {
    __pyx_t_1 = __pyx_v_self->_root_seen;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  __pyx_t_1 = __pyx_t_6;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1185
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1184
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 */
  }
  __pyx_L5:;

  /* "src/lxml/serializer.pxi":1186
 *         elif self._root_seen and self._data:
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')             # <<<<<<<<<<<<<<
 *         if not self._root_seen:
 *             self._write('\n')
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = 0;
  __pyx_t_8 = 127;
  __Pyx_INCREF(__pyx_kp_u__74);
  __pyx_t_7 += 4;
  __Pyx_GIVEREF(__pyx_kp_u__74);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u__74);
  __pyx_t_4 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __pyx_t_9 = 0;
  __Pyx_INCREF(__pyx_kp_u__75);
  __pyx_t_7 += 3;
  __Pyx_GIVEREF(__pyx_kp_u__75);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__75);
  __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_3 = __pyx_v_self->_write; __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1187
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
 */
  __pyx_t_1 = (!__pyx_v_self->_root_seen);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1188
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data):
 */
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_3 = __pyx_v_self->_write; __pyx_t_9 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_u__21};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1188, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1187
 *             self._flush()
 *         self._write(f'<!--{_escape_cdata_c14n(text)}-->')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1177
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
 */

  /* 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_9);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1190
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_16pi = {"pi", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_target)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1190, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1190, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, 1); __PYX_ERR(10, 1190, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pi") < 0)) __PYX_ERR(10, 1190, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 1190, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self), __pyx_v_target, __pyx_v_data);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_15pi(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__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_t_6;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  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("pi", 1);

  /* "src/lxml/serializer.pxi":1191
 * 
 *     def pi(self, target, data):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
 */
  __pyx_t_1 = (__pyx_v_self->_ignored_depth != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1192
 *     def pi(self, target, data):
 *         if self._ignored_depth:
 *             return             # <<<<<<<<<<<<<<
 *         if self._root_done:
 *             self._write('\n')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1191
 * 
 *     def pi(self, target, data):
 *         if self._ignored_depth:             # <<<<<<<<<<<<<<
 *             return
 *         if self._root_done:
 */
  }

  /* "src/lxml/serializer.pxi":1193
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 */
  if (__pyx_v_self->_root_done) {

    /* "src/lxml/serializer.pxi":1194
 *             return
 *         if self._root_done:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 *         elif self._root_seen and self._data:
 *             self._flush()
 */
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_3 = __pyx_v_self->_write; __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u__21};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1193
 *         if self._ignored_depth:
 *             return
 *         if self._root_done:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/serializer.pxi":1195
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(
 */
  if (__pyx_v_self->_root_seen) {
  } else {
    __pyx_t_1 = __pyx_v_self->_root_seen;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_self->_data != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  __pyx_t_1 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1196
 *             self._write('\n')
 *         elif self._root_seen and self._data:
 *             self._flush()             # <<<<<<<<<<<<<<
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget *)__pyx_v_self->__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1195
 *         if self._root_done:
 *             self._write('\n')
 *         elif self._root_seen and self._data:             # <<<<<<<<<<<<<<
 *             self._flush()
 *         self._write(
 */
  }
  __pyx_L4:;

  /* "src/lxml/serializer.pxi":1198
 *             self._flush()
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')             # <<<<<<<<<<<<<<
 *         if not self._root_seen:
 *             self._write('\n')
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1198, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = 0;
    __pyx_t_8 = 127;
    __Pyx_INCREF(__pyx_kp_u__32);
    __pyx_t_7 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__32);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u__32);
    __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8;
    __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_INCREF(__pyx_kp_u__11);
    __pyx_t_7 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__11);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__11);
    __pyx_t_9 = __pyx_f_4lxml_5etree__escape_cdata_c14n(__pyx_v_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8;
    __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_INCREF(__pyx_kp_u__33);
    __pyx_t_7 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__33);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__33);
    __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_10;
    __pyx_t_10 = 0;
  } else {
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = 0;
    __pyx_t_8 = 127;
    __Pyx_INCREF(__pyx_kp_u__32);
    __pyx_t_7 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__32);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u__32);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_target, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_8;
    __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_kp_u__33);
    __pyx_t_7 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__33);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_kp_u__33);
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_INCREF(__pyx_v_self->_write);
  __pyx_t_4 = __pyx_v_self->_write; __pyx_t_10 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1199
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
 */
  __pyx_t_1 = (!__pyx_v_self->_root_seen);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1200
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:
 *             self._write('\n')             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
    __Pyx_INCREF(__pyx_v_self->_write);
    __pyx_t_4 = __pyx_v_self->_write; __pyx_t_3 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u__21};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1199
 *         self._write(
 *             f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
 *         if not self._root_seen:             # <<<<<<<<<<<<<<
 *             self._write('\n')
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1190
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.C14NWriterTarget.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1202
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16C14NWriterTarget_18close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_16C14NWriterTarget_17close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_C14NWriterTarget *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 1);

  /* "src/lxml/serializer.pxi":1203
 * 
 *     def close(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1202
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "src/lxml/serializer.pxi":1206
 * 
 * 
 * cdef _raise_serialization_error(text):             # <<<<<<<<<<<<<<
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))
 * 
 */

static PyObject *__pyx_f_4lxml_5etree__raise_serialization_error(PyObject *__pyx_v_text) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("_raise_serialization_error", 1);

  /* "src/lxml/serializer.pxi":1207
 * 
 * cdef _raise_serialization_error(text):
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u_cannot_serialize);
  __pyx_t_2 += 17;
  __Pyx_GIVEREF(__pyx_kp_u_cannot_serialize);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_cannot_serialize);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_text), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_type_2);
  __pyx_t_2 += 7;
  __Pyx_GIVEREF(__pyx_kp_u_type_2);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_type_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_text)), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__61);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__61);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__61);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1207, __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_ERR(10, 1207, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1206
 * 
 * 
 * cdef _raise_serialization_error(text):             # <<<<<<<<<<<<<<
 *     raise TypeError("cannot serialize %r (type %s)" % (text, type(text).__name__))
 * 
 */

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

/* "src/lxml/serializer.pxi":1210
 * 
 * 
 * cdef unicode _escape_cdata_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape character data
 *     cdef unicode text
 */

static PyObject *__pyx_f_4lxml_5etree__escape_cdata_c14n(PyObject *__pyx_v_stext) {
  PyObject *__pyx_v_text = 0;
  Py_UCS4 __pyx_v_ch;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_pos;
  PyObject *__pyx_v_substrings = 0;
  PyObject *__pyx_v_escape = 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;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  void *__pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_escape_cdata_c14n", 1);

  /* "src/lxml/serializer.pxi":1214
 *     cdef unicode text
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0             # <<<<<<<<<<<<<<
 *     cdef list substrings = None
 *     try:
 */
  __pyx_v_start = 0;
  __pyx_v_pos = 0;

  /* "src/lxml/serializer.pxi":1215
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None             # <<<<<<<<<<<<<<
 *     try:
 *         text = unicode(stext)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_substrings = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":1216
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/serializer.pxi":1217
 *     cdef list substrings = None
 *     try:
 *         text = unicode(stext)             # <<<<<<<<<<<<<<
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)
 */
      __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_stext); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1217, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_text = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1216
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1218
 *     try:
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):             # <<<<<<<<<<<<<<
 *         return _raise_serialization_error(stext)
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree._escape_cdata_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 1218, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/serializer.pxi":1219
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)             # <<<<<<<<<<<<<<
 * 
 *     for pos, ch in enumerate(text):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __pyx_f_4lxml_5etree__raise_serialization_error(__pyx_v_stext); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1219, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_8))) __PYX_ERR(10, 1219, __pyx_L5_except_error)
      __pyx_r = ((PyObject*)__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;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/serializer.pxi":1216
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
    __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_L8_try_end:;
  }

  /* "src/lxml/serializer.pxi":1221
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
 */
  __pyx_t_9 = 0;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_t_10 = __pyx_v_text;
  __pyx_t_14 = __Pyx_init_unicode_iteration(__pyx_t_10, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_5)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(10, 1221, __pyx_L1_error)
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_12; __pyx_t_15++) {
    __pyx_t_11 = __pyx_t_15;
    __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_13, __pyx_t_11);

    /* "src/lxml/serializer.pxi":1222
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
    __pyx_v_pos = __pyx_t_9;

    /* "src/lxml/serializer.pxi":1221
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "src/lxml/serializer.pxi":1222
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
    switch (__pyx_v_ch) {
      case 38:

      /* "src/lxml/serializer.pxi":1223
 *     for pos, ch in enumerate(text):
 *         if ch == '&':
 *             escape = '&amp;'             # <<<<<<<<<<<<<<
 *         elif ch == '<':
 *             escape = '&lt;'
 */
      __Pyx_INCREF(__pyx_kp_u_amp);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_amp);

      /* "src/lxml/serializer.pxi":1222
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
      break;
      case 60:

      /* "src/lxml/serializer.pxi":1225
 *             escape = '&amp;'
 *         elif ch == '<':
 *             escape = '&lt;'             # <<<<<<<<<<<<<<
 *         elif ch == '>':
 *             escape = '&gt;'
 */
      __Pyx_INCREF(__pyx_kp_u_lt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_lt);

      /* "src/lxml/serializer.pxi":1224
 *         if ch == '&':
 *             escape = '&amp;'
 *         elif ch == '<':             # <<<<<<<<<<<<<<
 *             escape = '&lt;'
 *         elif ch == '>':
 */
      break;
      case 62:

      /* "src/lxml/serializer.pxi":1227
 *             escape = '&lt;'
 *         elif ch == '>':
 *             escape = '&gt;'             # <<<<<<<<<<<<<<
 *         elif ch == '\r':
 *             escape = '&#xD;'
 */
      __Pyx_INCREF(__pyx_kp_u_gt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_gt);

      /* "src/lxml/serializer.pxi":1226
 *         elif ch == '<':
 *             escape = '&lt;'
 *         elif ch == '>':             # <<<<<<<<<<<<<<
 *             escape = '&gt;'
 *         elif ch == '\r':
 */
      break;
      case 13:

      /* "src/lxml/serializer.pxi":1229
 *             escape = '&gt;'
 *         elif ch == '\r':
 *             escape = '&#xD;'             # <<<<<<<<<<<<<<
 *         else:
 *             continue
 */
      __Pyx_INCREF(__pyx_kp_u_xD);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_xD);

      /* "src/lxml/serializer.pxi":1228
 *         elif ch == '>':
 *             escape = '&gt;'
 *         elif ch == '\r':             # <<<<<<<<<<<<<<
 *             escape = '&#xD;'
 *         else:
 */
      break;
      default:

      /* "src/lxml/serializer.pxi":1231
 *             escape = '&#xD;'
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if substrings is None:
 */
      goto __pyx_L11_continue;
      break;
    }

    /* "src/lxml/serializer.pxi":1233
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
 */
    __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1234
 * 
 *         if substrings is None:
 *             substrings = []             # <<<<<<<<<<<<<<
 *         if pos > start:
 *             substrings.append(text[start:pos])
 */
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_substrings, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1233
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
 */
    }

    /* "src/lxml/serializer.pxi":1235
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 */
    __pyx_t_16 = (__pyx_v_pos > __pyx_v_start);
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1236
 *             substrings = []
 *         if pos > start:
 *             substrings.append(text[start:pos])             # <<<<<<<<<<<<<<
 *         substrings.append(escape)
 *         start = pos + 1
 */
      if (unlikely(__pyx_v_substrings == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(10, 1236, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, __pyx_v_pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1236, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1235
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 */
    }

    /* "src/lxml/serializer.pxi":1237
 *         if pos > start:
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)             # <<<<<<<<<<<<<<
 *         start = pos + 1
 * 
 */
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 1237, __pyx_L1_error)
    }
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_v_escape); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1237, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1238
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 *         start = pos + 1             # <<<<<<<<<<<<<<
 * 
 *     if substrings is None:
 */
    __pyx_v_start = (__pyx_v_pos + 1);
    __pyx_L11_continue:;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "src/lxml/serializer.pxi":1240
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
 */
  __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1241
 * 
 *     if substrings is None:
 *         return text             # <<<<<<<<<<<<<<
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_text);
    __pyx_r = __pyx_v_text;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1240
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
 */
  }

  /* "src/lxml/serializer.pxi":1242
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
 */
  __pyx_t_16 = (__pyx_v_pos >= __pyx_v_start);
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1243
 *         return text
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])             # <<<<<<<<<<<<<<
 *     return ''.join(substrings)
 * 
 */
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 1243, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, (__pyx_v_pos + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1243, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":1242
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
 */
  }

  /* "src/lxml/serializer.pxi":1244
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyUnicode_Join(__pyx_kp_u__12, __pyx_v_substrings); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1210
 * 
 * 
 * cdef unicode _escape_cdata_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape character data
 *     cdef unicode text
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._escape_cdata_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_substrings);
  __Pyx_XDECREF(__pyx_v_escape);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1247
 * 
 * 
 * cdef unicode _escape_attrib_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape attribute value
 *     cdef unicode text
 */

static PyObject *__pyx_f_4lxml_5etree__escape_attrib_c14n(PyObject *__pyx_v_stext) {
  PyObject *__pyx_v_text = 0;
  Py_UCS4 __pyx_v_ch;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_pos;
  PyObject *__pyx_v_substrings = 0;
  PyObject *__pyx_v_escape = 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;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  void *__pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_escape_attrib_c14n", 1);

  /* "src/lxml/serializer.pxi":1251
 *     cdef unicode text
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0             # <<<<<<<<<<<<<<
 *     cdef list substrings = None
 *     try:
 */
  __pyx_v_start = 0;
  __pyx_v_pos = 0;

  /* "src/lxml/serializer.pxi":1252
 *     cdef Py_UCS4 ch
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None             # <<<<<<<<<<<<<<
 *     try:
 *         text = unicode(stext)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_substrings = ((PyObject*)Py_None);

  /* "src/lxml/serializer.pxi":1253
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/serializer.pxi":1254
 *     cdef list substrings = None
 *     try:
 *         text = unicode(stext)             # <<<<<<<<<<<<<<
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)
 */
      __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_stext); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1254, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_text = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/serializer.pxi":1253
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1255
 *     try:
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):             # <<<<<<<<<<<<<<
 *         return _raise_serialization_error(stext)
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree._escape_attrib_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 1255, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "src/lxml/serializer.pxi":1256
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 *         return _raise_serialization_error(stext)             # <<<<<<<<<<<<<<
 * 
 *     for pos, ch in enumerate(text):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __pyx_f_4lxml_5etree__raise_serialization_error(__pyx_v_stext); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1256, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_8))) __PYX_ERR(10, 1256, __pyx_L5_except_error)
      __pyx_r = ((PyObject*)__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;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/serializer.pxi":1253
 *     cdef Py_ssize_t start = 0, pos = 0
 *     cdef list substrings = None
 *     try:             # <<<<<<<<<<<<<<
 *         text = unicode(stext)
 *     except (TypeError, AttributeError):
 */
    __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_L8_try_end:;
  }

  /* "src/lxml/serializer.pxi":1258
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
 */
  __pyx_t_9 = 0;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_t_10 = __pyx_v_text;
  __pyx_t_14 = __Pyx_init_unicode_iteration(__pyx_t_10, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_5)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(10, 1258, __pyx_L1_error)
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_12; __pyx_t_15++) {
    __pyx_t_11 = __pyx_t_15;
    __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_13, __pyx_t_11);

    /* "src/lxml/serializer.pxi":1259
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
    __pyx_v_pos = __pyx_t_9;

    /* "src/lxml/serializer.pxi":1258
 *         return _raise_serialization_error(stext)
 * 
 *     for pos, ch in enumerate(text):             # <<<<<<<<<<<<<<
 *         if ch == '&':
 *             escape = '&amp;'
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "src/lxml/serializer.pxi":1259
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
    switch (__pyx_v_ch) {
      case 38:

      /* "src/lxml/serializer.pxi":1260
 *     for pos, ch in enumerate(text):
 *         if ch == '&':
 *             escape = '&amp;'             # <<<<<<<<<<<<<<
 *         elif ch == '<':
 *             escape = '&lt;'
 */
      __Pyx_INCREF(__pyx_kp_u_amp);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_amp);

      /* "src/lxml/serializer.pxi":1259
 * 
 *     for pos, ch in enumerate(text):
 *         if ch == '&':             # <<<<<<<<<<<<<<
 *             escape = '&amp;'
 *         elif ch == '<':
 */
      break;
      case 60:

      /* "src/lxml/serializer.pxi":1262
 *             escape = '&amp;'
 *         elif ch == '<':
 *             escape = '&lt;'             # <<<<<<<<<<<<<<
 *         elif ch == '"':
 *             escape = '&quot;'
 */
      __Pyx_INCREF(__pyx_kp_u_lt);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_lt);

      /* "src/lxml/serializer.pxi":1261
 *         if ch == '&':
 *             escape = '&amp;'
 *         elif ch == '<':             # <<<<<<<<<<<<<<
 *             escape = '&lt;'
 *         elif ch == '"':
 */
      break;
      case 34:

      /* "src/lxml/serializer.pxi":1264
 *             escape = '&lt;'
 *         elif ch == '"':
 *             escape = '&quot;'             # <<<<<<<<<<<<<<
 *         elif ch == '\t':
 *             escape = '&#x9;'
 */
      __Pyx_INCREF(__pyx_kp_u_quot);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_quot);

      /* "src/lxml/serializer.pxi":1263
 *         elif ch == '<':
 *             escape = '&lt;'
 *         elif ch == '"':             # <<<<<<<<<<<<<<
 *             escape = '&quot;'
 *         elif ch == '\t':
 */
      break;
      case 9:

      /* "src/lxml/serializer.pxi":1266
 *             escape = '&quot;'
 *         elif ch == '\t':
 *             escape = '&#x9;'             # <<<<<<<<<<<<<<
 *         elif ch == '\n':
 *             escape = '&#xA;'
 */
      __Pyx_INCREF(__pyx_kp_u_x9);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_x9);

      /* "src/lxml/serializer.pxi":1265
 *         elif ch == '"':
 *             escape = '&quot;'
 *         elif ch == '\t':             # <<<<<<<<<<<<<<
 *             escape = '&#x9;'
 *         elif ch == '\n':
 */
      break;
      case 10:

      /* "src/lxml/serializer.pxi":1268
 *             escape = '&#x9;'
 *         elif ch == '\n':
 *             escape = '&#xA;'             # <<<<<<<<<<<<<<
 *         elif ch == '\r':
 *             escape = '&#xD;'
 */
      __Pyx_INCREF(__pyx_kp_u_xA);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_xA);

      /* "src/lxml/serializer.pxi":1267
 *         elif ch == '\t':
 *             escape = '&#x9;'
 *         elif ch == '\n':             # <<<<<<<<<<<<<<
 *             escape = '&#xA;'
 *         elif ch == '\r':
 */
      break;
      case 13:

      /* "src/lxml/serializer.pxi":1270
 *             escape = '&#xA;'
 *         elif ch == '\r':
 *             escape = '&#xD;'             # <<<<<<<<<<<<<<
 *         else:
 *             continue
 */
      __Pyx_INCREF(__pyx_kp_u_xD);
      __Pyx_XDECREF_SET(__pyx_v_escape, __pyx_kp_u_xD);

      /* "src/lxml/serializer.pxi":1269
 *         elif ch == '\n':
 *             escape = '&#xA;'
 *         elif ch == '\r':             # <<<<<<<<<<<<<<
 *             escape = '&#xD;'
 *         else:
 */
      break;
      default:

      /* "src/lxml/serializer.pxi":1272
 *             escape = '&#xD;'
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if substrings is None:
 */
      goto __pyx_L11_continue;
      break;
    }

    /* "src/lxml/serializer.pxi":1274
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
 */
    __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1275
 * 
 *         if substrings is None:
 *             substrings = []             # <<<<<<<<<<<<<<
 *         if pos > start:
 *             substrings.append(text[start:pos])
 */
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_substrings, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1274
 *             continue
 * 
 *         if substrings is None:             # <<<<<<<<<<<<<<
 *             substrings = []
 *         if pos > start:
 */
    }

    /* "src/lxml/serializer.pxi":1276
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 */
    __pyx_t_16 = (__pyx_v_pos > __pyx_v_start);
    if (__pyx_t_16) {

      /* "src/lxml/serializer.pxi":1277
 *             substrings = []
 *         if pos > start:
 *             substrings.append(text[start:pos])             # <<<<<<<<<<<<<<
 *         substrings.append(escape)
 *         start = pos + 1
 */
      if (unlikely(__pyx_v_substrings == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(10, 1277, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, __pyx_v_pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1277, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1276
 *         if substrings is None:
 *             substrings = []
 *         if pos > start:             # <<<<<<<<<<<<<<
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 */
    }

    /* "src/lxml/serializer.pxi":1278
 *         if pos > start:
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)             # <<<<<<<<<<<<<<
 *         start = pos + 1
 * 
 */
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 1278, __pyx_L1_error)
    }
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_v_escape); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1278, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1279
 *             substrings.append(text[start:pos])
 *         substrings.append(escape)
 *         start = pos + 1             # <<<<<<<<<<<<<<
 * 
 *     if substrings is None:
 */
    __pyx_v_start = (__pyx_v_pos + 1);
    __pyx_L11_continue:;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "src/lxml/serializer.pxi":1281
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
 */
  __pyx_t_16 = (__pyx_v_substrings == ((PyObject*)Py_None));
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1282
 * 
 *     if substrings is None:
 *         return text             # <<<<<<<<<<<<<<
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_text);
    __pyx_r = __pyx_v_text;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1281
 *         start = pos + 1
 * 
 *     if substrings is None:             # <<<<<<<<<<<<<<
 *         return text
 *     if pos >= start:
 */
  }

  /* "src/lxml/serializer.pxi":1283
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
 */
  __pyx_t_16 = (__pyx_v_pos >= __pyx_v_start);
  if (__pyx_t_16) {

    /* "src/lxml/serializer.pxi":1284
 *         return text
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])             # <<<<<<<<<<<<<<
 *     return ''.join(substrings)
 * 
 */
    if (unlikely(__pyx_v_substrings == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(10, 1284, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_text, __pyx_v_start, (__pyx_v_pos + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_substrings, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(10, 1284, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "src/lxml/serializer.pxi":1283
 *     if substrings is None:
 *         return text
 *     if pos >= start:             # <<<<<<<<<<<<<<
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)
 */
  }

  /* "src/lxml/serializer.pxi":1285
 *     if pos >= start:
 *         substrings.append(text[start:pos+1])
 *     return ''.join(substrings)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyUnicode_Join(__pyx_kp_u__12, __pyx_v_substrings); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1247
 * 
 * 
 * cdef unicode _escape_attrib_c14n(stext):             # <<<<<<<<<<<<<<
 *     # escape attribute value
 *     cdef unicode text
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._escape_attrib_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_substrings);
  __Pyx_XDECREF(__pyx_v_escape);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1335
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
 */

/* 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;
  PyObject *__pyx_v_close = 0;
  PyObject *__pyx_v_buffered = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_close,&__pyx_n_s_buffered,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/serializer.pxi":1336
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,
 *                  close=False, buffered=True):             # <<<<<<<<<<<<<<
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 */
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_file)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1335, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1335, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compression);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1335, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_close);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1335, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffered);
          if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1335, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(10, 1335, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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];
    __pyx_v_close = values[3];
    __pyx_v_buffered = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, __pyx_nargs); __PYX_ERR(10, 1335, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(10, 1335, __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, __pyx_v_close, __pyx_v_buffered);

  /* "src/lxml/serializer.pxi":1335
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, PyObject *__pyx_v_close, PyObject *__pyx_v_buffered) {
  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("__init__", 1);

  /* "src/lxml/serializer.pxi":1337
 *     def __init__(self, output_file not None, encoding=None, compression=None,
 *                  close=False, buffered=True):
 *         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;

  /* "src/lxml/serializer.pxi":1338
 *                  close=False, buffered=True):
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)             # <<<<<<<<<<<<<<
 *         self.compresslevel = compression or 0
 *         self.close = close
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1338, __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;

  /* "src/lxml/serializer.pxi":1339
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0             # <<<<<<<<<<<<<<
 *         self.close = close
 *         self.buffered = buffered
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_compression); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(10, 1339, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1339, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_v_self->compresslevel = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1340
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0
 *         self.close = close             # <<<<<<<<<<<<<<
 *         self.buffered = buffered
 *         self.method = OUTPUT_METHOD_XML
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_close); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1340, __pyx_L1_error)
  __pyx_v_self->close = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1341
 *         self.compresslevel = compression or 0
 *         self.close = close
 *         self.buffered = buffered             # <<<<<<<<<<<<<<
 *         self.method = OUTPUT_METHOD_XML
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_buffered); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1341, __pyx_L1_error)
  __pyx_v_self->buffered = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1342
 *         self.close = close
 *         self.buffered = buffered
 *         self.method = OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_v_self->method = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;

  /* "src/lxml/serializer.pxi":1335
 *     cdef int method
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None,             # <<<<<<<<<<<<<<
 *                  close=False, buffered=True):
 *         self.output_file = output_file
 */

  /* 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;
}

/* "src/lxml/serializer.pxi":1344
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_3__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __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) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 1);

  /* "src/lxml/serializer.pxi":1345
 * 
 *     def __enter__(self):
 *         assert self.output_file is not None             # <<<<<<<<<<<<<<
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->output_file != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1345, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1345, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1347
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,             # <<<<<<<<<<<<<<
 *             self.close, self.buffered, self.method)
 *         return self.writer
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->compresslevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/serializer.pxi":1348
 *         self.writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)             # <<<<<<<<<<<<<<
 *         return self.writer
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->close); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->buffered); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->method); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/serializer.pxi":1346
 *     def __enter__(self):
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 */
  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->output_file);
  __Pyx_GIVEREF(__pyx_v_self->output_file);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self->output_file)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->encoding);
  __Pyx_GIVEREF(__pyx_v_self->encoding);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self->encoding)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_5)) __PYX_ERR(10, 1346, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->writer);
  __pyx_v_self->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/serializer.pxi":1349
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 *         return self.writer             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->writer);
  __pyx_r = ((PyObject *)__pyx_v_self->writer);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1344
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1351
 *         return self.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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_5__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1351, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_val)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1351, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(10, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_tb)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1351, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(10, 1351, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(10, 1351, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(10, 1351, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("__exit__", 1);

  /* "src/lxml/serializer.pxi":1352
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1353
 *     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_2 = ((PyObject *)__pyx_v_self->writer);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_old_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->writer);
    __Pyx_DECREF((PyObject *)__pyx_v_self->writer);
    __pyx_v_self->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1354
 *         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)
 *             if self.close:
 */
    __pyx_t_1 = (__pyx_v_exc_type == Py_None);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_raise_on_error = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1355
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *             if self.close:
 *                 self.output_file = None
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_raise_on_error); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1355, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(__pyx_v_old_writer, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1356
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
 */
    if (__pyx_v_self->close) {

      /* "src/lxml/serializer.pxi":1357
 *             old_writer._close(raise_on_error)
 *             if self.close:
 *                 self.output_file = None             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->output_file);
      __Pyx_DECREF(__pyx_v_self->output_file);
      __pyx_v_self->output_file = Py_None;

      /* "src/lxml/serializer.pxi":1356
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
 */
    }

    /* "src/lxml/serializer.pxi":1352
 * 
 *     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
 */
  }

  /* "src/lxml/serializer.pxi":1351
 *         return self.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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}
static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1359
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_7__aenter__ = {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__aenter__", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_6__aenter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1359, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_7xmlfile_8generator2, __pyx_codeobj__76, (PyObject *) __pyx_cur_scope, __pyx_n_s_aenter, __pyx_n_s_xmlfile___aenter, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1359, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1359, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1360
 * 
 *     async def __aenter__(self):
 *         assert self.output_file is not None             # <<<<<<<<<<<<<<
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->output_file != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1360, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1360, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1361
 *     async def __aenter__(self):
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->output_file;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1362
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")             # <<<<<<<<<<<<<<
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1362, __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_ERR(10, 1362, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1361
 *     async def __aenter__(self):
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
 */
  }

  /* "src/lxml/serializer.pxi":1363
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):             # <<<<<<<<<<<<<<
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->output_file;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_u_write); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 1363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/serializer.pxi":1364
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")             # <<<<<<<<<<<<<<
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__78, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1364, __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_ERR(10, 1364, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1363
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):             # <<<<<<<<<<<<<<
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
 */
  }

  /* "src/lxml/serializer.pxi":1366
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,             # <<<<<<<<<<<<<<
 *             self.close, self.buffered, self.method)
 *         return self.async_writer
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->compresslevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/serializer.pxi":1367
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)             # <<<<<<<<<<<<<<
 *         return self.async_writer
 * 
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->close); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->buffered); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->method); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "src/lxml/serializer.pxi":1365
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
 *         self.async_writer = _AsyncIncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 */
  __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->output_file);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->output_file);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_self->output_file)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->encoding);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->encoding);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_cur_scope->__pyx_v_self->encoding)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6)) __PYX_ERR(10, 1365, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
  __pyx_cur_scope->__pyx_v_self->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1368
 *             self.output_file, self.encoding, self.compresslevel,
 *             self.close, self.buffered, self.method)
 *         return self.async_writer             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = NULL; __Pyx_ReturnWithStopIteration(((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer));
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1359
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1370
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7xmlfile_10__aexit__ = {"__aexit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1370, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_val)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1370, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__aexit__", 1, 3, 3, 1); __PYX_ERR(10, 1370, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_tb)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1370, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__aexit__", 1, 3, 3, 2); __PYX_ERR(10, 1370, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__aexit__") < 0)) __PYX_ERR(10, 1370, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__aexit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(10, 1370, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_9__aexit__(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___pyx_scope_struct_3___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1370, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_exc_type = __pyx_v_exc_type;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_type);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_type);
  __pyx_cur_scope->__pyx_v_exc_val = __pyx_v_exc_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_val);
  __pyx_cur_scope->__pyx_v_exc_tb = __pyx_v_exc_tb;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exc_tb);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exc_tb);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_7xmlfile_11generator3, __pyx_codeobj__79, (PyObject *) __pyx_cur_scope, __pyx_n_s_aexit, __pyx_n_s_xmlfile___aexit, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1370, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_7xmlfile_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1370, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1371
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
 */
  __pyx_t_1 = (((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1372
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None             # <<<<<<<<<<<<<<
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
 */
    __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = Py_None;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_v_old_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->async_writer);
    __pyx_cur_scope->__pyx_v_self->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1373
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None             # <<<<<<<<<<<<<<
 *             await old_writer._close(raise_on_error)
 *             if self.close:
 */
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_exc_type == Py_None);
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_v_raise_on_error = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1374
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *             if self.close:
 *                 self.output_file = None
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_old_writer), __pyx_n_s_close_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_raise_on_error};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1374, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1374, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1374, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1375
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
 */
    if (__pyx_cur_scope->__pyx_v_self->close) {

      /* "src/lxml/serializer.pxi":1376
 *             await old_writer._close(raise_on_error)
 *             if self.close:
 *                 self.output_file = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->output_file);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->output_file);
      __pyx_cur_scope->__pyx_v_self->output_file = Py_None;

      /* "src/lxml/serializer.pxi":1375
 *             raise_on_error = exc_type is None
 *             await old_writer._close(raise_on_error)
 *             if self.close:             # <<<<<<<<<<<<<<
 *                 self.output_file = None
 * 
 */
    }

    /* "src/lxml/serializer.pxi":1371
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):
 *         if self.async_writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.async_writer = self.async_writer, None
 *             raise_on_error = exc_type is None
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1370
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1385
 *     xmlfile.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8htmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8htmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  if (unlikely(__pyx_kwds)) {
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_8htmlfile___init__(((struct __pyx_obj_4lxml_5etree_htmlfile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_4lxml_5etree_8htmlfile___init__(struct __pyx_obj_4lxml_5etree_htmlfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  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__", 1);

  /* "src/lxml/serializer.pxi":1386
 *     """
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 *         self.method = OUTPUT_METHOD_HTML
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_htmlfile);
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_htmlfile);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_4lxml_5etree_htmlfile))) __PYX_ERR(10, 1386, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self))) __PYX_ERR(10, 1386, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1386, __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_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1386, __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;

  /* "src/lxml/serializer.pxi":1387
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->__pyx_base.method = __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML;

  /* "src/lxml/serializer.pxi":1385
 *     xmlfile.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.method = OUTPUT_METHOD_HTML
 */

  /* 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.htmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1410
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING
 */

/* 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_v_close;
  int __pyx_v_buffered;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outfile,&__pyx_n_s_encoding,&__pyx_n_s_compresslevel,&__pyx_n_s_close,&__pyx_n_s_buffered,&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_outfile)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); __PYX_ERR(10, 1410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compresslevel)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); __PYX_ERR(10, 1410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_close)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); __PYX_ERR(10, 1410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffered)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); __PYX_ERR(10, 1410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); __PYX_ERR(10, 1410, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 1410, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
      values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
      values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
    }
    __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_ERR(10, 1410, __pyx_L3_error)
    __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1410, __pyx_L3_error)
    __pyx_v_buffered = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_buffered == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1411, __pyx_L3_error)
    __pyx_v_method = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1411, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, __pyx_nargs); __PYX_ERR(10, 1410, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(10, 1410, __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, __pyx_v_close, __pyx_v_buffered, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_v_close, int __pyx_v_buffered, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  char *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "src/lxml/serializer.pxi":1412
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING             # <<<<<<<<<<<<<<
 *         self._element_stack = []
 *         if encoding is None:
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_STARTING;

  /* "src/lxml/serializer.pxi":1413
 *                   bint buffered, int method):
 *         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_ERR(10, 1413, __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;

  /* "src/lxml/serializer.pxi":1414
 *         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));
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":1415
 *         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);

    /* "src/lxml/serializer.pxi":1414
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = b'ASCII'
 *         self._encoding = encoding
 */
  }

  /* "src/lxml/serializer.pxi":1416
 *         if encoding is None:
 *             encoding = b'ASCII'
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 *         self._buffered = buffered
 */
  __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;

  /* "src/lxml/serializer.pxi":1417
 *             encoding = b'ASCII'
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL             # <<<<<<<<<<<<<<
 *         self._buffered = buffered
 *         self._target = _create_output_buffer(
 */
  __pyx_t_2 = (__pyx_v_encoding != ((PyObject*)Py_None));
  if (__pyx_t_2) {
    __pyx_t_3 = PyBytes_AS_STRING(__pyx_v_encoding);
  } else {
    __pyx_t_3 = NULL;
  }
  __pyx_v_self->_c_encoding = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1418
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 *         self._buffered = buffered             # <<<<<<<<<<<<<<
 *         self._target = _create_output_buffer(
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
 */
  __pyx_v_self->_buffered = __pyx_v_buffered;

  /* "src/lxml/serializer.pxi":1419
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 *         self._buffered = buffered
 *         self._target = _create_output_buffer(             # <<<<<<<<<<<<<<
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
 *         self._method = method
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_outfile, __pyx_v_self->_c_encoding, __pyx_v_compresslevel, (&__pyx_v_self->_c_out), __pyx_v_close)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/serializer.pxi":1421
 *         self._target = _create_output_buffer(
 *             outfile, self._c_encoding, compresslevel, &self._c_out, close)
 *         self._method = method             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1410
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._status = WRITER_STARTING
 */

  /* 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;
}

/* "src/lxml/serializer.pxi":1423
 *         self._method = method
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/serializer.pxi":1424
 * 
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1425
 *     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):
 */
    (void)(xmlOutputBufferClose(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1424
 * 
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1423
 *         self._method = method
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)
 */

  /* function exit code */
}

/* "src/lxml/serializer.pxi":1427
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_5write_declaration = {"write_declaration", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_version,&__pyx_n_s_standalone,&__pyx_n_s_doctype,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_version);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1427, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_standalone);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1427, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doctype);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1427, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_declaration") < 0)) __PYX_ERR(10, 1427, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_declaration", 0, 0, 3, __pyx_nargs); __PYX_ERR(10, 1427, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  const xmlChar *__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);

  /* "src/lxml/serializer.pxi":1432
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1432, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1432, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1435
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:
 */
  __pyx_t_1 = (__pyx_v_self->_method != __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1436
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")             # <<<<<<<<<<<<<<
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_only_XML_documents_have_declarat};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1436, __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_ERR(10, 1436, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1435
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 *         if self._method != OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:
 */
  }

  /* "src/lxml/serializer.pxi":1437
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1438
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_XML_declaration_already_written};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1438, __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_ERR(10, 1438, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1437
 *         if self._method != OUTPUT_METHOD_XML:
 *             raise LxmlSyntaxError("only XML documents have declarations")
 *         if self._status >= WRITER_DECL_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
 */
  }

  /* "src/lxml/serializer.pxi":1439
 *         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_2 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_version, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1440
 *             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) {
    __pyx_t_6 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_version);
  } else {
    __pyx_t_6 = NULL;
  }
  __pyx_v_c_version = __pyx_t_6;

  /* "src/lxml/serializer.pxi":1441
 *         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_2 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_doctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1442
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1443
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:
 *             c_standalone = -1             # <<<<<<<<<<<<<<
 *         else:
 *             c_standalone = 1 if standalone else 0
 */
    __pyx_v_c_standalone = -1;

    /* "src/lxml/serializer.pxi":1442
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             c_standalone = -1
 *         else:
 */
    goto __pyx_L5;
  }

  /* "src/lxml/serializer.pxi":1445
 *             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:
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1445, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_t_5 = 1;
    } else {
      __pyx_t_5 = 0;
    }
    __pyx_v_c_standalone = __pyx_t_5;
  }
  __pyx_L5:;

  /* "src/lxml/serializer.pxi":1446
 *         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);

  /* "src/lxml/serializer.pxi":1447
 *             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_1 = (__pyx_v_doctype != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1448
 *         _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));

    /* "src/lxml/serializer.pxi":1449
 *         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;

    /* "src/lxml/serializer.pxi":1447
 *             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
 */
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":1451
 *             self._status = WRITER_DTD_WRITTEN
 *         else:
 *             self._status = WRITER_DECL_WRITTEN             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 */
  /*else*/ {
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN;
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":1452
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1453
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1452
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  }

  /* "src/lxml/serializer.pxi":1454
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def write_doctype(self, doctype):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1427
 *             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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/serializer.pxi":1456
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_7write_doctype = {"write_doctype", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doctype,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doctype)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1456, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_doctype") < 0)) __PYX_ERR(10, 1456, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_doctype = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1456, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_doctype);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("write_doctype", 0);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "src/lxml/serializer.pxi":1461
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1461, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1461, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1462
 *         """
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1463
 *         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;

    /* "src/lxml/serializer.pxi":1462
 *         """
 *         assert self._c_out is not NULL
 *         if doctype is None:             # <<<<<<<<<<<<<<
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
 */
  }

  /* "src/lxml/serializer.pxi":1464
 *         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_1 = (__pyx_v_self->_status >= __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1465
 *             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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_DOCTYPE_already_written_or_canno};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1465, __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_ERR(10, 1465, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1464
 *         if doctype is None:
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
 */
  }

  /* "src/lxml/serializer.pxi":1466
 *         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_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1467
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))             # <<<<<<<<<<<<<<
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:
 */
  __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype));

  /* "src/lxml/serializer.pxi":1468
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN;

  /* "src/lxml/serializer.pxi":1469
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1470
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1469
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  }

  /* "src/lxml/serializer.pxi":1471
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def method(self, method):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1456
 *         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_2);
  __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;
}

/* "src/lxml/serializer.pxi":1473
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method, "method(self, method)\n\n        Returns a context manager that overrides and restores the output method.\n        method is one of (None, 'xml', 'html') where None means 'xml'.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_9method = {"method", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_method = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("method (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1473, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "method") < 0)) __PYX_ERR(10, 1473, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_method = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1473, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8method(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_method);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8method(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method) {
  int __pyx_v_c_method;
  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("method", 1);

  /* "src/lxml/serializer.pxi":1479
 *         method is one of (None, 'xml', 'html') where None means 'xml'.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         c_method = self._method if method is None else _findOutputMethod(method)
 *         return _MethodChanger(self, c_method)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1479, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1479, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1480
 *         """
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *         return _MethodChanger(self, c_method)
 * 
 */
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->_method;
  } else {
    __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(10, 1480, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
  }
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1481
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)
 *         return _MethodChanger(self, c_method)             # <<<<<<<<<<<<<<
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_c_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(10, 1481, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(10, 1481, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__MethodChanger), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1481, __pyx_L1_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_L0;

  /* "src/lxml/serializer.pxi":1473
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
 */

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

/* "src/lxml/serializer.pxi":1483
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element, "element(self, tag, attrib=None, nsmap=None, method, **_extra)\n\n        Returns a context manager that writes an opening and closing tag.\n        method is one of (None, 'xml', 'html') where None means 'xml'.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_11element = {"element", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,&__pyx_n_s_method,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1483, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1483, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1483, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1483, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "element") < 0)) __PYX_ERR(10, 1483, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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];
    __pyx_v_method = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, __pyx_nargs); __PYX_ERR(10, 1483, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_10element(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_method, __pyx_v__extra);

  /* function exit code */
  __Pyx_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, 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;
  int __pyx_v_c_method;
  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)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  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("element", 1);

  /* "src/lxml/serializer.pxi":1489
 *         method is one of (None, 'xml', 'html') where None means 'xml'.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         attributes = []
 *         if attrib is not None:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1489, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1489, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1490
 *         """
 *         assert self._c_out is not NULL
 *         attributes = []             # <<<<<<<<<<<<<<
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_attributes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1491
 *         assert self._c_out is not NULL
 *         attributes = []
 *         if attrib is not None:             # <<<<<<<<<<<<<<
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
 */
  __pyx_t_1 = (__pyx_v_attrib != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1492
 *         attributes = []
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__iter_attrib(__pyx_v_attrib); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1492, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1492, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(10, 1492, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1492, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1492, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(10, 1492, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1492, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(10, 1492, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 1492, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        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_ERR(10, 1492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
        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_ERR(10, 1492, __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_ERR(10, 1492, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1493
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:             # <<<<<<<<<<<<<<
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 */
      __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v__extra, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1493, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1494
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1494, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (likely(__pyx_t_2 != Py_None)) {
          PyObject* sequence = __pyx_t_2;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(10, 1494, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          #else
          __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1494, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1494, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 1494, __pyx_L1_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":1495
 *                 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_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_ns);
        __Pyx_GIVEREF(__pyx_v_ns);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns)) __PYX_ERR(10, 1495, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name)) __PYX_ERR(10, 1495, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2)) __PYX_ERR(10, 1495, __pyx_L1_error);
        __pyx_t_2 = 0;
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(10, 1495, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/serializer.pxi":1493
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:             # <<<<<<<<<<<<<<
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 */
      }

      /* "src/lxml/serializer.pxi":1492
 *         attributes = []
 *         if attrib is not None:
 *             for name, value in _iter_attrib(attrib):             # <<<<<<<<<<<<<<
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1491
 *         assert self._c_out is not NULL
 *         attributes = []
 *         if attrib is not None:             # <<<<<<<<<<<<<<
 *             for name, value in _iter_attrib(attrib):
 *                 if name not in _extra:
 */
  }

  /* "src/lxml/serializer.pxi":1496
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:             # <<<<<<<<<<<<<<
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v__extra); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1496, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1497
 *                     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_4 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v__extra, 1, __pyx_n_s_iteritems, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_4, &__pyx_t_6, &__pyx_t_2, NULL, __pyx_t_12);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(10, 1497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":1498
 *         if _extra:
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(__pyx_t_2 != Py_None)) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 1498, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 1498, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1498, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 1498, __pyx_L1_error)
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/serializer.pxi":1499
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))             # <<<<<<<<<<<<<<
 *         reversed_nsmap = {}
 *         if nsmap:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns)) __PYX_ERR(10, 1499, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_name)) __PYX_ERR(10, 1499, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2)) __PYX_ERR(10, 1499, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_7); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(10, 1499, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1496
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:             # <<<<<<<<<<<<<<
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 */
  }

  /* "src/lxml/serializer.pxi":1500
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}             # <<<<<<<<<<<<<<
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_reversed_nsmap = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1501
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 *         if nsmap:             # <<<<<<<<<<<<<<
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1501, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1502
 *         reversed_nsmap = {}
 *         if nsmap:
 *             for prefix, ns in nsmap.items():             # <<<<<<<<<<<<<<
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
 */
    __pyx_t_11 = 0;
    if (unlikely(__pyx_v_nsmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(10, 1502, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_nsmap, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1502, __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_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_4, &__pyx_t_11, &__pyx_t_7, &__pyx_t_2, NULL, __pyx_t_12);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(10, 1502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/serializer.pxi":1503
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:             # <<<<<<<<<<<<<<
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 */
      __pyx_t_1 = (__pyx_v_prefix != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1504
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)             # <<<<<<<<<<<<<<
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1504, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "src/lxml/serializer.pxi":1505
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)             # <<<<<<<<<<<<<<
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)
 */
        __pyx_t_13 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(10, 1505, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1503
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:             # <<<<<<<<<<<<<<
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 */
      }

      /* "src/lxml/serializer.pxi":1506
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix             # <<<<<<<<<<<<<<
 *         ns, name = _getNsTag(tag)
 * 
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely((PyDict_SetItem(__pyx_v_reversed_nsmap, __pyx_t_2, __pyx_v_prefix) < 0))) __PYX_ERR(10, 1506, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1501
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 *         if nsmap:             # <<<<<<<<<<<<<<
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 */
  }

  /* "src/lxml/serializer.pxi":1507
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 * 
 *         c_method = self._method if method is None else _findOutputMethod(method)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 1507, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(10, 1507, __pyx_L1_error)
  }
  __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/serializer.pxi":1509
 *         ns, name = _getNsTag(tag)
 * 
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 * 
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
 */
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_12 = __pyx_v_self->_method;
  } else {
    __pyx_t_13 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(10, 1509, __pyx_L1_error)
    __pyx_t_12 = __pyx_t_13;
  }
  __pyx_v_c_method = __pyx_t_12;

  /* "src/lxml/serializer.pxi":1511
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_attributes);
  __Pyx_GIVEREF(__pyx_v_attributes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_attributes)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_reversed_nsmap);
  __Pyx_GIVEREF(__pyx_v_reversed_nsmap);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_reversed_nsmap)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_c_method); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(10, 1511, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7)) __PYX_ERR(10, 1511, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FileWriterElement), __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1511, __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;

  /* "src/lxml/serializer.pxi":1483
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1513
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             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;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_qname", 1);

  /* "src/lxml/serializer.pxi":1514
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 */
  __pyx_t_1 = (__pyx_v_prefix != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_prefix) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1515
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             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_ERR(10, 1515, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_prefix); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1515, __pyx_L1_error)
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_2, PyBytes_AS_STRING(__pyx_v_prefix)));

    /* "src/lxml/serializer.pxi":1516
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)":")));

    /* "src/lxml/serializer.pxi":1514
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 */
  }

  /* "src/lxml/serializer.pxi":1517
 *             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_ERR(10, 1517, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_GET_SIZE(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1517, __pyx_L1_error)
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_2, PyBytes_AS_STRING(__pyx_v_name)));

  /* "src/lxml/serializer.pxi":1513
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap), c_method)
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix:  # empty bytes for no prefix (not None to allow sorting)
 *             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;
}

/* "src/lxml/serializer.pxi":1519
 *         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;
  int __pyx_t_5;
  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("_write_start_element", 1);

  /* "src/lxml/serializer.pxi":1520
 * 
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1521
 *     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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_cannot_append_trailing_element_t};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1521, __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_ERR(10, 1521, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1520
 * 
 *     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
 */
  }

  /* "src/lxml/serializer.pxi":1522
 *         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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 1522, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    } 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_t_6 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(10, 1522, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_v_element_config); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(10, 1522, __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_ERR(10, 1522, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_attributes = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_nsmap = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1523
 *             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) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_nsmap))) __PYX_ERR(10, 1523, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(__pyx_v_self, ((PyObject*)__pyx_v_nsmap)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 1523, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
    index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < 0) __PYX_ERR(10, 1523, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(10, 1523, __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_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1524
 *         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) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_ns))) __PYX_ERR(10, 1524, __pyx_L1_error)
  if (!(likely(PyDict_CheckExact(__pyx_v_flat_namespace_map))||((__pyx_v_flat_namespace_map) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_flat_namespace_map))) __PYX_ERR(10, 1524, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_new_namespaces))||((__pyx_v_new_namespaces) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_new_namespaces))) __PYX_ERR(10, 1524, __pyx_L1_error)
  __pyx_t_6 = __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_6)) __PYX_ERR(10, 1524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_prefix = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1525
 *         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)
 * 
 */
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)"<")));

  /* "src/lxml/serializer.pxi":1526
 *         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(
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_name))) __PYX_ERR(10, 1526, __pyx_L1_error)
  if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_prefix))) __PYX_ERR(10, 1526, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_prefix)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1529
 * 
 *         self._write_attributes_and_namespaces(
 *             attributes, flat_namespace_map, new_namespaces)             # <<<<<<<<<<<<<<
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 */
  if (!(likely(PyList_CheckExact(__pyx_v_attributes))||((__pyx_v_attributes) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_attributes))) __PYX_ERR(10, 1529, __pyx_L1_error)
  if (!(likely(PyDict_CheckExact(__pyx_v_flat_namespace_map))||((__pyx_v_flat_namespace_map) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_flat_namespace_map))) __PYX_ERR(10, 1529, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_new_namespaces))||((__pyx_v_new_namespaces) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_new_namespaces))) __PYX_ERR(10, 1529, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1528
 *         self._write_qname(name, prefix)
 * 
 *         self._write_attributes_and_namespaces(             # <<<<<<<<<<<<<<
 *             attributes, flat_namespace_map, new_namespaces)
 * 
 */
  __pyx_t_6 = __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_6)) __PYX_ERR(10, 1528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1531
 *             attributes, flat_namespace_map, new_namespaces)
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 */
  (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)">")));

  /* "src/lxml/serializer.pxi":1532
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1533
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1532
 * 
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  }

  /* "src/lxml/serializer.pxi":1534
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1536
 *         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 '%.30s'", "append");
    __PYX_ERR(10, 1536, __pyx_L1_error)
  }
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns)) __PYX_ERR(10, 1536, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name)) __PYX_ERR(10, 1536, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_prefix)) __PYX_ERR(10, 1536, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_flat_namespace_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespace_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_flat_namespace_map)) __PYX_ERR(10, 1536, __pyx_L1_error);
  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_element_stack, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(10, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/serializer.pxi":1537
 * 
 *         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;

  /* "src/lxml/serializer.pxi":1519
 *         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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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;
}

/* "src/lxml/serializer.pxi":1539
 *         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_9genexpr15__pyx_v_ns = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_name = NULL;
  PyObject *__pyx_9genexpr15__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);

  /* "src/lxml/serializer.pxi":1542
 *                                           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) {

    /* "src/lxml/serializer.pxi":1544
 *         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 ]
 */
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1544, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "src/lxml/serializer.pxi":1546
 *             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_ERR(10, 1546, __pyx_L6_error)
      }
      __pyx_t_3 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1546, __pyx_L6_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(10, 1546, __pyx_L6_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1546, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 3)) {
            if (size > 3) __Pyx_RaiseTooManyValuesError(3);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(10, 1546, __pyx_L6_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          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_ERR(10, 1546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 1546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1546, __pyx_L6_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_ERR(10, 1546, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
          index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L9_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_L9_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_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(10, 1546, __pyx_L6_error)
          __pyx_t_10 = NULL;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_10 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(10, 1546, __pyx_L6_error)
          __pyx_L10_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_ns, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_name, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_value, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":1545
 *             # _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_9genexpr15__pyx_v_ns))||((__pyx_9genexpr15__pyx_v_ns) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_9genexpr15__pyx_v_ns))) __PYX_ERR(10, 1545, __pyx_L6_error)
        __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(__pyx_v_self, ((PyObject*)__pyx_9genexpr15__pyx_v_ns), __pyx_v_flat_namespace_map, __pyx_v_new_namespaces); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1545, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1545, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_5);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(10, 1545, __pyx_L6_error);
        __Pyx_INCREF(__pyx_9genexpr15__pyx_v_name);
        __Pyx_GIVEREF(__pyx_9genexpr15__pyx_v_name);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_9genexpr15__pyx_v_name)) __PYX_ERR(10, 1545, __pyx_L6_error);
        __Pyx_INCREF(__pyx_9genexpr15__pyx_v_value);
        __Pyx_GIVEREF(__pyx_9genexpr15__pyx_v_value);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_9genexpr15__pyx_v_value)) __PYX_ERR(10, 1545, __pyx_L6_error);
        __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(10, 1544, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "src/lxml/serializer.pxi":1546
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]             # <<<<<<<<<<<<<<
 *         if new_namespaces:
 *             new_namespaces.sort()
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_name); __pyx_9genexpr15__pyx_v_name = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_ns); __pyx_9genexpr15__pyx_v_ns = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_value); __pyx_9genexpr15__pyx_v_value = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_name); __pyx_9genexpr15__pyx_v_name = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_ns); __pyx_9genexpr15__pyx_v_ns = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_value); __pyx_9genexpr15__pyx_v_value = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_attributes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1542
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 *         if attributes:             # <<<<<<<<<<<<<<
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
 */
  }

  /* "src/lxml/serializer.pxi":1547
 *                 (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) {

    /* "src/lxml/serializer.pxi":1548
 *                 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 '%.30s'", "sort");
      __PYX_ERR(10, 1548, __pyx_L1_error)
    }
    __pyx_t_11 = PyList_Sort(__pyx_v_new_namespaces); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(10, 1548, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1549
 *         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_ERR(10, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1547
 *                 (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)
 */
  }

  /* "src/lxml/serializer.pxi":1550
 *             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) {

    /* "src/lxml/serializer.pxi":1551
 *             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_ERR(10, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1550
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(attributes)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1539
 *         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_9genexpr15__pyx_v_ns);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_name);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1553
 *             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", 1);

  /* "src/lxml/serializer.pxi":1554
 * 
 *     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_ERR(10, 1554, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1554, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(10, 1554, __pyx_L1_error)
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(10, 1554, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(10, 1554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1554, __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_ERR(10, 1554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      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_ERR(10, 1554, __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_ERR(10, 1554, __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;

    /* "src/lxml/serializer.pxi":1555
 *     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, '="')
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)" ")));

    /* "src/lxml/serializer.pxi":1556
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             _write_attr_string(self._c_out, _cstr(value))
 */
    if (!(likely(PyBytes_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_name))) __PYX_ERR(10, 1556, __pyx_L1_error)
    if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_prefix))) __PYX_ERR(10, 1556, __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_ERR(10, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1557
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')             # <<<<<<<<<<<<<<
 *             _write_attr_string(self._c_out, _cstr(value))
 * 
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, ((const char *)"=\"")));

    /* "src/lxml/serializer.pxi":1558
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             _write_attr_string(self._c_out, _cstr(value))             # <<<<<<<<<<<<<<
 * 
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__write_attr_string(__pyx_v_self->_c_out, PyBytes_AS_STRING(__pyx_v_value)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1560
 *             _write_attr_string(self._c_out, _cstr(value))
 * 
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_end_element(self, element_config):
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)"\"")));

    /* "src/lxml/serializer.pxi":1554
 * 
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1553
 *             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;
}

/* "src/lxml/serializer.pxi":1562
 *             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_ok_to_write = NULL;
  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;
  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)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_end_element", 1);

  /* "src/lxml/serializer.pxi":1563
 * 
 *     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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1564
 *     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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_not_in_an_element};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1564, __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_ERR(10, 1564, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1563
 * 
 *     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]:
 */
  }

  /* "src/lxml/serializer.pxi":1565
 *         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_6 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  __pyx_t_7 = (!__pyx_t_6);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(10, 1565, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 2, NULL, NULL, &__pyx_slice__80, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_element_config, 0, 2, NULL, NULL, &__pyx_slice__80, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/serializer.pxi":1566
 *             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")             # <<<<<<<<<<<<<<
 * 
 *         # If previous write operations failed, the context manager exit might still call us.
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_inconsistent_exit_action_in_cont};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1566, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(10, 1566, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1565
 *         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")
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1571
 *         # That is ok, but we stop writing closing tags and handling errors in that case.
 *         # For all non-I/O errors, we continue writing closing tags if we can.
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_self->_c_out->error == XML_ERR_OK)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_ok_to_write = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1573
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(10, 1573, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_Pop(__pyx_v_self->_element_stack); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_4, 1, 3, NULL, NULL, &__pyx_slice__81, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(10, 1573, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
    index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(10, 1573, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(10, 1573, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_name = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_prefix = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1574
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ok_to_write); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1574, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1575
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')             # <<<<<<<<<<<<<<
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, ((const char *)"</")));

    /* "src/lxml/serializer.pxi":1576
 *         if ok_to_write:
 *             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) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_name))) __PYX_ERR(10, 1576, __pyx_L1_error)
    if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_prefix))) __PYX_ERR(10, 1576, __pyx_L1_error)
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_prefix)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1577
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 * 
 *         if not self._element_stack:
 */
    (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, ((const char *)">")));

    /* "src/lxml/serializer.pxi":1574
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *             self._write_qname(name, prefix)
 */
  }

  /* "src/lxml/serializer.pxi":1579
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 *         if not self._element_stack:             # <<<<<<<<<<<<<<
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 */
  __pyx_t_1 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  __pyx_t_7 = (!__pyx_t_1);
  if (__pyx_t_7) {

    /* "src/lxml/serializer.pxi":1580
 * 
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             if not self._buffered:
 */
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

    /* "src/lxml/serializer.pxi":1579
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 *         if not self._element_stack:             # <<<<<<<<<<<<<<
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 */
  }

  /* "src/lxml/serializer.pxi":1581
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_ok_to_write); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(10, 1581, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "src/lxml/serializer.pxi":1582
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 *             if not self._buffered:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
 */
    __pyx_t_7 = (!__pyx_v_self->_buffered);
    if (__pyx_t_7) {

      /* "src/lxml/serializer.pxi":1583
 *         if ok_to_write:
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 * 
 */
      (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

      /* "src/lxml/serializer.pxi":1582
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:
 *             if not self._buffered:             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
 */
    }

    /* "src/lxml/serializer.pxi":1584
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1581
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED
 *         if ok_to_write:             # <<<<<<<<<<<<<<
 *             if not self._buffered:
 *                 tree.xmlOutputBufferFlush(self._c_out)
 */
  }

  /* "src/lxml/serializer.pxi":1562
 *             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_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_end_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ok_to_write);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1586
 *             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;
  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_prefix", 1);

  /* "src/lxml/serializer.pxi":1587
 * 
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1588
 *     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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1587
 * 
 *     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:
 */
  }

  /* "src/lxml/serializer.pxi":1589
 *         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_ERR(10, 1589, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_href, __pyx_v_flat_namespaces_map, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1589, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1590
 *             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_ERR(10, 1590, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_flat_namespaces_map, __pyx_v_href); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1589
 *         if href is None:
 *             return None
 *         if href in flat_namespaces_map:             # <<<<<<<<<<<<<<
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
 */
  }

  /* "src/lxml/serializer.pxi":1592
 *             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 '%.30s'", "values");
    __PYX_ERR(10, 1592, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_Values(__pyx_v_flat_namespaces_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefixes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1593
 *         # 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;

  /* "src/lxml/serializer.pxi":1594
 *         prefixes = flat_namespaces_map.values()
 *         i = 0
 *         while True:             # <<<<<<<<<<<<<<
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:
 */
  while (1) {

    /* "src/lxml/serializer.pxi":1595
 *         i = 0
 *         while True:
 *             prefix = _utf8('ns%d' % i)             # <<<<<<<<<<<<<<
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))
 */
    __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_ns_d, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1596
 *         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_ContainsTF(__pyx_v_prefix, __pyx_v_prefixes, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1596, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1597
 *             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 '%.30s'", "append");
        __PYX_ERR(10, 1597, __pyx_L1_error)
      }
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_b_xmlns_2)) __PYX_ERR(10, 1597, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_prefix)) __PYX_ERR(10, 1597, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_href)) __PYX_ERR(10, 1597, __pyx_L1_error);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(10, 1597, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/serializer.pxi":1598
 *             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_ERR(10, 1598, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_href, __pyx_v_prefix) < 0))) __PYX_ERR(10, 1598, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1599
 *                 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;

      /* "src/lxml/serializer.pxi":1596
 *         while True:
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:             # <<<<<<<<<<<<<<
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
 */
    }

    /* "src/lxml/serializer.pxi":1600
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef _collect_namespaces(self, dict nsmap):
 */
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "src/lxml/serializer.pxi":1586
 *             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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/serializer.pxi":1602
 *             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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collect_namespaces", 1);

  /* "src/lxml/serializer.pxi":1603
 * 
 *     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_ERR(10, 1603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1604
 *     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 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_flat_namespaces_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1605
 *         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 '%.30s'", "iteritems");
    __PYX_ERR(10, 1605, __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_ERR(10, 1605, __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_ERR(10, 1605, __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;

    /* "src/lxml/serializer.pxi":1606
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix             # <<<<<<<<<<<<<<
 *             if prefix is None:
 *                 # use empty bytes rather than None to allow sorting
 */
    if (unlikely((PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_ns, __pyx_v_prefix) < 0))) __PYX_ERR(10, 1606, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1607
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))
 */
    __pyx_t_8 = (__pyx_v_prefix == Py_None);
    if (__pyx_t_8) {

      /* "src/lxml/serializer.pxi":1609
 *             if prefix is None:
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))             # <<<<<<<<<<<<<<
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))
 */
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_kp_b__12);
      __Pyx_GIVEREF(__pyx_kp_b__12);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_b__12)) __PYX_ERR(10, 1609, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_b_xmlns_2)) __PYX_ERR(10, 1609, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns)) __PYX_ERR(10, 1609, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(10, 1609, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":1607
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 # use empty bytes rather than None to allow sorting
 *                 new_namespaces.append((b'', b'xmlns', ns))
 */
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1611
 *                 new_namespaces.append((b'', b'xmlns', ns))
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))             # <<<<<<<<<<<<<<
 *         # merge in flat namespace map of parent
 *         if self._element_stack:
 */
    /*else*/ {
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_n_b_xmlns_2);
      __Pyx_GIVEREF(__pyx_n_b_xmlns_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_b_xmlns_2)) __PYX_ERR(10, 1611, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_prefix)) __PYX_ERR(10, 1611, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns)) __PYX_ERR(10, 1611, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(10, 1611, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1613
 *                 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_8 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_8) {

    /* "src/lxml/serializer.pxi":1614
 *         # 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_ERR(10, 1614, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 1614, __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 '%.30s'", "iteritems");
      __PYX_ERR(10, 1614, __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_ERR(10, 1614, __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_ERR(10, 1614, __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;

      /* "src/lxml/serializer.pxi":1615
 *         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_ERR(10, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {

        /* "src/lxml/serializer.pxi":1617
 *                 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_ERR(10, 1617, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1615
 *         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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/serializer.pxi":1613
 *                 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:
 */
  }

  /* "src/lxml/serializer.pxi":1618
 *                     # 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, method=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_flat_namespaces_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespaces_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flat_namespaces_map)) __PYX_ERR(10, 1618, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_new_namespaces);
  __Pyx_GIVEREF(__pyx_v_new_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new_namespaces)) __PYX_ERR(10, 1618, __pyx_L1_error);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1602
 *             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;
}

/* "src/lxml/serializer.pxi":1620
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write, "write(self, *args, with_tail=True, pretty_print=False, method=None)\n\n        Write subtrees or strings into the file.\n\n        If method is not None, it should be one of ('html', 'xml', 'text')\n        to temporarily override the output method.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_13write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_with_tail;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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 CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_with_tail,&__pyx_n_s_pretty_print,&__pyx_n_s_method,0};
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 0; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1620, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "write") < 0)) __PYX_ERR(10, 1620, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 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_ERR(10, 1620, __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_ERR(10, 1620, __pyx_L3_error)
    } else {
      __pyx_v_pretty_print = ((int)0);
    }
    __pyx_v_method = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 0, 0, __pyx_nargs); __PYX_ERR(10, 1620, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_12write(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_with_tail, __pyx_v_pretty_print, __pyx_v_method, __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_12write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args) {
  int __pyx_v_c_method;
  PyObject *__pyx_v_content = NULL;
  PyObject *__pyx_v_bstring = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  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)(PyObject *);
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_UCS4 __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 1);

  /* "src/lxml/serializer.pxi":1628
 *         to temporarily override the output method.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1628, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1628, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1629
 *         """
 *         assert self._c_out is not NULL
 *         c_method = self._method if method is None else _findOutputMethod(method)             # <<<<<<<<<<<<<<
 * 
 *         for content in args:
 */
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->_method;
  } else {
    __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(10, 1629, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
  }
  __pyx_v_c_method = __pyx_t_2;

  /* "src/lxml/serializer.pxi":1631
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         for content in args:             # <<<<<<<<<<<<<<
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 */
  __pyx_t_4 = __pyx_v_args; __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(10, 1631, __pyx_L1_error)
      #endif
      if (__pyx_t_5 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(10, 1631, __pyx_L1_error)
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_content, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":1632
 * 
 *         for content in args:
 *             if _isString(content):             # <<<<<<<<<<<<<<
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 */
    __pyx_t_1 = _isString(__pyx_v_content);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1633
 *         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_1 = (__pyx_v_self->_status != __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
      if (__pyx_t_1) {

        /* "src/lxml/serializer.pxi":1634
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():             # <<<<<<<<<<<<<<
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 */
        __pyx_t_7 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
        if (!__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_strip); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1634, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = NULL;
        __pyx_t_2 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_2 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_2, 0+__pyx_t_2);
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1634, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(10, 1634, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L8_bool_binop_done:;
        if (unlikely(__pyx_t_1)) {

          /* "src/lxml/serializer.pxi":1635
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *                 bstring = _utf8(content)
 *                 if not bstring:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 1635, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = NULL;
          __pyx_t_2 = 0;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_9)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_9);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
              __pyx_t_2 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_u_not_in_an_element};
            __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_2, 1+__pyx_t_2);
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1635, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          __Pyx_Raise(__pyx_t_6, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __PYX_ERR(10, 1635, __pyx_L1_error)

          /* "src/lxml/serializer.pxi":1634
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():             # <<<<<<<<<<<<<<
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 */
        }

        /* "src/lxml/serializer.pxi":1633
 *         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")
 */
      }

      /* "src/lxml/serializer.pxi":1636
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)             # <<<<<<<<<<<<<<
 *                 if not bstring:
 *                     continue
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree__utf8(__pyx_v_content); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1636, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_bstring, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":1637
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 *                 if not bstring:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_1 = (__pyx_v_bstring != Py_None)&&(PyBytes_GET_SIZE(__pyx_v_bstring) != 0);
      __pyx_t_7 = (!__pyx_t_1);
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1638
 *                 bstring = _utf8(content)
 *                 if not bstring:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 */
        goto __pyx_L3_continue;

        /* "src/lxml/serializer.pxi":1637
 *                         raise LxmlSyntaxError("not in an element")
 *                 bstring = _utf8(content)
 *                 if not bstring:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "src/lxml/serializer.pxi":1640
 *                     continue
 * 
 *                 ns, name, _, _ = self._element_stack[-1]             # <<<<<<<<<<<<<<
 *                 if (c_method == OUTPUT_METHOD_HTML and
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 */
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(10, 1640, __pyx_L1_error)
      }
      __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(10, 1640, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(10, 1640, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
        __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 4) < 0) __PYX_ERR(10, 1640, __pyx_L1_error)
        __pyx_t_13 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(10, 1640, __pyx_L1_error)
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v__, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "src/lxml/serializer.pxi":1641
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
 */
      __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
      if (__pyx_t_1) {
      } else {
        __pyx_t_7 = __pyx_t_1;
        goto __pyx_L14_bool_binop_done;
      }

      /* "src/lxml/serializer.pxi":1642
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and             # <<<<<<<<<<<<<<
 *                         name in (b'script', b'style')):
 *                     tree.xmlOutputBufferWrite(self._c_out, len(bstring), _cstr(bstring))
 */
      __Pyx_INCREF(__pyx_v_ns);
      __pyx_t_6 = __pyx_v_ns;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_6, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 1642, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(10, 1642, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!__pyx_t_14) {
      } else {
        __pyx_t_1 = __pyx_t_14;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_14 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_kp_b_http_www_w3_org_1999_xhtml, Py_EQ)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(10, 1642, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_14;
      __pyx_L17_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_14 = __pyx_t_1;
      if (__pyx_t_14) {
      } else {
        __pyx_t_7 = __pyx_t_14;
        goto __pyx_L14_bool_binop_done;
      }

      /* "src/lxml/serializer.pxi":1643
 *                 if (c_method == OUTPUT_METHOD_HTML and
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):             # <<<<<<<<<<<<<<
 *                     tree.xmlOutputBufferWrite(self._c_out, len(bstring), _cstr(bstring))
 * 
 */
      __Pyx_INCREF(__pyx_v_name);
      __pyx_t_6 = __pyx_v_name;
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_n_b_script, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1643, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_14 = __pyx_t_1;
        goto __pyx_L19_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_n_b_style, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(10, 1643, __pyx_L1_error)
      __pyx_t_14 = __pyx_t_1;
      __pyx_L19_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __pyx_t_14;
      __pyx_t_7 = __pyx_t_1;
      __pyx_L14_bool_binop_done:;

      /* "src/lxml/serializer.pxi":1641
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
 */
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1644
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
 *                     tree.xmlOutputBufferWrite(self._c_out, len(bstring), _cstr(bstring))             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
        if (unlikely(__pyx_v_bstring == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(10, 1644, __pyx_L1_error)
        }
        __pyx_t_15 = __Pyx_PyBytes_GET_SIZE(__pyx_v_bstring); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1644, __pyx_L1_error)
        (void)(xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_15, PyBytes_AS_STRING(__pyx_v_bstring)));

        /* "src/lxml/serializer.pxi":1641
 * 
 *                 ns, name, _, _ = self._element_stack[-1]
 *                 if (c_method == OUTPUT_METHOD_HTML and             # <<<<<<<<<<<<<<
 *                         ns in (None, b'http://www.w3.org/1999/xhtml') and
 *                         name in (b'script', b'style')):
 */
        goto __pyx_L13;
      }

      /* "src/lxml/serializer.pxi":1647
 * 
 *                 else:
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)             # <<<<<<<<<<<<<<
 * 
 *             elif iselement(content):
 */
      /*else*/ {
        (void)(xmlOutputBufferWriteEscape(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_bstring), NULL));
      }
      __pyx_L13:;

      /* "src/lxml/serializer.pxi":1632
 * 
 *         for content in args:
 *             if _isString(content):             # <<<<<<<<<<<<<<
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 */
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1649
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)
 * 
 *             elif iselement(content):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_iselement); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = NULL;
    __pyx_t_2 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_2 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_content};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_2, 1+__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1649, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(10, 1649, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {

      /* "src/lxml/serializer.pxi":1650
 * 
 *             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);
      if (unlikely(__pyx_t_7)) {

        /* "src/lxml/serializer.pxi":1651
 *             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, c_method,
 */
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 1651, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_10 = NULL;
        __pyx_t_2 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_2 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_kp_u_cannot_append_trailing_element_t};
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_2, 1+__pyx_t_2);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1651, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(10, 1651, __pyx_L1_error)

        /* "src/lxml/serializer.pxi":1650
 * 
 *             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,
 */
      }

      /* "src/lxml/serializer.pxi":1652
 *                 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, c_method,
 *                                    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_v_c_method, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, 0);

      /* "src/lxml/serializer.pxi":1655
 *                                    self._c_encoding, NULL, c_method,
 *                                    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);
      if (__pyx_t_7) {

        /* "src/lxml/serializer.pxi":1656
 *                                    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 = (__pyx_v_self->_element_stack != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
        __pyx_t_1 = (!__pyx_t_7);
        if (__pyx_t_1) {

          /* "src/lxml/serializer.pxi":1657
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 * 
 *             elif content is not None:
 */
          __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

          /* "src/lxml/serializer.pxi":1656
 *                                    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
 * 
 */
        }

        /* "src/lxml/serializer.pxi":1655
 *                                    self._c_encoding, NULL, c_method,
 *                                    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
 */
      }

      /* "src/lxml/serializer.pxi":1649
 *                     tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(bstring), NULL)
 * 
 *             elif iselement(content):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 */
      goto __pyx_L5;
    }

    /* "src/lxml/serializer.pxi":1659
 *                         self._status = WRITER_FINISHED
 * 
 *             elif content is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 */
    __pyx_t_1 = (__pyx_v_content != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1661
 *             elif content is not None:
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string or Element")             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 *         if not self._buffered:
 */
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = 0;
      __pyx_t_16 = 127;
      __Pyx_INCREF(__pyx_kp_u_got_invalid_input_value_of_type);
      __pyx_t_15 += 32;
      __Pyx_GIVEREF(__pyx_kp_u_got_invalid_input_value_of_type);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_got_invalid_input_value_of_type);
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_content)), __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_16 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_16) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_16;
      __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_INCREF(__pyx_kp_u_expected_string_or_Element);
      __pyx_t_15 += 28;
      __Pyx_GIVEREF(__pyx_kp_u_expected_string_or_Element);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_expected_string_or_Element);
      __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/serializer.pxi":1660
 * 
 *             elif content is not None:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 *             self._handle_error(self._c_out.error)
 */
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(10, 1660, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1659
 *                         self._status = WRITER_FINISHED
 * 
 *             elif content is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 */
    }
    __pyx_L5:;

    /* "src/lxml/serializer.pxi":1662
 *                 raise TypeError(
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 1662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/serializer.pxi":1631
 *         c_method = self._method if method is None else _findOutputMethod(method)
 * 
 *         for content in args:             # <<<<<<<<<<<<<<
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1663
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 *             self._handle_error(self._c_out.error)
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
 */
  __pyx_t_1 = (!__pyx_v_self->_buffered);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1664
 *             self._handle_error(self._c_out.error)
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 * 
 */
    (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

    /* "src/lxml/serializer.pxi":1665
 *         if not self._buffered:
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def flush(self):
 */
    __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_ERR(10, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/serializer.pxi":1663
 *                     f"got invalid input value of type {type(content)}, expected string or Element")
 *             self._handle_error(self._c_out.error)
 *         if not self._buffered:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferFlush(self._c_out)
 *             self._handle_error(self._c_out.error)
 */
  }

  /* "src/lxml/serializer.pxi":1620
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_content);
  __Pyx_XDECREF(__pyx_v_bstring);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1667
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush, "flush(self)\n\n        Write any pending content of the current output buffer to the stream.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_15flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush};
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_14flush(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__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("flush", 1);

  /* "src/lxml/serializer.pxi":1672
 *         Write any pending content of the current output buffer to the stream.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_out != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 1672, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 1672, __pyx_L1_error)
  #endif

  /* "src/lxml/serializer.pxi":1673
 *         """
 *         assert self._c_out is not NULL
 *         tree.xmlOutputBufferFlush(self._c_out)             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
  (void)(xmlOutputBufferFlush(__pyx_v_self->_c_out));

  /* "src/lxml/serializer.pxi":1674
 *         assert self._c_out is not NULL
 *         tree.xmlOutputBufferFlush(self._c_out)
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _close(self, bint raise_on_error):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1667
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
 */

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

/* "src/lxml/serializer.pxi":1676
 *         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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 1);

  /* "src/lxml/serializer.pxi":1677
 * 
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 */
  if (__pyx_v_raise_on_error) {

    /* "src/lxml/serializer.pxi":1678
 *     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);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1679
 *         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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_no_content_written};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1679, __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_ERR(10, 1679, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1678
 *     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:
 */
    }

    /* "src/lxml/serializer.pxi":1680
 *             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 (unlikely(__pyx_t_1)) {

      /* "src/lxml/serializer.pxi":1681
 *                 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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_pending_open_tags_on_close};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1681, __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_ERR(10, 1681, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1680
 *             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
 */
    }

    /* "src/lxml/serializer.pxi":1677
 * 
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 */
  }

  /* "src/lxml/serializer.pxi":1682
 *             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_5 = __pyx_v_self->_c_out->error;
  __pyx_v_error_result = __pyx_t_5;

  /* "src/lxml/serializer.pxi":1683
 *                 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 != -1:
 */
  __pyx_t_1 = (__pyx_v_error_result == XML_ERR_OK);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1684
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *             if error_result != -1:
 *                 error_result = xmlerror.XML_ERR_OK
 */
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_self->_c_out);

    /* "src/lxml/serializer.pxi":1685
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:             # <<<<<<<<<<<<<<
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 */
    __pyx_t_1 = (__pyx_v_error_result != -1L);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1686
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:
 *                 error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)
 */
      __pyx_v_error_result = XML_ERR_OK;

      /* "src/lxml/serializer.pxi":1685
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result != -1:             # <<<<<<<<<<<<<<
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 */
    }

    /* "src/lxml/serializer.pxi":1683
 *                 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 != -1:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/serializer.pxi":1688
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL
 */
  /*else*/ {
    (void)(xmlOutputBufferClose(__pyx_v_self->_c_out));
  }
  __pyx_L6:;

  /* "src/lxml/serializer.pxi":1689
 *         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;

  /* "src/lxml/serializer.pxi":1690
 *             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;

  /* "src/lxml/serializer.pxi":1691
 *         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_ERR(10, 1691, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_element_stack, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(10, 1691, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1692
 *         self._c_out = NULL
 *         del self._element_stack[:]
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             self._handle_error(error_result)
 * 
 */
  if (__pyx_v_raise_on_error) {

    /* "src/lxml/serializer.pxi":1693
 *         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_ERR(10, 1693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/serializer.pxi":1692
 *         self._c_out = NULL
 *         del self._element_stack[:]
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             self._handle_error(error_result)
 * 
 */
  }

  /* "src/lxml/serializer.pxi":1676
 *         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_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/serializer.pxi":1695
 *             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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_error", 1);

  /* "src/lxml/serializer.pxi":1696
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1697
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/serializer.pxi":1698
 *         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_2 = ((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_2 == ((int)-1))) __PYX_ERR(10, 1698, __pyx_L1_error)

      /* "src/lxml/serializer.pxi":1697
 *     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)
 */
    }

    /* "src/lxml/serializer.pxi":1699
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/serializer.pxi":1696
 * 
 *     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()
 */
  }

  /* "src/lxml/serializer.pxi":1695
 *             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_3);
  __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;
}

/* "src/lxml/serializer.pxi":1706
 * cdef class _AsyncDataWriter:
 *     cdef list _data
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._data = []
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_16_AsyncDataWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__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__", 1);

  /* "src/lxml/serializer.pxi":1707
 *     cdef list _data
 *     def __cinit__(self):
 *         self._data = []             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes collect(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1707, __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;

  /* "src/lxml/serializer.pxi":1706
 * cdef class _AsyncDataWriter:
 *     cdef list _data
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._data = []
 * 
 */

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

/* "src/lxml/serializer.pxi":1709
 *         self._data = []
 * 
 *     cdef bytes collect(self):             # <<<<<<<<<<<<<<
 *         data = b''.join(self._data)
 *         del self._data[:]
 */

static PyObject *__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self) {
  PyObject *__pyx_v_data = NULL;
  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("collect", 1);

  /* "src/lxml/serializer.pxi":1710
 * 
 *     cdef bytes collect(self):
 *         data = b''.join(self._data)             # <<<<<<<<<<<<<<
 *         del self._data[:]
 *         return data
 */
  __pyx_t_1 = __pyx_v_self->_data;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBytes_Join(__pyx_kp_b__12, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1710, __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;

  /* "src/lxml/serializer.pxi":1711
 *     cdef bytes collect(self):
 *         data = b''.join(self._data)
 *         del self._data[:]             # <<<<<<<<<<<<<<
 *         return data
 * 
 */
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(10, 1711, __pyx_L1_error)
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(10, 1711, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1712
 *         data = b''.join(self._data)
 *         del self._data[:]
 *         return data             # <<<<<<<<<<<<<<
 * 
 *     def write(self, data):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_data))) __PYX_ERR(10, 1712, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_data);
  __pyx_r = ((PyObject*)__pyx_v_data);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1709
 *         self._data = []
 * 
 *     cdef bytes collect(self):             # <<<<<<<<<<<<<<
 *         data = b''.join(self._data)
 *         del self._data[:]
 */

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

/* "src/lxml/serializer.pxi":1714
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16_AsyncDataWriter_3write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1714, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(10, 1714, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1714, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_2write(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__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("write", 1);

  /* "src/lxml/serializer.pxi":1715
 * 
 *     def write(self, data):
 *         self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(10, 1715, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 1715, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1714
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncDataWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1717
 *         self._data.append(data)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_16_AsyncDataWriter_5close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_16_AsyncDataWriter_4close(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__AsyncDataWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 1);

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

/* "src/lxml/serializer.pxi":1731
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_async_outfile = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_compresslevel;
  int __pyx_v_close;
  int __pyx_v_buffered;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_async_outfile,&__pyx_n_s_encoding,&__pyx_n_s_compresslevel,&__pyx_n_s_close,&__pyx_n_s_buffered,&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_async_outfile)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); __PYX_ERR(10, 1731, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compresslevel)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); __PYX_ERR(10, 1731, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_close)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); __PYX_ERR(10, 1731, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffered)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); __PYX_ERR(10, 1731, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); __PYX_ERR(10, 1731, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 1731, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
      values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
      values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
    }
    __pyx_v_async_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_ERR(10, 1731, __pyx_L3_error)
    __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1731, __pyx_L3_error)
    __pyx_v_buffered = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_buffered == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1732, __pyx_L3_error)
    __pyx_v_method = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1732, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, __pyx_nargs); __PYX_ERR(10, 1731, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.__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_ERR(10, 1731, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_async_outfile, __pyx_v_encoding, __pyx_v_compresslevel, __pyx_v_close, __pyx_v_buffered, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_async_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel, int __pyx_v_close, int __pyx_v_buffered, int __pyx_v_method) {
  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("__cinit__", 1);

  /* "src/lxml/serializer.pxi":1733
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20             # <<<<<<<<<<<<<<
 *         self._async_outfile = async_outfile
 *         self._should_close = close
 */
  __pyx_v_self->_flush_after_writes = 20;

  /* "src/lxml/serializer.pxi":1734
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
 *         self._async_outfile = async_outfile             # <<<<<<<<<<<<<<
 *         self._should_close = close
 *         self._buffered = buffered
 */
  __Pyx_INCREF(__pyx_v_async_outfile);
  __Pyx_GIVEREF(__pyx_v_async_outfile);
  __Pyx_GOTREF(__pyx_v_self->_async_outfile);
  __Pyx_DECREF(__pyx_v_self->_async_outfile);
  __pyx_v_self->_async_outfile = __pyx_v_async_outfile;

  /* "src/lxml/serializer.pxi":1735
 *         self._flush_after_writes = 20
 *         self._async_outfile = async_outfile
 *         self._should_close = close             # <<<<<<<<<<<<<<
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
 */
  __pyx_v_self->_should_close = __pyx_v_close;

  /* "src/lxml/serializer.pxi":1736
 *         self._async_outfile = async_outfile
 *         self._should_close = close
 *         self._buffered = buffered             # <<<<<<<<<<<<<<
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(
 */
  __pyx_v_self->_buffered = __pyx_v_buffered;

  /* "src/lxml/serializer.pxi":1737
 *         self._should_close = close
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()             # <<<<<<<<<<<<<<
 *         self._writer = _IncrementalFileWriter(
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__AsyncDataWriter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_buffer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_buffer);
  __pyx_v_self->_buffer = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1739
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes _flush(self):
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_compresslevel); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/serializer.pxi":1738
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 */
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_buffer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_buffer);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->_buffer))) __PYX_ERR(10, 1738, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_encoding)) __PYX_ERR(10, 1738, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1)) __PYX_ERR(10, 1738, __pyx_L1_error);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1739
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes _flush(self):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_close, Py_True) < 0) __PYX_ERR(10, 1739, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_buffered, Py_False) < 0) __PYX_ERR(10, 1739, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_method); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_method, __pyx_t_3) < 0) __PYX_ERR(10, 1739, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1738
 *         self._buffered = buffered
 *         self._buffer = _AsyncDataWriter()
 *         self._writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1738, __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_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1731
 *     cdef bint _buffered
 * 
 *     def __cinit__(self, async_outfile, bytes encoding, int compresslevel, bint close,             # <<<<<<<<<<<<<<
 *                   bint buffered, int method):
 *         self._flush_after_writes = 20
 */

  /* 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._AsyncIncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1741
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 *     cdef bytes _flush(self):             # <<<<<<<<<<<<<<
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
 */

static PyObject *__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 1);

  /* "src/lxml/serializer.pxi":1742
 * 
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:             # <<<<<<<<<<<<<<
 *             return self._buffer.collect()
 *         return None
 */
  __pyx_t_2 = (!__pyx_v_self->_buffered);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __pyx_v_self->_buffer->_data;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(10, 1742, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(10, 1742, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_4 > __pyx_v_self->_flush_after_writes);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/serializer.pxi":1743
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_v_self->_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "src/lxml/serializer.pxi":1742
 * 
 *     cdef bytes _flush(self):
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:             # <<<<<<<<<<<<<<
 *             return self._buffer.collect()
 *         return None
 */
  }

  /* "src/lxml/serializer.pxi":1744
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     async def flush(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/serializer.pxi":1741
 *             self._buffer, encoding, compresslevel, close=True, buffered=False, method=method)
 * 
 *     cdef bytes _flush(self):             # <<<<<<<<<<<<<<
 *         if not self._buffered or len(self._buffer._data) > self._flush_after_writes:
 *             return self._buffer.collect()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1746
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_2flush(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flush", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1746, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4, __pyx_codeobj__82, (PyObject *) __pyx_cur_scope, __pyx_n_s_flush, __pyx_n_s_AsyncIncrementalFileWriter_flus, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1746, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1747
 * 
 *     async def flush(self):
 *         self._writer.flush()             # <<<<<<<<<<<<<<
 *         data = self._buffer.collect()
 *         if data:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer), __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1747, __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;

  /* "src/lxml/serializer.pxi":1748
 *     async def flush(self):
 *         self._writer.flush()
 *         data = self._buffer.collect()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_cur_scope->__pyx_v_self->_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1749
 *         self._writer.flush()
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  __pyx_t_5 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_5) {

    /* "src/lxml/serializer.pxi":1750
 *         data = self._buffer.collect()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1750, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1750, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1749
 *         self._writer.flush()
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1746
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1752
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration = {"write_declaration", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_version,&__pyx_n_s_standalone,&__pyx_n_s_doctype,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_version);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1752, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_standalone);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1752, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doctype);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1752, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_declaration") < 0)) __PYX_ERR(10, 1752, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_declaration", 0, 0, 3, __pyx_nargs); __PYX_ERR(10, 1752, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_version, __pyx_v_standalone, __pyx_v_doctype);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_5write_declaration(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_declaration", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1752, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_version = __pyx_v_version;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_version);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_version);
  __pyx_cur_scope->__pyx_v_standalone = __pyx_v_standalone;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_standalone);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_standalone);
  __pyx_cur_scope->__pyx_v_doctype = __pyx_v_doctype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_doctype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_doctype);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5, __pyx_codeobj__83, (PyObject *) __pyx_cur_scope, __pyx_n_s_write_declaration, __pyx_n_s_AsyncIncrementalFileWriter_writ, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1752, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_declaration", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1752, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1753
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
 *         self._writer.write_declaration(version, standalone, doctype)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer), __pyx_n_s_write_declaration); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_version, __pyx_cur_scope->__pyx_v_standalone, __pyx_cur_scope->__pyx_v_doctype};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1753, __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;

  /* "src/lxml/serializer.pxi":1754
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1755
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  __pyx_t_5 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_5) {

    /* "src/lxml/serializer.pxi":1756
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write_doctype(self, doctype):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1756, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1756, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1755
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1752
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1758
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype = {"write_doctype", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_doctype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doctype,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_doctype)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1758, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_doctype") < 0)) __PYX_ERR(10, 1758, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_doctype = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_doctype", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1758, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_doctype);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_8write_doctype(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_doctype", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1758, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_doctype = __pyx_v_doctype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_doctype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_doctype);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6, __pyx_codeobj__84, (PyObject *) __pyx_cur_scope, __pyx_n_s_write_doctype, __pyx_n_s_AsyncIncrementalFileWriter_writ_2, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1758, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_10generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1758, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1759
 * 
 *     async def write_doctype(self, doctype):
 *         self._writer.write_doctype(doctype)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer), __pyx_n_s_write_doctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_doctype};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1759, __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;

  /* "src/lxml/serializer.pxi":1760
 *     async def write_doctype(self, doctype):
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1761
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  __pyx_t_5 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_5) {

    /* "src/lxml/serializer.pxi":1762
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1762, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1762, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1761
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1758
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1764
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_12write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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 CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_with_tail,&__pyx_n_s_pretty_print,&__pyx_n_s_method,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 0; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1764, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "write") < 0)) __PYX_ERR(10, 1764, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_with_tail = values[0];
    __pyx_v_pretty_print = values[1];
    __pyx_v_method = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 0, 0, __pyx_nargs); __PYX_ERR(10, 1764, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_CLEAR(__pyx_v_args);
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_with_tail, __pyx_v_pretty_print, __pyx_v_method, __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_11write(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_method, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1764, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_with_tail = __pyx_v_with_tail;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_with_tail);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_with_tail);
  __pyx_cur_scope->__pyx_v_pretty_print = __pyx_v_pretty_print;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pretty_print);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pretty_print);
  __pyx_cur_scope->__pyx_v_method = __pyx_v_method;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_method);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_method);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7, __pyx_codeobj__85, (PyObject *) __pyx_cur_scope, __pyx_n_s_write, __pyx_n_s_AsyncIncrementalFileWriter_writ_3, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1764, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_13generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1764, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1765
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)             # <<<<<<<<<<<<<<
 *         data = self._flush()
 *         if data:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_writer), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_with_tail, __pyx_cur_scope->__pyx_v_with_tail) < 0) __PYX_ERR(10, 1765, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pretty_print, __pyx_cur_scope->__pyx_v_pretty_print) < 0) __PYX_ERR(10, 1765, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_method, __pyx_cur_scope->__pyx_v_method) < 0) __PYX_ERR(10, 1765, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1765, __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;

  /* "src/lxml/serializer.pxi":1766
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/serializer.pxi":1767
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  __pyx_t_4 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_4) {

    /* "src/lxml/serializer.pxi":1768
 *         data = self._flush()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     def method(self, method):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1768, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1768, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1767
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1764
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1770
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_15method = {"method", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_method = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("method (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1770, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "method") < 0)) __PYX_ERR(10, 1770, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_method = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("method", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1770, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_method);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_14method(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_method) {
  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("method", 1);

  /* "src/lxml/serializer.pxi":1771
 * 
 *     def method(self, method):
 *         return self._writer.method(method)             # <<<<<<<<<<<<<<
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_writer), __pyx_n_s_method); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_method};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1771, __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;

  /* "src/lxml/serializer.pxi":1770
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
 */

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

/* "src/lxml/serializer.pxi":1773
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_17element = {"element", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,&__pyx_n_s_method,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1773, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1773, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1773, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1773, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "element") < 0)) __PYX_ERR(10, 1773, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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];
    __pyx_v_method = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("element", 0, 1, 4, __pyx_nargs); __PYX_ERR(10, 1773, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_method, __pyx_v__extra);

  /* function exit code */
  __Pyx_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_16element(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_method, PyObject *__pyx_v__extra) {
  PyObject *__pyx_v_element_writer = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("element", 1);

  /* "src/lxml/serializer.pxi":1774
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)             # <<<<<<<<<<<<<<
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_writer), __pyx_n_s_element); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag)) __PYX_ERR(10, 1774, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_attrib);
  __Pyx_GIVEREF(__pyx_v_attrib);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_attrib)) __PYX_ERR(10, 1774, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_nsmap);
  __Pyx_GIVEREF(__pyx_v_nsmap);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_nsmap)) __PYX_ERR(10, 1774, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_method);
  __Pyx_GIVEREF(__pyx_v_method);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_method)) __PYX_ERR(10, 1774, __pyx_L1_error);
  __pyx_t_3 = PyDict_Copy(__pyx_v__extra); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1774, __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_element_writer = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/serializer.pxi":1775
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)             # <<<<<<<<<<<<<<
 * 
 *     async def _close(self, bint raise_on_error):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 1775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_element_writer);
  __Pyx_GIVEREF(__pyx_v_element_writer);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_element_writer)) __PYX_ERR(10, 1775, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self))) __PYX_ERR(10, 1775, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__AsyncFileWriterElement), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1775, __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;

  /* "src/lxml/serializer.pxi":1773
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, 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_AddTraceback("lxml.etree._AsyncIncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element_writer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1777
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close = {"_close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_raise_on_error;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_raise_on_error,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_raise_on_error)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1777, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_close") < 0)) __PYX_ERR(10, 1777, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_raise_on_error = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_raise_on_error == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1777, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_close", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 1777, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)__pyx_v_self), __pyx_v_raise_on_error);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_27_AsyncIncrementalFileWriter_18_close(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1777, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_raise_on_error = __pyx_v_raise_on_error;
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8, __pyx_codeobj__86, (PyObject *) __pyx_cur_scope, __pyx_n_s_close_2, __pyx_n_s_AsyncIncrementalFileWriter__clo, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1777, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncIncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_27_AsyncIncrementalFileWriter_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1777, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1778
 * 
 *     async def _close(self, bint raise_on_error):
 *         self._writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 *         data = self._buffer.collect()
 *         if data:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(__pyx_cur_scope->__pyx_v_self->_writer, __pyx_cur_scope->__pyx_v_raise_on_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1779
 *     async def _close(self, bint raise_on_error):
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._async_outfile.write(data)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_AsyncDataWriter_collect(__pyx_cur_scope->__pyx_v_self->_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1780
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 *         if self._should_close:
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_2) {

    /* "src/lxml/serializer.pxi":1781
 *         data = self._buffer.collect()
 *         if data:
 *             await self._async_outfile.write(data)             # <<<<<<<<<<<<<<
 *         if self._should_close:
 *             await self._async_outfile.close()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1781, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1781, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1780
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.write(data)
 *         if self._should_close:
 */
  }

  /* "src/lxml/serializer.pxi":1782
 *         if data:
 *             await self._async_outfile.write(data)
 *         if self._should_close:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.close()
 * 
 */
  if (__pyx_cur_scope->__pyx_v_self->_should_close) {

    /* "src/lxml/serializer.pxi":1783
 *             await self._async_outfile.write(data)
 *         if self._should_close:
 *             await self._async_outfile.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_async_outfile, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1783, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1783, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1782
 *         if data:
 *             await self._async_outfile.write(data)
 *         if self._should_close:             # <<<<<<<<<<<<<<
 *             await self._async_outfile.close()
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1777
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1792
 *     cdef _AsyncIncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _FileWriterElement element_writer not None,             # <<<<<<<<<<<<<<
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer = 0;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_writer,&__pyx_n_s_writer,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_writer)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1792, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_writer)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1792, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(10, 1792, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 1792, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
    }
    __pyx_v_element_writer = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)values[0]);
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 1792, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element_writer), __pyx_ptype_4lxml_5etree__FileWriterElement, 0, "element_writer", 0))) __PYX_ERR(10, 1792, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, 0, "writer", 0))) __PYX_ERR(10, 1793, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self), __pyx_v_element_writer, __pyx_v_writer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_element_writer, struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *__pyx_v_writer) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "src/lxml/serializer.pxi":1794
 *     def __cinit__(self, _FileWriterElement element_writer not None,
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer             # <<<<<<<<<<<<<<
 *         self._writer = writer
 * 
 */
  __Pyx_INCREF((PyObject *)__pyx_v_element_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_element_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element_writer);
  __pyx_v_self->_element_writer = __pyx_v_element_writer;

  /* "src/lxml/serializer.pxi":1795
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
 *         self._writer = writer             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
 */
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1792
 *     cdef _AsyncIncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _FileWriterElement element_writer not None,             # <<<<<<<<<<<<<<
 *                   _AsyncIncrementalFileWriter writer not None):
 *         self._element_writer = element_writer
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1797
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__ = {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__aenter__", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_2__aenter__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1797, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9, __pyx_codeobj__87, (PyObject *) __pyx_cur_scope, __pyx_n_s_aenter, __pyx_n_s_AsyncFileWriterElement___aenter, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1797, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_4generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1797, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1798
 * 
 *     async def __aenter__(self):
 *         self._element_writer.__enter__()             # <<<<<<<<<<<<<<
 *         data = self._writer._flush()
 *         if data:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_element_writer), __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1798, __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;

  /* "src/lxml/serializer.pxi":1799
 *     async def __aenter__(self):
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._writer._async_outfile.write(data)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self->_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/serializer.pxi":1800
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
 */
  __pyx_t_5 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_5) {

    /* "src/lxml/serializer.pxi":1801
 *         data = self._writer._flush()
 *         if data:
 *             await self._writer._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, *args):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_writer->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1801, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1801, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1800
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1797
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1803
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__ = {"__aexit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__aexit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)__pyx_v_self), __pyx_v_args);

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

static PyObject *__pyx_pf_4lxml_5etree_23_AsyncFileWriterElement_5__aexit__(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *__pyx_v_self, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1803, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10, __pyx_codeobj__88, (PyObject *) __pyx_cur_scope, __pyx_n_s_aexit, __pyx_n_s_AsyncFileWriterElement___aexit, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1803, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AsyncFileWriterElement.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_23_AsyncFileWriterElement_7generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1803, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1804
 * 
 *     async def __aexit__(self, *args):
 *         self._element_writer.__exit__(*args)             # <<<<<<<<<<<<<<
 *         data = self._writer._flush()
 *         if data:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_element_writer), __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1804, __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;

  /* "src/lxml/serializer.pxi":1805
 *     async def __aexit__(self, *args):
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()             # <<<<<<<<<<<<<<
 *         if data:
 *             await self._writer._async_outfile.write(data)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush(__pyx_cur_scope->__pyx_v_self->_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":1806
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
 */
  __pyx_t_3 = (__pyx_cur_scope->__pyx_v_data != Py_None)&&(PyBytes_GET_SIZE(__pyx_cur_scope->__pyx_v_data) != 0);
  if (__pyx_t_3) {

    /* "src/lxml/serializer.pxi":1807
 *         data = self._writer._flush()
 *         if data:
 *             await self._writer._async_outfile.write(data)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_writer->_async_outfile, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_data};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1807, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1807, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(10, 1807, __pyx_L1_error)
      }
    }

    /* "src/lxml/serializer.pxi":1806
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 *         if data:             # <<<<<<<<<<<<<<
 *             await self._writer._async_outfile.write(data)
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1803
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/serializer.pxi":1819
 *     cdef int _old_method
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):             # <<<<<<<<<<<<<<
 *         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_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_writer,&__pyx_n_s_element_config,&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_writer)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1819, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_config)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1819, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(10, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1819, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(10, 1819, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 1819, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
    }
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)values[0]);
    __pyx_v_element_config = values[1];
    __pyx_v_method = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1819, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(10, 1819, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(10, 1819, __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, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "src/lxml/serializer.pxi":1820
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):
 *         self._writer = writer             # <<<<<<<<<<<<<<
 *         self._element = element_config
 *         self._new_method = method
 */
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1821
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):
 *         self._writer = writer
 *         self._element = element_config             # <<<<<<<<<<<<<<
 *         self._new_method = method
 *         self._old_method = writer._method
 */
  __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;

  /* "src/lxml/serializer.pxi":1822
 *         self._writer = writer
 *         self._element = element_config
 *         self._new_method = method             # <<<<<<<<<<<<<<
 *         self._old_method = writer._method
 * 
 */
  __pyx_v_self->_new_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1823
 *         self._element = element_config
 *         self._new_method = method
 *         self._old_method = writer._method             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_t_1 = __pyx_v_writer->_method;
  __pyx_v_self->_old_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1819
 *     cdef int _old_method
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._element = element_config
 */

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

/* "src/lxml/serializer.pxi":1825
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_FileWriterElement_3__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __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
  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__", 1);

  /* "src/lxml/serializer.pxi":1826
 * 
 *     def __enter__(self):
 *         self._writer._method = self._new_method             # <<<<<<<<<<<<<<
 *         self._writer._write_start_element(self._element)
 * 
 */
  __pyx_t_1 = __pyx_v_self->_new_method;
  __pyx_v_self->_writer->_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1827
 *     def __enter__(self):
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __pyx_t_2 = __pyx_v_self->_element;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(__pyx_v_self->_writer, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1827, __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;

  /* "src/lxml/serializer.pxi":1825
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/serializer.pxi":1829
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_18_FileWriterElement_5__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1829, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_val)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1829, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(10, 1829, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_tb)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1829, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(10, 1829, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(10, 1829, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(10, 1829, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 1);

  /* "src/lxml/serializer.pxi":1830
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._writer._write_end_element(self._element)             # <<<<<<<<<<<<<<
 *         self._writer._method = self._old_method
 * 
 */
  __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_ERR(10, 1830, __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;

  /* "src/lxml/serializer.pxi":1831
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __pyx_v_self->_old_method;
  __pyx_v_self->_writer->_method = __pyx_t_3;

  /* "src/lxml/serializer.pxi":1829
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
 */

  /* 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;
}

/* "src/lxml/serializer.pxi":1844
 *     cdef bint _exited
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._new_method = method
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer = 0;
  int __pyx_v_method;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_writer,&__pyx_n_s_method,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_writer)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1844, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1844, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(10, 1844, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(10, 1844, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
    }
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)values[0]);
    __pyx_v_method = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 1844, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, __pyx_nargs); __PYX_ERR(10, 1844, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__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_ERR(10, 1844, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger___cinit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_writer, __pyx_v_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_14_MethodChanger___cinit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, int __pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 1);

  /* "src/lxml/serializer.pxi":1845
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):
 *         self._writer = writer             # <<<<<<<<<<<<<<
 *         self._new_method = method
 *         self._old_method = writer._method
 */
  __Pyx_INCREF((PyObject *)__pyx_v_writer);
  __Pyx_GIVEREF((PyObject *)__pyx_v_writer);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_writer);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_writer);
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "src/lxml/serializer.pxi":1846
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):
 *         self._writer = writer
 *         self._new_method = method             # <<<<<<<<<<<<<<
 *         self._old_method = writer._method
 *         self._entered = False
 */
  __pyx_v_self->_new_method = __pyx_v_method;

  /* "src/lxml/serializer.pxi":1847
 *         self._writer = writer
 *         self._new_method = method
 *         self._old_method = writer._method             # <<<<<<<<<<<<<<
 *         self._entered = False
 *         self._exited = False
 */
  __pyx_t_1 = __pyx_v_writer->_method;
  __pyx_v_self->_old_method = __pyx_t_1;

  /* "src/lxml/serializer.pxi":1848
 *         self._new_method = method
 *         self._old_method = writer._method
 *         self._entered = False             # <<<<<<<<<<<<<<
 *         self._exited = False
 * 
 */
  __pyx_v_self->_entered = 0;

  /* "src/lxml/serializer.pxi":1849
 *         self._old_method = writer._method
 *         self._entered = False
 *         self._exited = False             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_v_self->_exited = 0;

  /* "src/lxml/serializer.pxi":1844
 *     cdef bint _exited
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, int method):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._new_method = method
 */

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

/* "src/lxml/serializer.pxi":1851
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_3__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_2__enter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 1);

  /* "src/lxml/serializer.pxi":1852
 * 
 *     def __enter__(self):
 *         if self._entered:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
 */
  if (unlikely(__pyx_v_self->_entered)) {

    /* "src/lxml/serializer.pxi":1853
 *     def __enter__(self):
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._entered = True
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_Inconsistent_enter_action_in_con};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1853, __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_ERR(10, 1853, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1852
 * 
 *     def __enter__(self):
 *         if self._entered:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
 */
  }

  /* "src/lxml/serializer.pxi":1854
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method             # <<<<<<<<<<<<<<
 *         self._entered = True
 * 
 */
  __pyx_t_4 = __pyx_v_self->_new_method;
  __pyx_v_self->_writer->_method = __pyx_t_4;

  /* "src/lxml/serializer.pxi":1855
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 *         self._writer._method = self._new_method
 *         self._entered = True             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __pyx_v_self->_entered = 1;

  /* "src/lxml/serializer.pxi":1851
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 */

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

/* "src/lxml/serializer.pxi":1857
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_5__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1857, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_val)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1857, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(10, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_tb)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 1857, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(10, 1857, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(10, 1857, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(10, 1857, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_4__exit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__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;
  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("__exit__", 1);

  /* "src/lxml/serializer.pxi":1858
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
 */
  if (unlikely(__pyx_v_self->_exited)) {

    /* "src/lxml/serializer.pxi":1859
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")             # <<<<<<<<<<<<<<
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_Inconsistent_exit_action_in_cont};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1859, __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_ERR(10, 1859, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1858
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self._exited:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
 */
  }

  /* "src/lxml/serializer.pxi":1860
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
 */
  __pyx_t_5 = (__pyx_v_self->_writer->_method != __pyx_v_self->_new_method);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/serializer.pxi":1861
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")             # <<<<<<<<<<<<<<
 *         self._writer._method = self._old_method
 *         self._exited = True
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_Method_changed_outside_of_contex};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1861, __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_ERR(10, 1861, __pyx_L1_error)

    /* "src/lxml/serializer.pxi":1860
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 *         if self._writer._method != self._new_method:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
 */
  }

  /* "src/lxml/serializer.pxi":1862
 *         if self._writer._method != self._new_method:
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method             # <<<<<<<<<<<<<<
 *         self._exited = True
 * 
 */
  __pyx_t_4 = __pyx_v_self->_old_method;
  __pyx_v_self->_writer->_method = __pyx_t_4;

  /* "src/lxml/serializer.pxi":1863
 *             raise LxmlSyntaxError("Method changed outside of context manager")
 *         self._writer._method = self._old_method
 *         self._exited = True             # <<<<<<<<<<<<<<
 * 
 *     async def __aenter__(self):
 */
  __pyx_v_self->_exited = 1;

  /* "src/lxml/serializer.pxi":1857
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 */

  /* 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._MethodChanger.__exit__", __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_14_MethodChanger_8generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1865
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_7__aenter__ = {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__aenter__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__aenter__", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_6__aenter__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aenter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1865, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_14_MethodChanger_8generator11, __pyx_codeobj__89, (PyObject *) __pyx_cur_scope, __pyx_n_s_aenter, __pyx_n_s_MethodChanger___aenter, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1865, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_8generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aenter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1865, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1867
 *     async def __aenter__(self):
 *         # for your async convenience
 *         return self.__enter__()             # <<<<<<<<<<<<<<
 * 
 *     async def __aexit__(self, *args):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1865
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__aenter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_11generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/serializer.pxi":1869
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14_MethodChanger_10__aexit__ = {"__aexit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__aexit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(((struct __pyx_obj_4lxml_5etree__MethodChanger *)__pyx_v_self), __pyx_v_args);

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

static PyObject *__pyx_pf_4lxml_5etree_14_MethodChanger_9__aexit__(struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_v_self, PyObject *__pyx_v_args) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__aexit__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 1869, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_14_MethodChanger_11generator12, __pyx_codeobj__90, (PyObject *) __pyx_cur_scope, __pyx_n_s_aexit, __pyx_n_s_MethodChanger___aexit, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(10, 1869, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._MethodChanger.__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_14_MethodChanger_11generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__aexit__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 1869, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1871
 *     async def __aexit__(self, *args):
 *         # for your async convenience
 *         return self.__exit__(*args)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/serializer.pxi":1869
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("__aexit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":67
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("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;
  CYTHON_UNUSED PyObject *__pyx_v_collect_ids = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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_collect_ids,&__pyx_n_s_schema,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_tuple__58));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/iterparse.pxi":68
 * 
 *     def __init__(self, source, events=("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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/iterparse.pxi":69
 *     def __init__(self, source, events=("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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[7] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/iterparse.pxi":70
 *                  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, collect_ids=True,
 */
    values[8] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[9] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[10] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));

    /* "src/lxml/iterparse.pxi":71
 *                  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, collect_ids=True,
 *                  XMLSchema schema=None):
 */
    values[11] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[12] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[13] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/iterparse.pxi":72
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,             # <<<<<<<<<<<<<<
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
 */
    values[14] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[15] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[16] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    values[17] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/iterparse.pxi":73
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)
 */
    values[18] = __Pyx_Arg_NewRef_VARARGS((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_source)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 67, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_events);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 67, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && likely(kw_args <= 17)) {
        Py_ssize_t index;
        for (index = 2; index < 19 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 67, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(14, 67, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_collect_ids = values[17];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[18]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(14, 67, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(14, 73, __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_collect_ids, __pyx_v_schema);

  /* "src/lxml/iterparse.pxi":67
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, CYTHON_UNUSED PyObject *__pyx_v_collect_ids, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema) {
  struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_parser = NULL;
  PyObject *__pyx_9genexpr16__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);

  /* "src/lxml/iterparse.pxi":74
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
 */
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_u_read); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(14, 74, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":75
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)             # <<<<<<<<<<<<<<
 *             self._filename = source
 *             self._source = open(source, 'rb')
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_source); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/iterparse.pxi":76
 *         if not hasattr(source, 'read'):
 *             source = _getFSPathOrObject(source)
 *             self._filename = source             # <<<<<<<<<<<<<<
 *             self._source = open(source, 'rb')
 *             self._close_source_after_read = True
 */
    __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;

    /* "src/lxml/iterparse.pxi":77
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
 *             self._source = open(source, 'rb')             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = True
 *         else:
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 77, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source)) __PYX_ERR(14, 77, __pyx_L1_error);
    __Pyx_INCREF(__pyx_n_u_rb);
    __Pyx_GIVEREF(__pyx_n_u_rb);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_rb)) __PYX_ERR(14, 77, __pyx_L1_error);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 77, __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->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":78
 *             self._filename = source
 *             self._source = open(source, 'rb')
 *             self._close_source_after_read = True             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = _getFilenameForFile(source)
 */
    __pyx_v_self->_close_source_after_read = 1;

    /* "src/lxml/iterparse.pxi":74
 *                  html=False, recover=None, huge_tree=False, collect_ids=True,
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *             source = _getFSPathOrObject(source)
 *             self._filename = source
 */
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":80
 *             self._close_source_after_read = True
 *         else:
 *             self._filename = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 *             self._source = source
 *             self._close_source_after_read = False
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 80, __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;

    /* "src/lxml/iterparse.pxi":81
 *         else:
 *             self._filename = _getFilenameForFile(source)
 *             self._source = source             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = False
 * 
 */
    __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;

    /* "src/lxml/iterparse.pxi":82
 *             self._filename = _getFilenameForFile(source)
 *             self._source = source
 *             self._close_source_after_read = False             # <<<<<<<<<<<<<<
 * 
 *         if recover is None:
 */
    __pyx_v_self->_close_source_after_read = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":84
 *             self._close_source_after_read = False
 * 
 *         if recover is None:             # <<<<<<<<<<<<<<
 *             recover = html
 * 
 */
  __pyx_t_2 = (__pyx_v_recover == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":85
 * 
 *         if recover is None:
 *             recover = html             # <<<<<<<<<<<<<<
 * 
 *         if html:
 */
    __Pyx_INCREF(__pyx_v_html);
    __Pyx_DECREF_SET(__pyx_v_recover, __pyx_v_html);

    /* "src/lxml/iterparse.pxi":84
 *             self._close_source_after_read = False
 * 
 *         if recover is None:             # <<<<<<<<<<<<<<
 *             recover = html
 * 
 */
  }

  /* "src/lxml/iterparse.pxi":87
 *             recover = html
 * 
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_html); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(14, 87, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/iterparse.pxi":89
 *         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(
 */
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 89, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(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_ERR(14, 89, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 89, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 89, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(14, 89, __pyx_L8_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 89, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 89, __pyx_L8_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __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_ERR(14, 89, __pyx_L8_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 89, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(14, 89, __pyx_L8_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_event, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "src/lxml/iterparse.pxi":90
 *             # 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_9genexpr16__pyx_v_event);
        __pyx_t_7 = __pyx_9genexpr16__pyx_v_event;
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_kp_u_start_ns, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 90, __pyx_L8_error)
        if (__pyx_t_1) {
        } else {
          __pyx_t_2 = __pyx_t_1;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_kp_u_end_ns, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 90, __pyx_L8_error)
        __pyx_t_2 = __pyx_t_1;
        __pyx_L12_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_1 = __pyx_t_2;
        if (__pyx_t_1) {

          /* "src/lxml/iterparse.pxi":89
 *         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_9genexpr16__pyx_v_event))) __PYX_ERR(14, 89, __pyx_L8_error)

          /* "src/lxml/iterparse.pxi":90
 *             # 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,
 */
        }

        /* "src/lxml/iterparse.pxi":89
 *         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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_event); __pyx_9genexpr16__pyx_v_event = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_event); __pyx_9genexpr16__pyx_v_event = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":91
 *             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_ERR(14, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_events);
    __Pyx_GIVEREF(__pyx_v_events);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_events)) __PYX_ERR(14, 91, __pyx_L1_error);

    /* "src/lxml/iterparse.pxi":93
 *             parser = HTMLPullParser(
 *                 events,
 *                 tag=tag,             # <<<<<<<<<<<<<<
 *                 recover=recover,
 *                 base_url=self._filename,
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tag, __pyx_v_tag) < 0) __PYX_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":94
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":95
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":96
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":97
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":98
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":99
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":100
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":101
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":102
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":103
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":104
 *                 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_ERR(14, 93, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":91
 *             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 *)__pyx_ptype_4lxml_5etree_HTMLPullParser), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 91, __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;

    /* "src/lxml/iterparse.pxi":87
 *             recover = html
 * 
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 */
    goto __pyx_L5;
  }

  /* "src/lxml/iterparse.pxi":106
 *                 compact=compact)
 *         else:
 *             parser = XMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
  /*else*/ {

    /* "src/lxml/iterparse.pxi":107
 *         else:
 *             parser = XMLPullParser(
 *                 events,             # <<<<<<<<<<<<<<
 *                 tag=tag,
 *                 recover=recover,
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_events);
    __Pyx_GIVEREF(__pyx_v_events);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_events)) __PYX_ERR(14, 106, __pyx_L1_error);

    /* "src/lxml/iterparse.pxi":108
 *             parser = XMLPullParser(
 *                 events,
 *                 tag=tag,             # <<<<<<<<<<<<<<
 *                 recover=recover,
 *                 base_url=self._filename,
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(18); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tag, __pyx_v_tag) < 0) __PYX_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":109
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":110
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":111
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":112
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":113
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":114
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":115
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":116
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":117
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":118
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":119
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":120
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":121
 *                 resolve_entities=resolve_entities,
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,             # <<<<<<<<<<<<<<
 *                 strip_cdata=strip_cdata,
 *                 collect_ids=True,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_pis, __pyx_v_remove_pis) < 0) __PYX_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":122
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,             # <<<<<<<<<<<<<<
 *                 collect_ids=True,
 *                 target=None,  # TODO
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_strip_cdata, __pyx_v_strip_cdata) < 0) __PYX_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":123
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,
 *                 collect_ids=True,             # <<<<<<<<<<<<<<
 *                 target=None,  # TODO
 *                 compact=compact)
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_collect_ids, Py_True) < 0) __PYX_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":124
 *                 strip_cdata=strip_cdata,
 *                 collect_ids=True,
 *                 target=None,  # TODO             # <<<<<<<<<<<<<<
 *                 compact=compact)
 * 
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, Py_None) < 0) __PYX_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":125
 *                 collect_ids=True,
 *                 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_ERR(14, 108, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":106
 *                 compact=compact)
 *         else:
 *             parser = XMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XMLPullParser), __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 106, __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_L5:;

  /* "src/lxml/iterparse.pxi":127
 *                 compact=compact)
 * 
 *         self._events = parser.read_events()             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_read_events); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 127, __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->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/iterparse.pxi":128
 * 
 *         self._events = parser.read_events()
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parser);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_parser);
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "src/lxml/iterparse.pxi":67
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=("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_9genexpr16__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_source);
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_recover);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":130
 *         self._parser = parser
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last (or current) parser run.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/iterparse.pxi":134
 *         """The error log of the last (or current) parser run.
 *         """
 *         return self._parser.feed_error_log             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(14, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":130
 *         self._parser = parser
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The error log of the last (or current) parser run.
 */

  /* 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;
}

/* "src/lxml/iterparse.pxi":136
 *         return self._parser.feed_error_log
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of the last (or current) parser run.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/iterparse.pxi":140
 *         """The custom resolver registry of the last (or current) parser run.
 *         """
 *         return self._parser.resolvers             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(14, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":136
 *         return self._parser.feed_error_log
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def resolvers(self):
 *         """The custom resolver registry of the last (or current) parser run.
 */

  /* 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;
}

/* "src/lxml/iterparse.pxi":142
 *         return self._parser.resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/iterparse.pxi":145
 *     def version(self):
 *         """The version of the underlying XML parser."""
 *         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_ERR(14, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":142
 *         return self._parser.resolvers
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """The version of the underlying XML parser."""
 */

  /* 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;
}

/* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9iterparse_3set_element_class_lookup = {"set_element_class_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup};
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct LxmlElementClassLookup *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lookup);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_element_class_lookup") < 0)) __PYX_ERR(14, 147, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, __pyx_nargs); __PYX_ERR(14, 147, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(14, 147, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 1);

  /* "src/lxml/iterparse.pxi":154
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_set_element_class_lookup); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_lookup)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 154, __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;

  /* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9iterparse_5makeelement = {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_5makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_4makeelement};
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v__tag = 0;
  CYTHON_UNUSED PyObject *__pyx_v_attrib = 0;
  CYTHON_UNUSED PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 156, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_attrib);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 156, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nsmap);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 156, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__extra, values + 0, kwd_pos_args, "makeelement") < 0)) __PYX_ERR(14, 156, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, __pyx_nargs); __PYX_ERR(14, 156, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__extra);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/iterparse.pxi":161
 *         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_ERR(14, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/iterparse.pxi":162
 *         """
 *         self._parser.makeelement(
 *             _tag, attrib=None, nsmap=None, **_extra)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v__tag);
  __Pyx_GIVEREF(__pyx_v__tag);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__tag)) __PYX_ERR(14, 161, __pyx_L1_error);

  /* "src/lxml/iterparse.pxi":161
 *         Creates a new element associated with this parser.
 *         """
 *         self._parser.makeelement(             # <<<<<<<<<<<<<<
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "src/lxml/iterparse.pxi":162
 *         """
 *         self._parser.makeelement(
 *             _tag, attrib=None, nsmap=None, **_extra)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_attrib, Py_None) < 0) __PYX_ERR(14, 162, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_nsmap, Py_None) < 0) __PYX_ERR(14, 162, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v__extra) < 0) __PYX_ERR(14, 162, __pyx_L1_error)

  /* "src/lxml/iterparse.pxi":161
 *         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_ERR(14, 161, __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;

  /* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """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;
}

/* "src/lxml/iterparse.pxi":165
 * 
 *     @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;
  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;
  int __pyx_t_9;
  char const *__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("_close_source", 1);

  /* "src/lxml/iterparse.pxi":166
 *     @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);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":167
 *     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;

    /* "src/lxml/iterparse.pxi":166
 *     @cython.final
 *     cdef _close_source(self):
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             return
 *         if not self._close_source_after_read:
 */
  }

  /* "src/lxml/iterparse.pxi":168
 *         if self._source is None:
 *             return
 *         if not self._close_source_after_read:             # <<<<<<<<<<<<<<
 *             self._source = None
 *             return
 */
  __pyx_t_1 = (!__pyx_v_self->_close_source_after_read);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":169
 *             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;

    /* "src/lxml/iterparse.pxi":170
 *         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;

    /* "src/lxml/iterparse.pxi":168
 *         if self._source is None:
 *             return
 *         if not self._close_source_after_read:             # <<<<<<<<<<<<<<
 *             self._source = None
 *             return
 */
  }

  /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/iterparse.pxi":172
 *             return
 *         try:
 *             close = self._source.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_source, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 172, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_close = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
 */
      }
      __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_L8_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":173
 *         try:
 *             close = self._source.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_6) {
        __Pyx_AddTraceback("lxml.etree.iterparse._close_source", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(14, 173, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "src/lxml/iterparse.pxi":174
 *             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_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_exception_handled;
      }
      goto __pyx_L10_except_error;

      /* "src/lxml/iterparse.pxi":171
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
 */
      __pyx_L10_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_L6_error;
      __pyx_L9_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:;
    }
  }

  /* "src/lxml/iterparse.pxi":176
 *             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;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_5); __pyx_t_5 = 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_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);
      __pyx_t_6 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __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_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_4);
      __Pyx_XGIVEREF(__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_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "src/lxml/iterparse.pxi":177
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":178
 *             self._source = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __Pyx_INCREF(__pyx_v_close);
    __pyx_t_7 = __pyx_v_close; __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 178, __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;

    /* "src/lxml/iterparse.pxi":177
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  }

  /* "src/lxml/iterparse.pxi":165
 * 
 *     @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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "src/lxml/iterparse.pxi":180
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/iterparse.pxi":181
 * 
 *     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;

  /* "src/lxml/iterparse.pxi":180
 *             close()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "src/lxml/iterparse.pxi":183
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  int __pyx_error_without_exception = 0; /* StopIteration */
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  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;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);

  /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/iterparse.pxi":185
 *     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_ERR(14, 185, __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;

      /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/iterparse.pxi":186
 *         try:
 *             return next(self._events)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_6) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "src/lxml/iterparse.pxi":184
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
 */
    __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);
  }

  /* "src/lxml/iterparse.pxi":188
 *         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_ERR(14, 188, __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;

  /* "src/lxml/iterparse.pxi":189
 *             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);
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":190
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:
 *             done = False             # <<<<<<<<<<<<<<
 *             while not done:
 *                 try:
 */
    __pyx_v_done = 0;

    /* "src/lxml/iterparse.pxi":191
 *         if self._source is not None:
 *             done = False
 *             while not done:             # <<<<<<<<<<<<<<
 *                 try:
 *                     done = self._read_more_events(context)
 */
    while (1) {
      __pyx_t_7 = (!__pyx_v_done);
      if (!__pyx_t_7) break;

      /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:*/ {

          /* "src/lxml/iterparse.pxi":193
 *             while not done:
 *                 try:
 *                     done = self._read_more_events(context)             # <<<<<<<<<<<<<<
 *                     return next(self._events)
 *                 except StopIteration:
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree_9iterparse__read_more_events(__pyx_v_self, __pyx_v_context); if (unlikely(__pyx_t_7 == ((int)-123))) __PYX_ERR(14, 193, __pyx_L12_error)
          __pyx_v_done = __pyx_t_7;

          /* "src/lxml/iterparse.pxi":194
 *                 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_ERR(14, 194, __pyx_L12_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_L16_try_return;

          /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 */
        }
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/iterparse.pxi":195
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 *                 except StopIteration:             # <<<<<<<<<<<<<<
 *                     pass  # no events yet
 *                 except Exception as e:
 */
        __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
        if (__pyx_t_6) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L13_exception_handled;
        }

        /* "src/lxml/iterparse.pxi":197
 *                 except StopIteration:
 *                     pass  # no events yet
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     self._error = e
 *                     self._close_source()
 */
        __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        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_8) < 0) __PYX_ERR(14, 197, __pyx_L14_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_v_e = __pyx_t_4;
          /*try:*/ {

            /* "src/lxml/iterparse.pxi":198
 *                     pass  # no events yet
 *                 except Exception as 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;

            /* "src/lxml/iterparse.pxi":199
 *                 except Exception as e:
 *                     self._error = e
 *                     self._close_source()             # <<<<<<<<<<<<<<
 *                     try:
 *                         return next(self._events)
 */
            __pyx_t_9 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 199, __pyx_L25_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

            /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
 */
            {
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __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:*/ {

                /* "src/lxml/iterparse.pxi":201
 *                     self._close_source()
 *                     try:
 *                         return next(self._events)             # <<<<<<<<<<<<<<
 *                     except StopIteration:
 *                         break
 */
                __Pyx_XDECREF(__pyx_r);
                __pyx_t_9 = __pyx_v_self->_events;
                __Pyx_INCREF(__pyx_t_9);
                __pyx_t_13 = __Pyx_PyIter_Next(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(14, 201, __pyx_L27_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_r = __pyx_t_13;
                __pyx_t_13 = 0;
                __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;
                goto __pyx_L31_try_return;

                /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
 */
              }
              __pyx_L27_error:;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "src/lxml/iterparse.pxi":202
 *                     try:
 *                         return next(self._events)
 *                     except StopIteration:             # <<<<<<<<<<<<<<
 *                         break
 *         # nothing left to read or return
 */
              __pyx_t_6 = __Pyx_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_13, &__pyx_t_9, &__pyx_t_14) < 0) __PYX_ERR(14, 202, __pyx_L29_except_error)
                __Pyx_XGOTREF(__pyx_t_13);
                __Pyx_XGOTREF(__pyx_t_9);
                __Pyx_XGOTREF(__pyx_t_14);

                /* "src/lxml/iterparse.pxi":203
 *                         return next(self._events)
 *                     except StopIteration:
 *                         break             # <<<<<<<<<<<<<<
 *         # nothing left to read or return
 *         if self._error is not None:
 */
                goto __pyx_L36_except_break;
                __pyx_L36_except_break:;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                goto __pyx_L32_try_break;
              }
              goto __pyx_L29_except_error;

              /* "src/lxml/iterparse.pxi":200
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
 */
              __pyx_L29_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_L25_error;
              __pyx_L32_try_break:;
              __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_L23_break;
              __pyx_L31_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_L24_return;
            }
          }

          /* "src/lxml/iterparse.pxi":197
 *                 except StopIteration:
 *                     pass  # no events yet
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     self._error = e
 *                     self._close_source()
 */
          /*finally:*/ {
            __pyx_L25_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
              __Pyx_XGOTREF(__pyx_t_12);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_10);
              __Pyx_XGOTREF(__pyx_t_17);
              __Pyx_XGOTREF(__pyx_t_18);
              __Pyx_XGOTREF(__pyx_t_19);
              __pyx_t_6 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_17);
                __Pyx_XGIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
              }
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
              __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
              __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
              goto __pyx_L14_except_error;
            }
            __pyx_L23_break: {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              goto __pyx_L21_except_break;
            }
            __pyx_L24_return: {
              __pyx_t_19 = __pyx_r;
              __pyx_r = 0;
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              __pyx_r = __pyx_t_19;
              __pyx_t_19 = 0;
              goto __pyx_L15_except_return;
            }
          }
          __pyx_L21_except_break:;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L17_try_break;
        }
        goto __pyx_L14_except_error;

        /* "src/lxml/iterparse.pxi":192
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 */
        __pyx_L14_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_L17_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_L11_break;
        __pyx_L16_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_L15_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_L13_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_L11_break:;

    /* "src/lxml/iterparse.pxi":189
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:             # <<<<<<<<<<<<<<
 *             done = False
 *             while not done:
 */
  }

  /* "src/lxml/iterparse.pxi":205
 *                         break
 *         # nothing left to read or return
 *         if self._error is not None:             # <<<<<<<<<<<<<<
 *             error = self._error
 *             self._error = None
 */
  __pyx_t_7 = (__pyx_v_self->_error != Py_None);
  if (unlikely(__pyx_t_7)) {

    /* "src/lxml/iterparse.pxi":206
 *         # nothing left to read or return
 *         if self._error is not None:
 *             error = self._error             # <<<<<<<<<<<<<<
 *             self._error = None
 *             raise error
 */
    __pyx_t_8 = __pyx_v_self->_error;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_v_error = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "src/lxml/iterparse.pxi":207
 *         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;

    /* "src/lxml/iterparse.pxi":208
 *             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_ERR(14, 208, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":205
 *                         break
 *         # nothing left to read or return
 *         if self._error is not None:             # <<<<<<<<<<<<<<
 *             error = self._error
 *             self._error = None
 */
  }

  /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 */
  __pyx_t_20 = (((PyObject *)__pyx_v_context->__pyx_base._validator) != Py_None);
  if (__pyx_t_20) {
  } else {
    __pyx_t_7 = __pyx_t_20;
    goto __pyx_L43_bool_binop_done;
  }

  /* "src/lxml/iterparse.pxi":210
 *             raise error
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):             # <<<<<<<<<<<<<<
 *             _raiseParseError(context._c_ctxt, self._filename,
 *                              context._error_log)
 */
  __pyx_t_20 = (!__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->__pyx_base._validator));
  __pyx_t_7 = __pyx_t_20;
  __pyx_L43_bool_binop_done:;

  /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 */
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":211
 *         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_8 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_8);

    /* "src/lxml/iterparse.pxi":212
 *                 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);

    /* "src/lxml/iterparse.pxi":211
 *         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_15 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_context->__pyx_base._c_ctxt, __pyx_t_8, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(14, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":209
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 */
  }

  /* "src/lxml/iterparse.pxi":214
 *                              context._error_log)
 *         # no errors => all done
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_error_without_exception = 1;
  goto __pyx_L1_error;;

  /* "src/lxml/iterparse.pxi":183
 *         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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "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):
 */

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;
  PyObject *__pyx_t_3 = NULL;
  int __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("_read_more_events", 1);

  /* "src/lxml/iterparse.pxi":218
 *     @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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_source, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_32768};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":219
 *     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_5 = PyBytes_Check(__pyx_v_data); 
  __pyx_t_6 = (!__pyx_t_5);
  if (unlikely(__pyx_t_6)) {

    /* "src/lxml/iterparse.pxi":220
 *         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_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/iterparse.pxi":221
 *         if not isinstance(data, bytes):
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")             # <<<<<<<<<<<<<<
 *         if not data:
 *             try:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 221, __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_ERR(14, 221, __pyx_L1_error)

    /* "src/lxml/iterparse.pxi":219
 *     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")
 */
  }

  /* "src/lxml/iterparse.pxi":222
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.root = self._parser.close()
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(14, 222, __pyx_L1_error)
  __pyx_t_5 = (!__pyx_t_6);
  if (__pyx_t_5) {

    /* "src/lxml/iterparse.pxi":223
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.root = self._parser.close()
 *             finally:
 */
    /*try:*/ {

      /* "src/lxml/iterparse.pxi":224
 *         if not data:
 *             try:
 *                 self.root = self._parser.close()             # <<<<<<<<<<<<<<
 *             finally:
 *                 self._close_source()
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->close(__pyx_v_self->_parser, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 224, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->root);
      __Pyx_DECREF(__pyx_v_self->root);
      __pyx_v_self->root = __pyx_t_1;
      __pyx_t_1 = 0;
    }

    /* "src/lxml/iterparse.pxi":226
 *                 self.root = self._parser.close()
 *             finally:
 *                 self._close_source()             # <<<<<<<<<<<<<<
 *             return True
 *         self._parser.feed(data)
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 226, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7;
      }
      __pyx_L6_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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;
        __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_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_4 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
        {
          __pyx_t_1 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 226, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        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_4; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
        goto __pyx_L1_error;
        __pyx_L9_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_L7:;
    }

    /* "src/lxml/iterparse.pxi":227
 *             finally:
 *                 self._close_source()
 *             return True             # <<<<<<<<<<<<<<
 *         self._parser.feed(data)
 *         return False
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":222
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.root = self._parser.close()
 */
  }

  /* "src/lxml/iterparse.pxi":228
 *                 self._close_source()
 *             return True
 *         self._parser.feed(data)             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_1 = ((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_1)) __PYX_ERR(14, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":229
 *             return True
 *         self._parser.feed(data)
 *         return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "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):
 */

  /* 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.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;
}

/* "src/lxml/iterparse.pxi":61
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/iterparse.pxi":261
 *     cdef _IterwalkSkipStates _skip_state
 * 
 *     def __init__(self, element_or_tree, events=("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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_events,&__pyx_n_s_tag,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_tuple__58));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element_or_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 261, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_events);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tag);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 261, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(14, 261, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, __pyx_nargs); __PYX_ERR(14, 261, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_v_elem = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/iterparse.pxi":264
 *         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_ERR(14, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/iterparse.pxi":265
 *         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 == ((int)-1))) __PYX_ERR(14, 265, __pyx_L1_error)
  __pyx_v_self->_event_filter = __pyx_t_2;

  /* "src/lxml/iterparse.pxi":266
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
 */
  __pyx_t_4 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_tag, __pyx_kp_u__22, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 266, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/iterparse.pxi":267
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);

    /* "src/lxml/iterparse.pxi":266
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":269
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)             # <<<<<<<<<<<<<<
 *         self._node_stack  = []
 *         self._events = []
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag)) __PYX_ERR(14, 269, __pyx_L1_error);
    __pyx_t_5 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 269, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF((PyObject *)__pyx_t_5);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_matcher);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_matcher);
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":270
 *         else:
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._node_stack  = []             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._pop_event = self._events.pop
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_node_stack);
  __Pyx_DECREF(__pyx_v_self->_node_stack);
  __pyx_v_self->_node_stack = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":271
 *             self._matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag)
 *         self._node_stack  = []
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._pop_event = self._events.pop
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":272
 *         self._node_stack  = []
 *         self._events = []
 *         self._pop_event = self._events.pop             # <<<<<<<<<<<<<<
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_events, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_pop_event);
  __Pyx_DECREF(__pyx_v_self->_pop_event);
  __pyx_v_self->_pop_event = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "src/lxml/iterparse.pxi":273
 *         self._events = []
 *         self._pop_event = self._events.pop
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default             # <<<<<<<<<<<<<<
 * 
 *         if self._event_filter:
 */
  __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP;

  /* "src/lxml/iterparse.pxi":275
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
 *         if self._event_filter:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 */
  __pyx_t_3 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_3) {

    /* "src/lxml/iterparse.pxi":276
 * 
 *         if self._event_filter:
 *             self._index = 0             # <<<<<<<<<<<<<<
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 *                 self._matcher.cacheTags(root._doc)
 */
    __pyx_v_self->_index = 0;

    /* "src/lxml/iterparse.pxi":277
 *         if self._event_filter:
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *                 self._matcher.cacheTags(root._doc)
 * 
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "src/lxml/iterparse.pxi":278
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 *                 self._matcher.cacheTags(root._doc)             # <<<<<<<<<<<<<<
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_root->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_5), NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 278, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":277
 *         if self._event_filter:
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *                 self._matcher.cacheTags(root._doc)
 * 
 */
    }

    /* "src/lxml/iterparse.pxi":281
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):             # <<<<<<<<<<<<<<
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 */
    __pyx_t_3 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI)) != 0);
    if (__pyx_t_3) {

      /* "src/lxml/iterparse.pxi":282
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 */
      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, __pyx_ptype_4lxml_5etree__ElementTree); 
      if (__pyx_t_3) {

        /* "src/lxml/iterparse.pxi":283
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root             # <<<<<<<<<<<<<<
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 */
        __Pyx_INCREF((PyObject *)__pyx_v_root);
        __Pyx_GIVEREF((PyObject *)__pyx_v_root);
        __Pyx_GOTREF(__pyx_v_self->_include_siblings);
        __Pyx_DECREF(__pyx_v_self->_include_siblings);
        __pyx_v_self->_include_siblings = ((PyObject *)__pyx_v_root);

        /* "src/lxml/iterparse.pxi":284
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:             # <<<<<<<<<<<<<<
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_root), __pyx_n_s_itersiblings); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_preceding, Py_True) < 0) __PYX_ERR(14, 284, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PySequence_ListKeepNew(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_slice__55); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 284, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        for (;;) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 284, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(14, 284, __pyx_L1_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 284, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "src/lxml/iterparse.pxi":285
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:             # <<<<<<<<<<<<<<
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 */
          __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
          if (__pyx_t_4) {
          } else {
            __pyx_t_3 = __pyx_t_4;
            goto __pyx_L15_bool_binop_done;
          }
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 285, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Comment); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 285, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = (__pyx_t_6 == __pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = __pyx_t_4;
          __pyx_L15_bool_binop_done:;
          if (__pyx_t_3) {

            /* "src/lxml/iterparse.pxi":286
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))             # <<<<<<<<<<<<<<
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 *                             self._events.append(('pi', elem))
 */
            if (unlikely(__pyx_v_self->_events == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
              __PYX_ERR(14, 286, __pyx_L1_error)
            }
            __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 286, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_INCREF(__pyx_n_u_comment);
            __Pyx_GIVEREF(__pyx_n_u_comment);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_comment)) __PYX_ERR(14, 286, __pyx_L1_error);
            __Pyx_INCREF(__pyx_v_elem);
            __Pyx_GIVEREF(__pyx_v_elem);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_elem)) __PYX_ERR(14, 286, __pyx_L1_error);
            __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(14, 286, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "src/lxml/iterparse.pxi":285
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:             # <<<<<<<<<<<<<<
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 */
            goto __pyx_L14;
          }

          /* "src/lxml/iterparse.pxi":287
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:             # <<<<<<<<<<<<<<
 *                             self._events.append(('pi', elem))
 * 
 */
          __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
          if (__pyx_t_4) {
          } else {
            __pyx_t_3 = __pyx_t_4;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PI); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_4 = (__pyx_t_5 == __pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_3 = __pyx_t_4;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_3) {

            /* "src/lxml/iterparse.pxi":288
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:
 *                             self._events.append(('pi', elem))             # <<<<<<<<<<<<<<
 * 
 *             ns_count = self._start_node(root)
 */
            if (unlikely(__pyx_v_self->_events == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
              __PYX_ERR(14, 288, __pyx_L1_error)
            }
            __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 288, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_n_u_pi);
            __Pyx_GIVEREF(__pyx_n_u_pi);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_pi)) __PYX_ERR(14, 288, __pyx_L1_error);
            __Pyx_INCREF(__pyx_v_elem);
            __Pyx_GIVEREF(__pyx_v_elem);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_elem)) __PYX_ERR(14, 288, __pyx_L1_error);
            __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_6); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(14, 288, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "src/lxml/iterparse.pxi":287
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 *                         elif self._event_filter & PARSE_EVENT_FILTER_PI and elem.tag is PI:             # <<<<<<<<<<<<<<
 *                             self._events.append(('pi', elem))
 * 
 */
          }
          __pyx_L14:;

          /* "src/lxml/iterparse.pxi":284
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:             # <<<<<<<<<<<<<<
 *                         if self._event_filter & PARSE_EVENT_FILTER_COMMENT and elem.tag is Comment:
 *                             self._events.append(('comment', elem))
 */
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "src/lxml/iterparse.pxi":282
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):
 *                 if isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *                     self._include_siblings = root
 *                     for elem in list(root.itersiblings(preceding=True))[::-1]:
 */
      }

      /* "src/lxml/iterparse.pxi":281
 * 
 *             # When processing an ElementTree, add events for the preceding comments/PIs.
 *             if self._event_filter & (PARSE_EVENT_FILTER_COMMENT | PARSE_EVENT_FILTER_PI):             # <<<<<<<<<<<<<<
 *                 if isinstance(element_or_tree, _ElementTree):
 *                     self._include_siblings = root
 */
    }

    /* "src/lxml/iterparse.pxi":290
 *                             self._events.append(('pi', elem))
 * 
 *             ns_count = self._start_node(root)             # <<<<<<<<<<<<<<
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_8iterwalk__start_node(__pyx_v_self, __pyx_v_root); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 290, __pyx_L1_error)
    __pyx_v_ns_count = __pyx_t_2;

    /* "src/lxml/iterparse.pxi":291
 * 
 *             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 '%.30s'", "append");
      __PYX_ERR(14, 291, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_root))) __PYX_ERR(14, 291, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1)) __PYX_ERR(14, 291, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_6); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(14, 291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/iterparse.pxi":275
 *         self._skip_state = IWSKIP_CANNOT_SKIP  # ignore all skip requests by default
 * 
 *         if self._event_filter:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             if self._matcher is not None and self._event_filter & PARSE_EVENT_FILTER_START:
 */
    goto __pyx_L6;
  }

  /* "src/lxml/iterparse.pxi":293
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 *             self._index = -1             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  /*else*/ {
    __pyx_v_self->_index = -1;
  }
  __pyx_L6:;

  /* "src/lxml/iterparse.pxi":261
 *     cdef _IterwalkSkipStates _skip_state
 * 
 *     def __init__(self, element_or_tree, events=("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_5);
  __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_XDECREF(__pyx_v_elem);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":295
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/iterparse.pxi":296
 * 
 *     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;

  /* "src/lxml/iterparse.pxi":295
 *             self._index = -1
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "src/lxml/iterparse.pxi":298
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  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("__next__", 1);

  /* "src/lxml/iterparse.pxi":302
 *         cdef _Element node
 *         cdef _Element next_node
 *         cdef int ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._events:
 *             return self._next_event()
 */
  __pyx_v_ns_count = 0;

  /* "src/lxml/iterparse.pxi":303
 *         cdef _Element next_node
 *         cdef int ns_count = 0
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._next_event()
 *         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) {

    /* "src/lxml/iterparse.pxi":304
 *         cdef int ns_count = 0
 *         if self._events:
 *             return self._next_event()             # <<<<<<<<<<<<<<
 *         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_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "src/lxml/iterparse.pxi":303
 *         cdef _Element next_node
 *         cdef int ns_count = 0
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:
 */
  }

  /* "src/lxml/iterparse.pxi":305
 *         if self._events:
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->_index >= 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":306
 *             return self._next_event()
 *         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_ERR(14, 306, __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)) __PYX_ERR(14, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 306, __pyx_L1_error)
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":307
 *         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_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_4), NULL); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":305
 *         if self._events:
 *             return self._next_event()
 *         if self._matcher is not None and self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)
 */
  }

  /* "src/lxml/iterparse.pxi":310
 * 
 *         # find next node
 *         while self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 * 
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_self->_index >= 0);
    if (!__pyx_t_1) break;

    /* "src/lxml/iterparse.pxi":311
 *         # find next node
 *         while self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:
 */
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(14, 311, __pyx_L1_error)
    }
    __pyx_t_4 = __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_4)) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 311, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/iterparse.pxi":313
 *             node = self._node_stack[self._index][0]
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:             # <<<<<<<<<<<<<<
 *                 c_child = NULL
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":314
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:
 *                 c_child = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_child = self._process_non_elements(
 */
      __pyx_v_c_child = NULL;

      /* "src/lxml/iterparse.pxi":313
 *             node = self._node_stack[self._index][0]
 * 
 *             if self._skip_state == IWSKIP_SKIP_NEXT:             # <<<<<<<<<<<<<<
 *                 c_child = NULL
 *             else:
 */
      goto __pyx_L9;
    }

    /* "src/lxml/iterparse.pxi":316
 *                 c_child = NULL
 *             else:
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 */
    /*else*/ {

      /* "src/lxml/iterparse.pxi":317
 *             else:
 *                 c_child = self._process_non_elements(
 *                     node._doc, _findChildForwards(node._c_node, 0))             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 * 
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);

      /* "src/lxml/iterparse.pxi":316
 *                 c_child = NULL
 *             else:
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_2), __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 316, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_c_child = __pyx_t_6;
    }
    __pyx_L9:;

    /* "src/lxml/iterparse.pxi":318
 *                 c_child = self._process_non_elements(
 *                     node._doc, _findChildForwards(node._c_node, 0))
 *             self._skip_state = IWSKIP_CANNOT_SKIP             # <<<<<<<<<<<<<<
 * 
 *             while c_child is NULL:
 */
    __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CANNOT_SKIP;

    /* "src/lxml/iterparse.pxi":320
 *             self._skip_state = IWSKIP_CANNOT_SKIP
 * 
 *             while c_child is NULL:             # <<<<<<<<<<<<<<
 *                 # back off through parents
 *                 self._index -= 1
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child == NULL);
      if (!__pyx_t_1) break;

      /* "src/lxml/iterparse.pxi":322
 *             while c_child is NULL:
 *                 # back off through parents
 *                 self._index -= 1             # <<<<<<<<<<<<<<
 *                 node = self._end_node()
 *                 if self._index < 0:
 */
      __pyx_v_self->_index = (__pyx_v_self->_index - 1);

      /* "src/lxml/iterparse.pxi":323
 *                 # back off through parents
 *                 self._index -= 1
 *                 node = self._end_node()             # <<<<<<<<<<<<<<
 *                 if self._index < 0:
 *                     break
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_8iterwalk__end_node(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":324
 *                 self._index -= 1
 *                 node = self._end_node()
 *                 if self._index < 0:             # <<<<<<<<<<<<<<
 *                     break
 *                 c_child = self._process_non_elements(
 */
      __pyx_t_1 = (__pyx_v_self->_index < 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":325
 *                 node = self._end_node()
 *                 if self._index < 0:
 *                     break             # <<<<<<<<<<<<<<
 *                 c_child = self._process_non_elements(
 *                     node._doc, _nextElement(node._c_node))
 */
        goto __pyx_L11_break;

        /* "src/lxml/iterparse.pxi":324
 *                 self._index -= 1
 *                 node = self._end_node()
 *                 if self._index < 0:             # <<<<<<<<<<<<<<
 *                     break
 *                 c_child = self._process_non_elements(
 */
      }

      /* "src/lxml/iterparse.pxi":327
 *                     break
 *                 c_child = self._process_non_elements(
 *                     node._doc, _nextElement(node._c_node))             # <<<<<<<<<<<<<<
 * 
 *             if c_child is not NULL:
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);

      /* "src/lxml/iterparse.pxi":326
 *                 if self._index < 0:
 *                     break
 *                 c_child = self._process_non_elements(             # <<<<<<<<<<<<<<
 *                     node._doc, _nextElement(node._c_node))
 * 
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_2), __pyx_f_4lxml_5etree__nextElement(__pyx_v_node->_c_node)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 326, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_c_child = __pyx_t_6;
    }
    __pyx_L11_break:;

    /* "src/lxml/iterparse.pxi":329
 *                     node._doc, _nextElement(node._c_node))
 * 
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 */
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":330
 * 
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)             # <<<<<<<<<<<<<<
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                          PARSE_EVENT_FILTER_START_NS):
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_child)); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_next_node, ((struct LxmlElement *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "src/lxml/iterparse.pxi":331
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 */
      __pyx_t_1 = ((__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_1) {

        /* "src/lxml/iterparse.pxi":333
 *                 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_5 = __pyx_f_4lxml_5etree_8iterwalk__start_node(__pyx_v_self, __pyx_v_next_node); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 333, __pyx_L1_error)
        __pyx_v_ns_count = __pyx_t_5;

        /* "src/lxml/iterparse.pxi":331
 *             if c_child is not NULL:
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 */
        goto __pyx_L14;
      }

      /* "src/lxml/iterparse.pxi":334
 *                                          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_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":335
 *                     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);

        /* "src/lxml/iterparse.pxi":334
 *                                          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_L14:;

      /* "src/lxml/iterparse.pxi":336
 *                 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 '%.30s'", "append");
        __PYX_ERR(14, 336, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF((PyObject *)__pyx_v_next_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_next_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_next_node))) __PYX_ERR(14, 336, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4)) __PYX_ERR(14, 336, __pyx_L1_error);
      __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(14, 336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":337
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._next_event()
 */
      __pyx_v_self->_index = (__pyx_v_self->_index + 1);

      /* "src/lxml/iterparse.pxi":329
 *                     node._doc, _nextElement(node._c_node))
 * 
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 next_node = _elementFactory(node._doc, c_child)
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 */
    }

    /* "src/lxml/iterparse.pxi":338
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
 */
    __pyx_t_1 = (__pyx_v_self->_events != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_events) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":339
 *                 self._index += 1
 *             if self._events:
 *                 return self._next_event()             # <<<<<<<<<<<<<<
 * 
 *         if self._include_siblings is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 339, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "src/lxml/iterparse.pxi":338
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
 */
    }
  }

  /* "src/lxml/iterparse.pxi":341
 *                 return self._next_event()
 * 
 *         if self._include_siblings is not None:             # <<<<<<<<<<<<<<
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 */
  __pyx_t_1 = (__pyx_v_self->_include_siblings != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":342
 * 
 *         if self._include_siblings is not None:
 *             node, self._include_siblings = self._include_siblings, None             # <<<<<<<<<<<<<<
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:
 */
    if (!(likely(((__pyx_v_self->_include_siblings) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->_include_siblings, __pyx_ptype_4lxml_5etree__Element))))) __PYX_ERR(14, 342, __pyx_L1_error)
    __pyx_t_2 = __pyx_v_self->_include_siblings;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = Py_None;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_include_siblings);
    __Pyx_DECREF(__pyx_v_self->_include_siblings);
    __pyx_v_self->_include_siblings = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":343
 *         if self._include_siblings is not None:
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._next_event()
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_f_4lxml_5etree_8iterwalk__process_non_elements(__pyx_v_self, ((struct LxmlDocument *)__pyx_t_4), __pyx_f_4lxml_5etree__nextElement(__pyx_v_node->_c_node)); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/iterparse.pxi":344
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
 */
    __pyx_t_1 = (__pyx_v_self->_events != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_events) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":345
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:
 *                 return self._next_event()             # <<<<<<<<<<<<<<
 * 
 *         raise StopIteration
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_f_4lxml_5etree_8iterwalk__next_event(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "src/lxml/iterparse.pxi":344
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._next_event()
 * 
 */
    }

    /* "src/lxml/iterparse.pxi":341
 *                 return self._next_event()
 * 
 *         if self._include_siblings is not None:             # <<<<<<<<<<<<<<
 *             node, self._include_siblings = self._include_siblings, None
 *             self._process_non_elements(node._doc, _nextElement(node._c_node))
 */
  }

  /* "src/lxml/iterparse.pxi":347
 *                 return self._next_event()
 * 
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_error_without_exception = 1;
  goto __pyx_L1_error;;

  /* "src/lxml/iterparse.pxi":298
 *         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_4);
  if (!__pyx_error_without_exception) {
    __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;
}

/* "src/lxml/iterparse.pxi":350
 * 
 *     @cython.final
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 */

static xmlNode *__pyx_f_4lxml_5etree_8iterwalk__process_non_elements(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_process_non_elements", 1);

  /* "src/lxml/iterparse.pxi":351
 *     @cython.final
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "src/lxml/iterparse.pxi":352
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
 */
    switch (__pyx_v_c_node->type) {
      case XML_COMMENT_NODE:

      /* "src/lxml/iterparse.pxi":353
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
 */
      __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":354
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 */
        if (unlikely(__pyx_v_self->_events == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(14, 354, __pyx_L1_error)
        }

        /* "src/lxml/iterparse.pxi":355
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
 */
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_n_u_comment);
        __Pyx_GIVEREF(__pyx_n_u_comment);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_comment)) __PYX_ERR(14, 355, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_3);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(14, 355, __pyx_L1_error);
        __pyx_t_3 = 0;

        /* "src/lxml/iterparse.pxi":354
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 */
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 354, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "src/lxml/iterparse.pxi":353
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
 */
      }

      /* "src/lxml/iterparse.pxi":356
 *                     self._events.append(
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/iterparse.pxi":352
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *                     self._events.append(
 */
      break;
      case XML_PI_NODE:

      /* "src/lxml/iterparse.pxi":358
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
 */
      __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
      if (__pyx_t_1) {

        /* "src/lxml/iterparse.pxi":359
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 */
        if (unlikely(__pyx_v_self->_events == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(14, 359, __pyx_L1_error)
        }

        /* "src/lxml/iterparse.pxi":360
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             else:
 */
        __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_n_u_pi);
        __Pyx_GIVEREF(__pyx_n_u_pi);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_pi)) __PYX_ERR(14, 360, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4)) __PYX_ERR(14, 360, __pyx_L1_error);
        __pyx_t_4 = 0;

        /* "src/lxml/iterparse.pxi":359
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(             # <<<<<<<<<<<<<<
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 */
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 359, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "src/lxml/iterparse.pxi":358
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
 */
      }

      /* "src/lxml/iterparse.pxi":361
 *                     self._events.append(
 *                         ("pi", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             else:
 *                 break
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/iterparse.pxi":357
 *                         ("comment", _elementFactory(doc, c_node)))
 *                 c_node = _nextElement(c_node)
 *             elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & PARSE_EVENT_FILTER_PI:
 *                     self._events.append(
 */
      break;
      default:

      /* "src/lxml/iterparse.pxi":363
 *                 c_node = _nextElement(c_node)
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 *         return c_node
 * 
 */
      goto __pyx_L4_break;
      break;
    }
  }
  __pyx_L4_break:;

  /* "src/lxml/iterparse.pxi":364
 *             else:
 *                 break
 *         return c_node             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":350
 * 
 *     @cython.final
 *     cdef xmlNode* _process_non_elements(self, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *             if c_node.type == tree.XML_COMMENT_NODE:
 */

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

/* "src/lxml/iterparse.pxi":367
 * 
 *     @cython.final
 *     cdef _next_event(self):             # <<<<<<<<<<<<<<
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):
 */

static PyObject *__pyx_f_4lxml_5etree_8iterwalk__next_event(struct __pyx_obj_4lxml_5etree_iterwalk *__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_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("_next_event", 1);

  /* "src/lxml/iterparse.pxi":368
 *     @cython.final
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:             # <<<<<<<<<<<<<<
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
 */
  __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":369
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)
 */
    if (unlikely(__pyx_v_self->_events == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(14, 369, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_events, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_start, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 369, __pyx_L1_error)
    if (!__pyx_t_4) {
    } else {
      __pyx_t_1 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_start_ns, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(14, 369, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_t_1;
    if (__pyx_t_4) {

      /* "src/lxml/iterparse.pxi":370
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP             # <<<<<<<<<<<<<<
 *         return self._pop_event(0)
 * 
 */
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP;

      /* "src/lxml/iterparse.pxi":369
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)
 */
    }

    /* "src/lxml/iterparse.pxi":368
 *     @cython.final
 *     cdef _next_event(self):
 *         if self._skip_state == IWSKIP_NEXT_IS_START:             # <<<<<<<<<<<<<<
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
 */
  }

  /* "src/lxml/iterparse.pxi":371
 *             if self._events[0][0] in ('start', 'start-ns'):
 *                 self._skip_state = IWSKIP_CAN_SKIP
 *         return self._pop_event(0)             # <<<<<<<<<<<<<<
 * 
 *     def skip_subtree(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_pop_event);
  __pyx_t_2 = __pyx_v_self->_pop_event; __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_int_0};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 371, __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;

  /* "src/lxml/iterparse.pxi":367
 * 
 *     @cython.final
 *     cdef _next_event(self):             # <<<<<<<<<<<<<<
 *         if self._skip_state == IWSKIP_NEXT_IS_START:
 *             if self._events[0][0] in ('start', 'start-ns'):
 */

  /* 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.iterwalk._next_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree, "Prevent descending into the current subtree.\n        Instead, the next returned event will be the 'end' event of the current element\n        (if included), ignoring any children or descendants.\n\n        This has no effect right after an 'end' or 'end-ns' event.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_8iterwalk_7skip_subtree = {"skip_subtree", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree};
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("skip_subtree (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("skip_subtree", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "skip_subtree", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_6skip_subtree(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_6skip_subtree(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("skip_subtree", 1);

  /* "src/lxml/iterparse.pxi":380
 *         This has no effect right after an 'end' or 'end-ns' event.
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_skip_state == __pyx_e_4lxml_5etree_IWSKIP_CAN_SKIP);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":381
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:
 *             self._skip_state = IWSKIP_SKIP_NEXT             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
    __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_SKIP_NEXT;

    /* "src/lxml/iterparse.pxi":380
 *         This has no effect right after an 'end' or 'end-ns' event.
 *         """
 *         if self._skip_state == IWSKIP_CAN_SKIP:             # <<<<<<<<<<<<<<
 *             self._skip_state = IWSKIP_SKIP_NEXT
 * 
 */
  }

  /* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
 */

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

/* "src/lxml/iterparse.pxi":384
 * 
 *     @cython.final
 *     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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_node", 1);

  /* "src/lxml/iterparse.pxi":386
 *     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)
 *             if self._events:
 */
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":387
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 */
    __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 == ((int)-1))) __PYX_ERR(14, 387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_ns_count = __pyx_t_3;

    /* "src/lxml/iterparse.pxi":388
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 */
    __pyx_t_1 = (__pyx_v_self->_events != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_events) != 0);
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":389
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START             # <<<<<<<<<<<<<<
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)
 */
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START;

      /* "src/lxml/iterparse.pxi":388
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 */
    }

    /* "src/lxml/iterparse.pxi":386
 *     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)
 *             if self._events:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":390
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         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) {

    /* "src/lxml/iterparse.pxi":391
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         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);

    /* "src/lxml/iterparse.pxi":390
 *             if self._events:
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/iterparse.pxi":393
 *             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):
 */
  /*else*/ {
    __pyx_v_ns_count = 0;
  }
  __pyx_L3:;

  /* "src/lxml/iterparse.pxi":394
 *         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( ("start", node) )
 */
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/iterparse.pxi":395
 *             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( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_1 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node);
    __pyx_t_1 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/iterparse.pxi":396
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )             # <<<<<<<<<<<<<<
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         return ns_count
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 396, __pyx_L1_error)
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_u_start);
      __Pyx_GIVEREF(__pyx_n_u_start);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_start)) __PYX_ERR(14, 396, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_node))) __PYX_ERR(14, 396, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 396, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/iterparse.pxi":397
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START             # <<<<<<<<<<<<<<
 *         return ns_count
 * 
 */
      __pyx_v_self->_skip_state = __pyx_e_4lxml_5etree_IWSKIP_NEXT_IS_START;

      /* "src/lxml/iterparse.pxi":395
 *             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( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 */
    }

    /* "src/lxml/iterparse.pxi":394
 *         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( ("start", node) )
 */
  }

  /* "src/lxml/iterparse.pxi":398
 *                 self._events.append( ("start", node) )
 *                 self._skip_state = IWSKIP_NEXT_IS_START
 *         return ns_count             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = __pyx_v_ns_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":384
 * 
 *     @cython.final
 *     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;
}

/* "src/lxml/iterparse.pxi":401
 * 
 *     @cython.final
 *     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_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_end_node", 1);

  /* "src/lxml/iterparse.pxi":404
 *         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 '%.30s'", "pop");
    __PYX_ERR(14, 404, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 404, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(14, 404, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(14, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 404, __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_ERR(14, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    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_ERR(14, 404, __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_ERR(14, 404, __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_ERR(14, 404, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(14, 404, __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;

  /* "src/lxml/iterparse.pxi":405
 *         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( ("end", node) )
 */
  __pyx_t_7 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":406
 *         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( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 */
    __pyx_t_8 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_7) {

      /* "src/lxml/iterparse.pxi":407
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(14, 407, __pyx_L1_error)
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_u_end);
      __Pyx_GIVEREF(__pyx_n_u_end);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_end)) __PYX_ERR(14, 407, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_node);
      __Pyx_GIVEREF((PyObject *)__pyx_v_node);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_node))) __PYX_ERR(14, 407, __pyx_L1_error);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/iterparse.pxi":406
 *         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( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 */
    }

    /* "src/lxml/iterparse.pxi":405
 *         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( ("end", node) )
 */
  }

  /* "src/lxml/iterparse.pxi":408
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:             # <<<<<<<<<<<<<<
 *             event = ("end-ns", None)
 *             for i in range(ns_count):
 */
  __pyx_t_8 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_ns_count != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_7) {

    /* "src/lxml/iterparse.pxi":409
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)             # <<<<<<<<<<<<<<
 *             for i in range(ns_count):
 *                 self._events.append(event)
 */
    __Pyx_INCREF(__pyx_tuple__60);
    __pyx_v_event = __pyx_tuple__60;

    /* "src/lxml/iterparse.pxi":410
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:
 *             event = ("end-ns", None)
 *             for i in range(ns_count):             # <<<<<<<<<<<<<<
 *                 self._events.append(event)
 *         return node
 */
    __pyx_t_6 = __pyx_v_ns_count;
    __pyx_t_10 = __pyx_t_6;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "src/lxml/iterparse.pxi":411
 *             event = ("end-ns", None)
 *             for i in range(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 '%.30s'", "append");
        __PYX_ERR(14, 411, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_v_event); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(14, 411, __pyx_L1_error)
    }

    /* "src/lxml/iterparse.pxi":408
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( ("end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS and ns_count:             # <<<<<<<<<<<<<<
 *             event = ("end-ns", None)
 *             for i in range(ns_count):
 */
  }

  /* "src/lxml/iterparse.pxi":412
 *             for i in range(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;

  /* "src/lxml/iterparse.pxi":401
 * 
 *     @cython.final
 *     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;
}

/* "src/lxml/iterparse.pxi":415
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/iterparse.pxi":418
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "src/lxml/iterparse.pxi":419
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/iterparse.pxi":420
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/iterparse.pxi":421
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + (__pyx_v_c_ns->href != NULL));

    /* "src/lxml/iterparse.pxi":422
 *     while c_ns is not NULL:
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "src/lxml/iterparse.pxi":423
 *         count += (c_ns.href is not NULL)
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":415
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node) noexcept:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/iterparse.pxi":426
 * 
 * 
 * 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", 1);

  /* "src/lxml/iterparse.pxi":429
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "src/lxml/iterparse.pxi":430
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         if c_ns.href:
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/iterparse.pxi":431
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/iterparse.pxi":432
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href:             # <<<<<<<<<<<<<<
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
 */
    __pyx_t_2 = (__pyx_v_c_ns->href != 0);
    if (__pyx_t_2) {

      /* "src/lxml/iterparse.pxi":433
 *     while c_ns is not NULL:
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),             # <<<<<<<<<<<<<<
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/iterparse.pxi":434
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))             # <<<<<<<<<<<<<<
 *             event_list.append( ("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_ERR(14, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/iterparse.pxi":433
 *     while c_ns is not NULL:
 *         if c_ns.href:
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),             # <<<<<<<<<<<<<<
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(14, 433, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(14, 433, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns_tuple, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":435
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
 *             event_list.append( ("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 '%.30s'", "append");
        __PYX_ERR(14, 435, __pyx_L1_error)
      }
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 435, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_kp_u_start_ns);
      __Pyx_GIVEREF(__pyx_kp_u_start_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_start_ns)) __PYX_ERR(14, 435, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ns_tuple);
      __Pyx_GIVEREF(__pyx_v_ns_tuple);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_tuple)) __PYX_ERR(14, 435, __pyx_L1_error);
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_event_list, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(14, 435, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/iterparse.pxi":436
 *                         funicode(c_ns.href))
 *             event_list.append( ("start-ns", ns_tuple) )
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
      __pyx_v_count = (__pyx_v_count + 1);

      /* "src/lxml/iterparse.pxi":432
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href:             # <<<<<<<<<<<<<<
 *             ns_tuple = (funicodeOrEmpty(c_ns.prefix),
 *                         funicode(c_ns.href))
 */
    }

    /* "src/lxml/iterparse.pxi":437
 *             event_list.append( ("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;
  }

  /* "src/lxml/iterparse.pxi":438
 *             count += 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "src/lxml/iterparse.pxi":426
 * 
 * 
 * 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;
}

/* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_56XMLID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_55XMLID, "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_56XMLID = {"XMLID", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_56XMLID, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_55XMLID};
static PyObject *__pyx_pw_4lxml_5etree_56XMLID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 3, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 3, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "XMLID") < 0)) __PYX_ERR(15, 3, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLID", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_55XMLID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_55XMLID(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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  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", 1);

  /* "src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__find_id_attributes == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPath), __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_id_attributes);
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_id_attributes, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
 */
  }

  /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XML); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_text)) __PYX_ERR(15, 18, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_parser)) __PYX_ERR(15, 18, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_base_url, __pyx_v_base_url) < 0) __PYX_ERR(15, 18, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_root = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "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('id')] = elem
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_dic = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get('id')] = elem
 *     return root, dic
 */
  __Pyx_INCREF(__pyx_v_4lxml_5etree__find_id_attributes);
  __pyx_t_4 = __pyx_v_4lxml_5etree__find_id_attributes; __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_root};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(15, 20, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(15, 20, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_8(__pyx_t_4);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(15, 20, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get('id')] = elem             # <<<<<<<<<<<<<<
 *     return root, dic
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_n_u_id};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    if (unlikely((PyDict_SetItem(__pyx_v_dic, __pyx_t_5, __pyx_v_elem) < 0))) __PYX_ERR(15, 21, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get('id')] = elem
 *     return root, dic
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/xmlid.pxi":22
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get('id')] = elem
 *     return root, dic             # <<<<<<<<<<<<<<
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_root)) __PYX_ERR(15, 22, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dic);
  __Pyx_GIVEREF(__pyx_v_dic);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_dic)) __PYX_ERR(15, 22, __pyx_L1_error);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("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;
}

/* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_58XMLDTDID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_57XMLDTDID, "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_58XMLDTDID = {"XMLDTDID", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_58XMLDTDID, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_57XMLDTDID};
static PyObject *__pyx_pw_4lxml_5etree_58XMLDTDID(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_text)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 24, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 24, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 24, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "XMLDTDID") < 0)) __PYX_ERR(15, 24, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLDTDID", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 24, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_57XMLDTDID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_57XMLDTDID(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", 1);

  /* "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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_XML); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text)) __PYX_ERR(15, 37, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser)) __PYX_ERR(15, 37, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 37, __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_ERR(15, 37, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 37, __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_ERR(15, 37, __pyx_L1_error)
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "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);
  if (__pyx_t_5) {

    /* "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 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root))) __PYX_ERR(15, 40, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4)) __PYX_ERR(15, 40, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "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:
 */
  }

  /* "src/lxml/xmlid.pxi":42
 *         return root, {}
 *     else:
 *         return root, _IDDict(root)             # <<<<<<<<<<<<<<
 * 
 * def parseid(source, parser=None, *, base_url=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__IDDict), ((PyObject *)__pyx_v_root)); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF((PyObject *)__pyx_v_root);
    __Pyx_GIVEREF((PyObject *)__pyx_v_root);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_root))) __PYX_ERR(15, 42, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(15, 42, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_60parseid(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_59parseid, "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_60parseid = {"parseid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_60parseid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_59parseid};
static PyObject *__pyx_pw_4lxml_5etree_60parseid(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_source)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 44, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 44, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 44, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parseid") < 0)) __PYX_ERR(15, 44, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseid", 0, 1, 2, __pyx_nargs); __PYX_ERR(15, 44, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_59parseid(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_59parseid(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", 1);

  /* "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_ERR(15, 55, __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_ERR(15, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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_ERR(15, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__IDDict), ((PyObject *)__pyx_v_doc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(15, 56, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(15, 56, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 69, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(15, 69, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 69, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/xmlid.pxi":71
 *     def __cinit__(self, etree):
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "No ID dictionary available."
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc
 */
  __pyx_t_2 = (__pyx_v_doc->_c_doc->ids == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xmlid.pxi":73
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "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_ERR(15, 73, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "No ID dictionary available."
 *         self._doc = doc
 */
  }

  /* "src/lxml/xmlid.pxi":74
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, "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((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "src/lxml/xmlid.pxi":75
 *             raise ValueError, "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;

  /* "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;

  /* "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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_3copy = {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_3copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 1);

  /* "src/lxml/xmlid.pxi":79
 * 
 *     def copy(self):
 *         return _IDDict(self._doc)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__IDDict), ((PyObject *)__pyx_v_self->_doc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "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_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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);

  /* "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;

  /* "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_ERR(15, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "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, "key not found."
 */
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_c_ids, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_id_utf)));

  /* "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, "key not found."
 *         c_attr = c_id.attr
 */
  __pyx_t_3 = (__pyx_v_c_id == NULL);
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xmlid.pxi":89
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:
 *             raise KeyError, "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_ERR(15, 89, __pyx_L1_error)

    /* "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, "key not found."
 *         c_attr = c_id.attr
 */
  }

  /* "src/lxml/xmlid.pxi":90
 *         if c_id is NULL:
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr             # <<<<<<<<<<<<<<
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "ID attribute not found."
 */
  __pyx_t_4 = __pyx_v_c_id->attr;
  __pyx_v_c_attr = __pyx_t_4;

  /* "src/lxml/xmlid.pxi":91
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
 */
  __pyx_t_5 = (__pyx_v_c_attr == NULL);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_5 = (__pyx_v_c_attr->parent == NULL);
  __pyx_t_3 = __pyx_t_5;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xmlid.pxi":92
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "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_ERR(15, 92, __pyx_L1_error)

    /* "src/lxml/xmlid.pxi":91
 *             raise KeyError, "key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, "ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
 */
  }

  /* "src/lxml/xmlid.pxi":93
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, "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_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "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_6);
  __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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_7get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_7get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_id_name,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id_name)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 95, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(15, 95, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_id_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 95, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._IDDict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_6get(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_id_name);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_id_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "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_ERR(15, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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;

  /* "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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_11has_key = {"has_key", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_11has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_11has_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_id_name,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id_name)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 105, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "has_key") < 0)) __PYX_ERR(15, 105, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_id_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_key", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 105, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._IDDict.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_10has_key(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_id_name);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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_ContainsTF(__pyx_v_id_name, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(15, 106, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xmlid.pxi":109
 * 
 *     def __repr__(self):
 *         return repr(dict(self))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 109, __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;

  /* "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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_15keys = {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_15keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) return NULL;
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 1);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":113
 *     def keys(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return self._keys[:]
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":112
 * 
 *     def keys(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return self._keys[:]
 */
  }

  /* "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_2 = __Pyx_PyObject_GetSlice(__pyx_v_self->_keys, 0, 0, NULL, NULL, &__pyx_slice__93, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "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_2);
  __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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 1);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":118
 *     def __iter__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return iter(self._keys)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":117
 * 
 *     def __iter__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return iter(self._keys)
 */
  }

  /* "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_2 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 119, __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;

  /* "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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_19iterkeys = {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iterkeys", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) return NULL;
  __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", 1);

  /* "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;

  /* "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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 1);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":126
 *     def __len__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return len(self._keys)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":125
 * 
 *     def __len__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return len(self._keys)
 */
  }

  /* "src/lxml/xmlid.pxi":127
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return len(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __pyx_t_2 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(15, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "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_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_23items = {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_23items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_23items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) return NULL;
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 1);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":131
 *     def items(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return self._items[:]
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":130
 * 
 *     def items(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return self._items[:]
 */
  }

  /* "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_2 = __Pyx_PyObject_GetSlice(__pyx_v_self->_items, 0, 0, NULL, NULL, &__pyx_slice__93, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "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_2);
  __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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_25iteritems = {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iteritems", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) return NULL;
  __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;
  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("iteritems", 1);

  /* "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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlid.pxi":136
 *     def iteritems(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return iter(self._items)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/xmlid.pxi":135
 * 
 *     def iteritems(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return iter(self._items)
 */
  }

  /* "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_2 = __pyx_v_self->_items;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 137, __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;

  /* "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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_27values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_27values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 1);

  /* "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_ERR(15, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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);
  if (__pyx_t_2) {

    /* "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_ERR(15, 142, __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;

    /* "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:
 */
  }

  /* "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 (likely(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_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 143, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(15, 143, __pyx_L1_error)
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(15, 143, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "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_5 = PyTuple_GET_ITEM(__pyx_v_item, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
    __pyx_t_5 = 0;

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

    /* "src/lxml/xmlid.pxi":146
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 *             values.append(value)             # <<<<<<<<<<<<<<
 *         return values
 * 
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_values, __pyx_v_value); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(15, 146, __pyx_L1_error)

    /* "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)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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;

  /* "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_5);
  __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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_7_IDDict_29itervalues = {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_29itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_29itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) return NULL;
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 1);

  /* "src/lxml/xmlid.pxi":150
 * 
 *     def itervalues(self):
 *         return iter(self.values())             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 150, __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;

  /* "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_XDECREF(__pyx_t_3);
  __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;
}

/* "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", 1);

  /* "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_ERR(15, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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;

  /* "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;
}

/* "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", 1);

  /* "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_ERR(15, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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_ERR(15, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_items);
  __Pyx_GIVEREF(__pyx_v_items);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_items)) __PYX_ERR(15, 160, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_doc);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_doc))) __PYX_ERR(15, 160, __pyx_L1_error);
  __pyx_v_context = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

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

  /* "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) noexcept:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_items);
  __pyx_r = __pyx_v_items;
  goto __pyx_L0;

  /* "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;
}

/* "src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     # 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;
  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("_collectIdHashItemList", 1);

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

  /* "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_2 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr->parent == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "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;

    /* "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
 */
  }

  /* "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_3 = ((PyObject *)__pyx_v_context);
  __Pyx_INCREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(15, 171, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_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_ERR(15, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(15, 171, __pyx_L1_error)
  }
  if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_4))) __PYX_ERR(15, 171, __pyx_L1_error)
  __pyx_v_lst = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_doc = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "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_ERR(15, 172, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "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) noexcept:
 */
  if (unlikely(__pyx_v_lst == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(15, 173, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(15, 173, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_element);
  __Pyx_GIVEREF((PyObject *)__pyx_v_element);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_element))) __PYX_ERR(15, 173, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_lst, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef list lst
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemList", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectIdHashKeys", 1);

  /* "src/lxml/xmlid.pxi":176
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     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);

  /* "src/lxml/xmlid.pxi":177
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     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_2 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_id->attr->parent == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "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;

    /* "src/lxml/xmlid.pxi":177
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:
 *     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))
 */
  }

  /* "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 '%.30s'", "append");
    __PYX_ERR(15, 179, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyList_Append(((PyObject*)__pyx_v_collect_list), __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(15, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name) noexcept:             # <<<<<<<<<<<<<<
 *     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_3);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashKeys", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/xinclude.pxi":19
 *     """
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/xinclude.pxi":20
 *     cdef _ErrorLog _error_log
 *     def __init__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/xinclude.pxi":19
 *     """
 *     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;
}

/* "src/lxml/xinclude.pxi":22
 *         self._error_log = _ErrorLog()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xinclude.pxi":24
 *     @property
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XInclude_instance_not_initialise, 0, 0);
      __PYX_ERR(16, 24, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(16, 24, __pyx_L1_error)
  #endif

  /* "src/lxml/xinclude.pxi":25
 *     def error_log(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_ERR(16, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xinclude.pxi":22
 *         self._error_log = _ErrorLog()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XInclude instance not initialised"
 */

  /* 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;
}

/* "src/lxml/xinclude.pxi":27
 *         return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         "__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_8XInclude_2__call__, "__call__(self, node)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 27, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(16, 27, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(16, 27, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(16, 27, __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  long __pyx_v_parse_options;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  void *__pyx_v_c_context;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/xinclude.pxi":37
 *         # i.e. as a sibling, which does not conflict with traversal.
 *         cdef int result
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 37, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":38
 *         cdef int result
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"             # <<<<<<<<<<<<<<
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XInclude_processor_not_initialis, 0, 0);
      __PYX_ERR(16, 38, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(16, 38, __pyx_L1_error)
  #endif

  /* "src/lxml/xinclude.pxi":39
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_node->_doc->_parser) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":40
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options             # <<<<<<<<<<<<<<
 *             context = node._doc._parser._getParserContext()
 *             c_context = <void*>context
 */
    __pyx_t_1 = __pyx_v_node->_doc->_parser->_parse_options;
    __pyx_v_parse_options = __pyx_t_1;

    /* "src/lxml/xinclude.pxi":41
 *         if node._doc._parser is not None:
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()             # <<<<<<<<<<<<<<
 *             c_context = <void*>context
 *         else:
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_node->_doc->_parser->__pyx_vtab)->_getParserContext(__pyx_v_node->_doc->_parser)); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xinclude.pxi":42
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
 *             c_context = <void*>context             # <<<<<<<<<<<<<<
 *         else:
 *             parse_options = 0
 */
    __pyx_v_c_context = ((void *)__pyx_v_context);

    /* "src/lxml/xinclude.pxi":39
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XInclude processor not initialised"
 *         if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *             parse_options = node._doc._parser._parse_options
 *             context = node._doc._parser._getParserContext()
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xinclude.pxi":44
 *             c_context = <void*>context
 *         else:
 *             parse_options = 0             # <<<<<<<<<<<<<<
 *             context = None
 *             c_context = NULL
 */
  /*else*/ {
    __pyx_v_parse_options = 0;

    /* "src/lxml/xinclude.pxi":45
 *         else:
 *             parse_options = 0
 *             context = None             # <<<<<<<<<<<<<<
 *             c_context = NULL
 * 
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None);

    /* "src/lxml/xinclude.pxi":46
 *             parse_options = 0
 *             context = None
 *             c_context = NULL             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
    __pyx_v_c_context = NULL;
  }
  __pyx_L3:;

  /* "src/lxml/xinclude.pxi":48
 *             c_context = NULL
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_connect(__pyx_v_self->_error_log); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 48, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":49
 * 
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
 */
  __pyx_t_4 = (LIBXML_VERSION < 0x50E0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_c_context != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":50
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             orig_loader = _register_document_loader()
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_context); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 50, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":49
 * 
 *         self._error_log.connect()
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
 */
  }

  /* "src/lxml/xinclude.pxi":51
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if c_context:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/xinclude.pxi":52
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             if c_context:
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
 */
        __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

        /* "src/lxml/xinclude.pxi":53
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             if c_context:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
 *                     node._c_node, parse_options, c_context)
 */
        __pyx_t_2 = (__pyx_v_c_context != 0);
        if (__pyx_t_2) {

          /* "src/lxml/xinclude.pxi":54
 *             orig_loader = _register_document_loader()
 *             if c_context:
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(             # <<<<<<<<<<<<<<
 *                     node._c_node, parse_options, c_context)
 *             else:
 */
          __pyx_v_result = xmlXIncludeProcessTreeFlagsData(__pyx_v_node->_c_node, __pyx_v_parse_options, __pyx_v_c_context);

          /* "src/lxml/xinclude.pxi":53
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             if c_context:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlagsData(
 *                     node._c_node, parse_options, c_context)
 */
          goto __pyx_L10;
        }

        /* "src/lxml/xinclude.pxi":57
 *                     node._c_node, parse_options, c_context)
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 */
        /*else*/ {
          __pyx_v_result = xmlXIncludeProcessTree(__pyx_v_node->_c_node);
        }
        __pyx_L10:;

        /* "src/lxml/xinclude.pxi":58
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 */
        __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
      }

      /* "src/lxml/xinclude.pxi":51
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             if c_context:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "src/lxml/xinclude.pxi":59
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
 */
  __pyx_t_4 = (LIBXML_VERSION < 0x50E0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_c_context != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xinclude.pxi":60
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(16, 60, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":59
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *             _reset_document_loader(orig_loader)
 *         if tree.LIBXML_VERSION < 20704 or not c_context:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
 */
  }

  /* "src/lxml/xinclude.pxi":61
 *         if tree.LIBXML_VERSION < 20704 or not c_context:
 *             __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 == ((int)-1))) __PYX_ERR(16, 61, __pyx_L1_error)

  /* "src/lxml/xinclude.pxi":63
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_2 = (__pyx_v_result == -1L);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xinclude.pxi":65
 *         if result == -1:
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "XInclude processing failed"),
 *                 self._error_log)
 */
    __pyx_t_3 = __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_3)) __PYX_ERR(16, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/xinclude.pxi":64
 * 
 *         if result == -1:
 *             raise XIncludeError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "XInclude processing failed"),
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(16, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(16, 64, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(16, 64, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XIncludeError), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 64, __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_ERR(16, 64, __pyx_L1_error)

    /* "src/lxml/xinclude.pxi":63
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
 */
  }

  /* "src/lxml/xinclude.pxi":27
 *         return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         "__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_AddTraceback("lxml.etree.XInclude.__call__", __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;
}

/* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_62cleanup_namespaces(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_61cleanup_namespaces, "cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)\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\n    If a 'top_nsmap' is provided, it must be a mapping from prefixes\n    to namespace URIs.  These namespaces will be declared on the top\n    element of the subtree before running the cleanup, which allows\n    moving namespace declarations to the top of the tree.\n\n    If a 'keep_ns_prefixes' is provided, it must be a list of prefixes.\n    These prefixes will not be removed as part of the cleanup.\n    ");
static PyMethodDef __pyx_mdef_4lxml_5etree_62cleanup_namespaces = {"cleanup_namespaces", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_62cleanup_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_61cleanup_namespaces};
static PyObject *__pyx_pw_4lxml_5etree_62cleanup_namespaces(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_top_nsmap = 0;
  PyObject *__pyx_v_keep_ns_prefixes = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cleanup_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,&__pyx_n_s_top_nsmap,&__pyx_n_s_keep_ns_prefixes,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_top_nsmap);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 3, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_keep_ns_prefixes);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 3, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cleanup_namespaces") < 0)) __PYX_ERR(17, 3, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tree_or_element = values[0];
    __pyx_v_top_nsmap = values[1];
    __pyx_v_keep_ns_prefixes = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cleanup_namespaces", 0, 1, 3, __pyx_nargs); __PYX_ERR(17, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_61cleanup_namespaces(__pyx_self, __pyx_v_tree_or_element, __pyx_v_top_nsmap, __pyx_v_keep_ns_prefixes);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_61cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_top_nsmap, PyObject *__pyx_v_keep_ns_prefixes) {
  struct LxmlElement *__pyx_v_element = NULL;
  xmlNode *__pyx_v_c_element;
  struct LxmlDocument *__pyx_v_doc = NULL;
  PyObject *__pyx_9genexpr17__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cleanup_namespaces", 0);
  __Pyx_INCREF(__pyx_v_keep_ns_prefixes);

  /* "src/lxml/cleanup.pxi":17
 *     These prefixes will not be removed as part of the cleanup.
 *     """
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     c_element = element._c_node
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":18
 *     """
 *     element = _rootNodeOrRaise(tree_or_element)
 *     c_element = element._c_node             # <<<<<<<<<<<<<<
 * 
 *     if top_nsmap:
 */
  __pyx_t_2 = __pyx_v_element->_c_node;
  __pyx_v_c_element = __pyx_t_2;

  /* "src/lxml/cleanup.pxi":20
 *     c_element = element._c_node
 * 
 *     if top_nsmap:             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_top_nsmap); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(17, 20, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":21
 * 
 *     if top_nsmap:
 *         doc = element._doc             # <<<<<<<<<<<<<<
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/cleanup.pxi":23
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(doc, c_element.doc, c_element)
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__setNodeNamespaces(__pyx_v_c_element, __pyx_v_doc, Py_None, __pyx_v_top_nsmap); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 23, __pyx_L1_error)

    /* "src/lxml/cleanup.pxi":24
 *         # declare namespaces from nsmap, then apply them to the subtree
 *         _setNodeNamespaces(c_element, doc, None, top_nsmap)
 *         moveNodeToDocument(doc, c_element.doc, c_element)             # <<<<<<<<<<<<<<
 * 
 *     keep_ns_prefixes = (
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_c_element->doc, __pyx_v_c_element); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 24, __pyx_L1_error)

    /* "src/lxml/cleanup.pxi":20
 *     c_element = element._c_node
 * 
 *     if top_nsmap:             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         # declare namespaces from nsmap, then apply them to the subtree
 */
  }

  /* "src/lxml/cleanup.pxi":28
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])
 *         if keep_ns_prefixes else None)             # <<<<<<<<<<<<<<
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_keep_ns_prefixes); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(17, 28, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":27
 * 
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])             # <<<<<<<<<<<<<<
 *         if keep_ns_prefixes else None)
 * 
 */
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(17, 27, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (likely(PyList_CheckExact(__pyx_v_keep_ns_prefixes)) || PyTuple_CheckExact(__pyx_v_keep_ns_prefixes)) {
        __pyx_t_6 = __pyx_v_keep_ns_prefixes; __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_keep_ns_prefixes); if (unlikely(!__pyx_t_6)) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(17, 27, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
            #else
            __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(17, 27, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(17, 27, __pyx_L6_error)
            #else
            __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(17, 27, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          }
        } else {
          __pyx_t_9 = __pyx_t_8(__pyx_t_6);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(17, 27, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr17__pyx_v_prefix, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_9 = __pyx_f_4lxml_5etree__utf8(__pyx_9genexpr17__pyx_v_prefix); if (unlikely(!__pyx_t_9)) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_9))) __PYX_ERR(17, 27, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_prefix); __pyx_9genexpr17__pyx_v_prefix = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_prefix); __pyx_9genexpr17__pyx_v_prefix = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __pyx_t_6 = PySet_New(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(17, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {

    /* "src/lxml/cleanup.pxi":28
 *     keep_ns_prefixes = (
 *         set([_utf8(prefix) for prefix in keep_ns_prefixes])
 *         if keep_ns_prefixes else None)             # <<<<<<<<<<<<<<
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)
 */
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __Pyx_DECREF_SET(__pyx_v_keep_ns_prefixes, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":30
 *         if keep_ns_prefixes else None)
 * 
 *     _removeUnusedNamespaceDeclarations(c_element, keep_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (!(likely(PySet_CheckExact(__pyx_v_keep_ns_prefixes))||((__pyx_v_keep_ns_prefixes) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_v_keep_ns_prefixes))) __PYX_ERR(17, 30, __pyx_L1_error)
  __pyx_t_4 = __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(__pyx_v_c_element, ((PyObject*)__pyx_v_keep_ns_prefixes)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 30, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_keep_ns_prefixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_64strip_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_63strip_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_64strip_attributes = {"strip_attributes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_64strip_attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_63strip_attributes};
static PyObject *__pyx_pw_4lxml_5etree_64strip_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_attribute_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_attribute_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_attribute_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_attribute_names);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 33, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "strip_attributes") < 0)) __PYX_ERR(17, 33, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_attributes", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 33, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_63strip_attributes(__pyx_self, __pyx_v_tree_or_element, __pyx_v_attribute_names);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_attribute_names);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_63strip_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 = 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;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_attributes", 1);

  /* "src/lxml/cleanup.pxi":49
 *     """
 *     cdef _MultiTagMatcher matcher
 *     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_ERR(17, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":50
 *     cdef _MultiTagMatcher matcher
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_attribute_names) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":51
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":50
 *     cdef _MultiTagMatcher matcher
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/cleanup.pxi":53
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_attribute_names);
  __Pyx_GIVEREF(__pyx_v_attribute_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attribute_names)) __PYX_ERR(17, 53, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 53, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/cleanup.pxi":54
 * 
 *     matcher = _MultiTagMatcher.__new__(_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 == ((int)-1))) __PYX_ERR(17, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":55
 *     matcher = _MultiTagMatcher.__new__(_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);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":56
 *     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;

    /* "src/lxml/cleanup.pxi":55
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, attribute_names)
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():             # <<<<<<<<<<<<<<
 *         return
 *     _strip_attributes(element._c_node, matcher)
 */
  }

  /* "src/lxml/cleanup.pxi":57
 *     if matcher.rejectsAllAttributes():
 *         return
 *     _strip_attributes(element._c_node, matcher)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_attributes(__pyx_v_element->_c_node, __pyx_v_matcher); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """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;
}

/* "src/lxml/cleanup.pxi":60
 * 
 * 
 * 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", 1);

  /* "src/lxml/cleanup.pxi":63
 *     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);

  /* "src/lxml/cleanup.pxi":64
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":65
 *     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;

    /* "src/lxml/cleanup.pxi":66
 *     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);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":67
 *         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;

      /* "src/lxml/cleanup.pxi":68
 *         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);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":69
 *             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)
 */
        (void)(xmlRemoveProp(__pyx_v_c_attr));

        /* "src/lxml/cleanup.pxi":68
 *         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
 */
      }

      /* "src/lxml/cleanup.pxi":70
 *             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;
    }

    /* "src/lxml/cleanup.pxi":64
 *     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:
 */
  }

  /* "src/lxml/cleanup.pxi":71
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":60
 * 
 * 
 * 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;
}

/* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_66strip_elements(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_65strip_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_66strip_elements = {"strip_elements", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_66strip_elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_65strip_elements};
static PyObject *__pyx_pw_4lxml_5etree_66strip_elements(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_tag_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tag_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tag_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tag_names);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,&__pyx_n_s_with_tail,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 74, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 74, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "strip_elements") < 0)) __PYX_ERR(17, 74, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_ERR(17, 74, __pyx_L3_error)
    } else {
      __pyx_v_with_tail = ((int)((int)1));
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_elements", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 74, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_65strip_elements(__pyx_self, __pyx_v_tree_or_element, __pyx_v_with_tail, __pyx_v_tag_names);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_tag_names);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_65strip_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 LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = 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;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_elements", 1);

  /* "src/lxml/cleanup.pxi":100
 *     """
 *     cdef _MultiTagMatcher matcher
 *     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_ERR(17, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":101
 *     cdef _MultiTagMatcher matcher
 *     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_ERR(17, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":102
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_tag_names) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":103
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":102
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/cleanup.pxi":105
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names)) __PYX_ERR(17, 105, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 105, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/cleanup.pxi":106
 * 
 *     matcher = _MultiTagMatcher.__new__(_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 == ((int)-1))) __PYX_ERR(17, 106, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":107
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":108
 *     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;

    /* "src/lxml/cleanup.pxi":107
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/cleanup.pxi":110
 *         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, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":112
 *     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_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":113
 *         # 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 == ((int)-1))) __PYX_ERR(17, 113, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":112
 *     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):
 */
    }

    /* "src/lxml/cleanup.pxi":114
 *         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_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":115
 *             _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 == ((int)-1))) __PYX_ERR(17, 115, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":114
 *         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)
 */
    }

    /* "src/lxml/cleanup.pxi":110
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 */
  }

  /* "src/lxml/cleanup.pxi":116
 *         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_ERR(17, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """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_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":118
 *     _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", 1);

  /* "src/lxml/cleanup.pxi":123
 *     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);

  /* "src/lxml/cleanup.pxi":124
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":128
 *         # 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);

    /* "src/lxml/cleanup.pxi":129
 *         # 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);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":130
 *         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);

      /* "src/lxml/cleanup.pxi":131
 *         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);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":132
 *             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);
        if (__pyx_t_1) {

          /* "src/lxml/cleanup.pxi":133
 *             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);
          if (__pyx_t_1) {

            /* "src/lxml/cleanup.pxi":134
 *                 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);

            /* "src/lxml/cleanup.pxi":133
 *             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)
 */
          }

          /* "src/lxml/cleanup.pxi":135
 *                     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 == ((int)-1))) __PYX_ERR(17, 135, __pyx_L1_error)

          /* "src/lxml/cleanup.pxi":132
 *             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)
 */
          goto __pyx_L7;
        }

        /* "src/lxml/cleanup.pxi":137
 *                     _removeNode(doc, c_child)
 *                 else:
 *                     if with_tail:             # <<<<<<<<<<<<<<
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 */
        /*else*/ {
          if (__pyx_v_with_tail) {

            /* "src/lxml/cleanup.pxi":138
 *                 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);

            /* "src/lxml/cleanup.pxi":137
 *                     _removeNode(doc, c_child)
 *                 else:
 *                     if with_tail:             # <<<<<<<<<<<<<<
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 */
          }

          /* "src/lxml/cleanup.pxi":139
 *                     if with_tail:
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
 */
          xmlUnlinkNode(__pyx_v_c_child);

          /* "src/lxml/cleanup.pxi":140
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
          (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child));
        }
        __pyx_L7:;

        /* "src/lxml/cleanup.pxi":131
 *         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:
 */
      }

      /* "src/lxml/cleanup.pxi":141
 *                     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;
    }

    /* "src/lxml/cleanup.pxi":124
 * 
 *     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
 */
  }

  /* "src/lxml/cleanup.pxi":142
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":118
 *     _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;
}

/* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_68strip_tags(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_67strip_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_68strip_tags = {"strip_tags", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_68strip_tags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_67strip_tags};
static PyObject *__pyx_pw_4lxml_5etree_68strip_tags(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_tag_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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 !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_tag_names = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_tag_names)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_tag_names);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        default:
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tree_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 145, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "strip_tags") < 0)) __PYX_ERR(17, 145, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_tags", 0, 1, 1, __pyx_nargs); __PYX_ERR(17, 145, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_67strip_tags(__pyx_self, __pyx_v_tree_or_element, __pyx_v_tag_names);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_tag_names);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_67strip_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 LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = 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;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_tags", 1);

  /* "src/lxml/cleanup.pxi":170
 *     """
 *     cdef _MultiTagMatcher matcher
 *     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_ERR(17, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":171
 *     cdef _MultiTagMatcher matcher
 *     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_ERR(17, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/cleanup.pxi":172
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_tag_names) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":173
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/cleanup.pxi":172
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/cleanup.pxi":175
 *         return
 * 
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names)) __PYX_ERR(17, 175, __pyx_L1_error);
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher(((PyTypeObject *)__pyx_ptype_4lxml_5etree__MultiTagMatcher), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 175, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/cleanup.pxi":176
 * 
 *     matcher = _MultiTagMatcher.__new__(_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 == ((int)-1))) __PYX_ERR(17, 176, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":177
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher);
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":178
 *     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;

    /* "src/lxml/cleanup.pxi":177
 *     matcher = _MultiTagMatcher.__new__(_MultiTagMatcher, tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "src/lxml/cleanup.pxi":180
 *         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, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_3) {

    /* "src/lxml/cleanup.pxi":182
 *     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_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":183
 *         # 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 == ((int)-1))) __PYX_ERR(17, 183, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":182
 *     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):
 */
    }

    /* "src/lxml/cleanup.pxi":184
 *         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_3 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE);
    if (__pyx_t_3) {

      /* "src/lxml/cleanup.pxi":185
 *             _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 == ((int)-1))) __PYX_ERR(17, 185, __pyx_L1_error)

      /* "src/lxml/cleanup.pxi":184
 *         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)
 */
    }

    /* "src/lxml/cleanup.pxi":180
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 */
  }

  /* "src/lxml/cleanup.pxi":186
 *         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_ERR(17, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """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_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/cleanup.pxi":188
 *     _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;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strip_tags", 1);

  /* "src/lxml/cleanup.pxi":192
 *     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);

  /* "src/lxml/cleanup.pxi":193
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/cleanup.pxi":197
 *         # 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);

    /* "src/lxml/cleanup.pxi":198
 *         # 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);
      if (!__pyx_t_1) break;

      /* "src/lxml/cleanup.pxi":199
 *         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));
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":200
 *         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);

        /* "src/lxml/cleanup.pxi":201
 *             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;

        /* "src/lxml/cleanup.pxi":199
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 c_child = _nextElement(c_child)
 *                 continue
 */
      }

      /* "src/lxml/cleanup.pxi":202
 *                 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);
      if (__pyx_t_1) {

        /* "src/lxml/cleanup.pxi":203
 *                 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_3 = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_child, 0);
        if (!__pyx_t_3) {
        } else {
          __pyx_t_2 = __pyx_t_3;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_3 = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);
        __pyx_t_2 = __pyx_t_3;
        __pyx_L8_bool_binop_done:;
        __pyx_v_c_next = __pyx_t_2;

        /* "src/lxml/cleanup.pxi":204
 *             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_4 = __pyx_f_4lxml_5etree__replaceNodeByChildren(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 204, __pyx_L1_error)

        /* "src/lxml/cleanup.pxi":205
 *                 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));
        if (__pyx_t_1) {

          /* "src/lxml/cleanup.pxi":206
 *                 _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);
          if (__pyx_t_1) {

            /* "src/lxml/cleanup.pxi":208
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *             else:
 */
            __pyx_t_4 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(17, 208, __pyx_L1_error)

            /* "src/lxml/cleanup.pxi":206
 *                 _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)
 */
          }

          /* "src/lxml/cleanup.pxi":205
 *                 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
 */
        }

        /* "src/lxml/cleanup.pxi":209
 *                         # 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;

        /* "src/lxml/cleanup.pxi":202
 *                 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)
 */
        goto __pyx_L7;
      }

      /* "src/lxml/cleanup.pxi":211
 *                 c_child = c_next
 *             else:
 *                 c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 */
      /*else*/ {
        __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "src/lxml/cleanup.pxi":212
 *             else:
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
 */
        xmlUnlinkNode(__pyx_v_c_child);

        /* "src/lxml/cleanup.pxi":213
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
        (void)(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child));

        /* "src/lxml/cleanup.pxi":214
 *                 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:;
    }

    /* "src/lxml/cleanup.pxi":193
 * 
 *     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
 */
  }

  /* "src/lxml/cleanup.pxi":215
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/cleanup.pxi":188
 *     _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;
}

/* "src/lxml/extensions.pxi":45
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/extensions.pxi":46
 * 
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 */
  __pyx_v_self->_xpathCtxt = NULL;

  /* "src/lxml/extensions.pxi":45
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":48
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 48, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extensions)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 48, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(11, 48, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_error_log)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 48, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(11, 48, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_enable_regexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 48, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(11, 48, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_build_smart_strings)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 48, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(11, 48, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(11, 48, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
      values[4] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(11, 48, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  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);

  /* "src/lxml/extensions.pxi":53
 *         cdef dict new_extensions
 *         cdef list ns
 *         self._utf_refs = {}             # <<<<<<<<<<<<<<
 *         self._global_namespaces = []
 *         self._function_cache = {}
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 53, __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;

  /* "src/lxml/extensions.pxi":54
 *         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_ERR(11, 54, __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;

  /* "src/lxml/extensions.pxi":55
 *         self._utf_refs = {}
 *         self._global_namespaces = []
 *         self._function_cache = {}             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._error_log = error_log
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 55, __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;

  /* "src/lxml/extensions.pxi":56
 *         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);

  /* "src/lxml/extensions.pxi":57
 *         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_ERR(11, 57, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_error_log;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/extensions.pxi":59
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":61
 *         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_2 = PyDict_Check(__pyx_v_extensions); 
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":62
 *             # 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_ERR(11, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_extensions);
      __Pyx_GIVEREF(__pyx_v_extensions);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_extensions)) __PYX_ERR(11, 62, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":61
 *         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}
 */
    }

    /* "src/lxml/extensions.pxi":64
 *                 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 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_new_extensions = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":65
 *             # 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 (likely(PyList_CheckExact(__pyx_v_extensions)) || PyTuple_CheckExact(__pyx_v_extensions)) {
      __pyx_t_1 = __pyx_v_extensions; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extensions); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 65, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 65, __pyx_L1_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(11, 65, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 65, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 65, __pyx_L1_error)
            #endif
            if (__pyx_t_3 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(11, 65, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 65, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_1);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(11, 65, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":66
 *             new_extensions = {}
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():             # <<<<<<<<<<<<<<
 *                     if name is None:
 *                         raise ValueError, "extensions must have non empty names"
 */
      __pyx_t_6 = 0;
      if (unlikely(__pyx_v_extension == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(11, 66, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_extension, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 66, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_9;
      __pyx_t_9 = 0;
      while (1) {
        __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_9, &__pyx_t_10, NULL, __pyx_t_8);
        if (unlikely(__pyx_t_11 == 0)) break;
        if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(11, 66, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_10);
        if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
          PyObject* sequence = __pyx_t_9;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(11, 66, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_13);
          #else
          __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 66, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(11, 66, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(11, 66, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
          index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_12);
          index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(11, 66, __pyx_L1_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(11, 66, __pyx_L1_error)
          __pyx_L10_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13);
        __pyx_t_13 = 0;
        __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":67
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 */
        __pyx_t_2 = (__pyx_v_name == Py_None);
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":68
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 *                         raise ValueError, "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_ERR(11, 68, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":67
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, "extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 */
        }

        /* "src/lxml/extensions.pxi":69
 *                     if name is None:
 *                         raise ValueError, "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_10 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 69, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_10));
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":70
 *                         raise ValueError, "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_10 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 70, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_10));
        __pyx_t_10 = 0;

        /* "src/lxml/extensions.pxi":71
 *                     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_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ns_utf)) __PYX_ERR(11, 71, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_name_utf)) __PYX_ERR(11, 71, __pyx_L1_error);
        if (unlikely((PyDict_SetItem(__pyx_v_new_extensions, __pyx_t_10, __pyx_v_function) < 0))) __PYX_ERR(11, 71, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":65
 *             # 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:
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":72
 *                     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_2 = __Pyx_PyObject_IsTrue(__pyx_v_new_extensions); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 72, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_new_extensions);
      __pyx_t_1 = __pyx_v_new_extensions;
      goto __pyx_L13_bool_binop_done;
    }
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
    __pyx_L13_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":59
 *         self._error_log = error_log
 * 
 *         if extensions is not None:             # <<<<<<<<<<<<<<
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
 */
  }

  /* "src/lxml/extensions.pxi":74
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 */
  __pyx_t_2 = (__pyx_v_namespaces != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":75
 * 
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
 */
    __pyx_t_2 = PyDict_Check(__pyx_v_namespaces); 
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":76
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()             # <<<<<<<<<<<<<<
 *             if namespaces:
 *                 ns = []
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_namespaces, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_namespaces, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":75
 * 
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
 */
    }

    /* "src/lxml/extensions.pxi":77
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_namespaces); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 77, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":78
 *                 namespaces = namespaces.items()
 *             if namespaces:
 *                 ns = []             # <<<<<<<<<<<<<<
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_ns = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":79
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
 */
      if (likely(PyList_CheckExact(__pyx_v_namespaces)) || PyTuple_CheckExact(__pyx_v_namespaces)) {
        __pyx_t_1 = __pyx_v_namespaces; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = 0;
        __pyx_t_4 = NULL;
      } else {
        __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_namespaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 79, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_4)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 79, __pyx_L1_error)
              #endif
              if (__pyx_t_3 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(11, 79, __pyx_L1_error)
            #else
            __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 79, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 79, __pyx_L1_error)
              #endif
              if (__pyx_t_3 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(11, 79, __pyx_L1_error)
            #else
            __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 79, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_4(__pyx_t_1);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(11, 79, __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;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(11, 79, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          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_ERR(11, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 79, __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_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(11, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
          index = 0; __pyx_t_10 = __pyx_t_15(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_10);
          index = 1; __pyx_t_9 = __pyx_t_15(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L20_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_9);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_13), 2) < 0) __PYX_ERR(11, 79, __pyx_L1_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L21_unpacking_done;
          __pyx_L20_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(11, 79, __pyx_L1_error)
          __pyx_L21_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
        __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "src/lxml/extensions.pxi":80
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 */
        __pyx_t_16 = (__pyx_v_prefix == Py_None);
        if (!__pyx_t_16) {
        } else {
          __pyx_t_2 = __pyx_t_16;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(11, 80, __pyx_L1_error)
        __pyx_t_17 = (!__pyx_t_16);
        __pyx_t_2 = __pyx_t_17;
        __pyx_L23_bool_binop_done:;
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":81
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "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_ERR(11, 81, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":80
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 */
        }

        /* "src/lxml/extensions.pxi":83
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "setting default namespace is not supported in XPath"
 */
        __pyx_t_17 = (__pyx_v_ns_uri == Py_None);
        if (!__pyx_t_17) {
        } else {
          __pyx_t_2 = __pyx_t_17;
          goto __pyx_L26_bool_binop_done;
        }
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely((__pyx_t_17 < 0))) __PYX_ERR(11, 83, __pyx_L1_error)
        __pyx_t_16 = (!__pyx_t_17);
        __pyx_t_2 = __pyx_t_16;
        __pyx_L26_bool_binop_done:;
        if (unlikely(__pyx_t_2)) {

          /* "src/lxml/extensions.pxi":84
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             "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_ERR(11, 84, __pyx_L1_error)

          /* "src/lxml/extensions.pxi":83
 *                         raise TypeError, \
 *                             "empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             "setting default namespace is not supported in XPath"
 */
        }

        /* "src/lxml/extensions.pxi":86
 *                         raise TypeError, \
 *                             "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_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 86, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":87
 *                             "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_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":88
 *                     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_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 88, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_prefix_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prefix_utf)) __PYX_ERR(11, 88, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_uri_utf)) __PYX_ERR(11, 88, __pyx_L1_error);
        __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_ns, __pyx_t_5); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(11, 88, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/extensions.pxi":79
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
 */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":89
 *                     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);

      /* "src/lxml/extensions.pxi":77
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 */
      goto __pyx_L17;
    }

    /* "src/lxml/extensions.pxi":91
 *                 namespaces = ns
 *             else:
 *                 namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         self._doc        = None
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_namespaces, Py_None);
    }
    __pyx_L17:;

    /* "src/lxml/extensions.pxi":74
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 */
  }

  /* "src/lxml/extensions.pxi":93
 *                 namespaces = None
 * 
 *         self._doc        = None             # <<<<<<<<<<<<<<
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/extensions.pxi":94
 * 
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ExceptionContext)); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_exc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_exc);
  __pyx_v_self->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":95
 *         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) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_extensions))) __PYX_ERR(11, 95, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_extensions;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_extensions);
  __Pyx_DECREF(__pyx_v_self->_extensions);
  __pyx_v_self->_extensions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":96
 *         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) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_namespaces))) __PYX_ERR(11, 96, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_namespaces;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_namespaces);
  __Pyx_DECREF(__pyx_v_self->_namespaces);
  __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":97
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()             # <<<<<<<<<<<<<<
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__TempStore)); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":98
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()             # <<<<<<<<<<<<<<
 *         self._build_smart_strings = build_smart_strings
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_temp_documents);
  __Pyx_DECREF(__pyx_v_self->_temp_documents);
  __pyx_v_self->_temp_documents = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":99
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings             # <<<<<<<<<<<<<<
 * 
 *         if enable_regexp:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_build_smart_strings); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(11, 99, __pyx_L1_error)
  __pyx_v_self->_build_smart_strings = __pyx_t_2;

  /* "src/lxml/extensions.pxi":101
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enable_regexp); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 101, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":102
 * 
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()             # <<<<<<<<<<<<<<
 *             _regexp._register_in_context(self)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ExsltRegExp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v__regexp = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":103
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(__pyx_v__regexp, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":101
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
 */
  }

  /* "src/lxml/extensions.pxi":48
 *         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_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("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;
}

/* "src/lxml/extensions.pxi":105
 *             _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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 1);

  /* "src/lxml/extensions.pxi":107
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":108
 *         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_ERR(11, 108, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_self->_namespaces, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":107
 *     cdef _BaseContext _copy(self):
 *         cdef _BaseContext context
 *         if self._namespaces is not None:             # <<<<<<<<<<<<<<
 *             namespaces = self._namespaces[:]
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":110
 *             namespaces = self._namespaces[:]
 *         else:
 *             namespaces = None             # <<<<<<<<<<<<<<
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_namespaces = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":111
 *         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_ERR(11, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/extensions.pxi":112
 *             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_ERR(11, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_5, __pyx_v_namespaces, Py_None, ((PyObject *)__pyx_v_self->_error_log), Py_False, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 5+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "src/lxml/extensions.pxi":111
 *         else:
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 */
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseContext))))) __PYX_ERR(11, 111, __pyx_L1_error)
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":113
 *         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_1 = (__pyx_v_self->_extensions != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":114
 *                                  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 '%.30s'", "copy");
      __PYX_ERR(11, 114, __pyx_L1_error)
    }
    __pyx_t_2 = PyDict_Copy(__pyx_v_self->_extensions); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_context->_extensions);
    __Pyx_DECREF(__pyx_v_context->_extensions);
    __pyx_v_context->_extensions = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":113
 *         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
 */
  }

  /* "src/lxml/extensions.pxi":115
 *         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;

  /* "src/lxml/extensions.pxi":105
 *             _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_2);
  __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;
}

/* "src/lxml/extensions.pxi":117
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         "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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_to_utf", 1);

  /* "src/lxml/extensions.pxi":120
 *         "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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":121
 *         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_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":120
 *         "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)
 */
  }

  /* "src/lxml/extensions.pxi":122
 *         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_2 = __pyx_v_self->_utf_refs;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_v_s);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":123
 *             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_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":124
 *         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;

    /* "src/lxml/extensions.pxi":123
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <bytes>dict_result
 *         utf = _utf8(s)
 */
  }

  /* "src/lxml/extensions.pxi":125
 *         if dict_result is not NULL:
 *             return <bytes>dict_result
 *         utf = _utf8(s)             # <<<<<<<<<<<<<<
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":126
 *             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_ERR(11, 126, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->_utf_refs, __pyx_v_s, __pyx_v_utf) < 0))) __PYX_ERR(11, 126, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":127
 *         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)
 */
  if (IS_PYPY) {

    /* "src/lxml/extensions.pxi":129
 *         if python.IS_PYPY:
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)             # <<<<<<<<<<<<<<
 *         return utf
 * 
 */
    Py_INCREF(__pyx_v_utf);

    /* "src/lxml/extensions.pxi":127
 *         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)
 */
  }

  /* "src/lxml/extensions.pxi":130
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
 *         return utf             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf);
  __pyx_r = __pyx_v_utf;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":117
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         "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_2);
  __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;
}

/* "src/lxml/extensions.pxi":132
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:             # <<<<<<<<<<<<<<
 *         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) {

  /* "src/lxml/extensions.pxi":133
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         xpathCtxt.userData = <void*>self
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "src/lxml/extensions.pxi":134
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self             # <<<<<<<<<<<<<<
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError
 */
  __pyx_v_xpathCtxt->userData = ((void *)__pyx_v_self);

  /* "src/lxml/extensions.pxi":136
 *         xpathCtxt.userData = <void*>self
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xpathCtxt.error = <xmlerror.xmlStructuredErrorFunc> _receiveXPathError             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_v_xpathCtxt->error = ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveXPathError);

  /* "src/lxml/extensions.pxi":132
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt) noexcept:             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
 */

  /* function exit code */
}

/* "src/lxml/extensions.pxi":139
 * 
 *     @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
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_register_context", 1);

  /* "src/lxml/extensions.pxi":140
 *     @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((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "src/lxml/extensions.pxi":141
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
 *         self._exc.clear()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc->__pyx_vtab)->clear(__pyx_v_self->_exc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(11, 141, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":139
 * 
 *     @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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext._register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":144
 * 
 *     @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
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cleanup_context", 1);

  /* "src/lxml/extensions.pxi":147
 *         #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():
 */
  if (IS_PYPY) {

    /* "src/lxml/extensions.pxi":149
 *         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_2 = 0;
    if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "itervalues");
      __PYX_ERR(11, 149, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_utf_refs, 1, __pyx_n_s_itervalues, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 149, __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_ERR(11, 149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":150
 *             # 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_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":147
 *         #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():
 */
  }

  /* "src/lxml/extensions.pxi":151
 *             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 '%.30s'", "clear");
    __PYX_ERR(11, 151, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyDict_Clear(__pyx_v_self->_utf_refs); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(11, 151, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":152
 *                 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);

  /* "src/lxml/extensions.pxi":153
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/extensions.pxi":144
 * 
 *     @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_1);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/extensions.pxi":156
 * 
 *     @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", 1);

  /* "src/lxml/extensions.pxi":157
 *     @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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":158
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL             # <<<<<<<<<<<<<<
 *             self._xpathCtxt = NULL
 * 
 */
    __pyx_v_self->_xpathCtxt->userData = NULL;

    /* "src/lxml/extensions.pxi":159
 *         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;

    /* "src/lxml/extensions.pxi":157
 *     @cython.final
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL
 */
  }

  /* "src/lxml/extensions.pxi":156
 * 
 *     @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;
}

/* "src/lxml/extensions.pxi":163
 *     # 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;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __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("addNamespace", 1);

  /* "src/lxml/extensions.pxi":165
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":166
 *         cdef list namespaces
 *         if prefix is None:
 *             raise TypeError, "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_ERR(11, 166, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":165
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  }

  /* "src/lxml/extensions.pxi":167
 *         if prefix is None:
 *             raise TypeError, "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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":168
 *             raise TypeError, "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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":169
 *         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_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_prefix_utf);
  __Pyx_GIVEREF(__pyx_v_prefix_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix_utf)) __PYX_ERR(11, 169, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ns_uri_utf);
  __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ns_uri_utf)) __PYX_ERR(11, 169, __pyx_L1_error);
  __pyx_v_new_item = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":170
 *         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_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":171
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = []
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_new_item);
    __Pyx_GIVEREF(__pyx_v_new_item);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_new_item)) __PYX_ERR(11, 171, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(__pyx_v_self->_namespaces);
    __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":170
 *         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:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/extensions.pxi":173
 *             self._namespaces = [new_item]
 *         else:
 *             namespaces = []             # <<<<<<<<<<<<<<
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 */
  /*else*/ {
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_namespaces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":174
 *         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_ERR(11, 174, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 174, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __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_ERR(11, 174, __pyx_L1_error)
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/extensions.pxi":175
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_v_prefix_utf, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(11, 175, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {

        /* "src/lxml/extensions.pxi":176
 *             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);

        /* "src/lxml/extensions.pxi":177
 *                 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, ((PyObject*)Py_None));

        /* "src/lxml/extensions.pxi":175
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
 */
      }

      /* "src/lxml/extensions.pxi":178
 *                     item = new_item
 *                     new_item = None
 *                 namespaces.append(item)             # <<<<<<<<<<<<<<
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(11, 178, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":174
 *         else:
 *             namespaces = []
 *             for item in self._namespaces:             # <<<<<<<<<<<<<<
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":179
 *                     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 != ((PyObject*)Py_None));
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":180
 *                 namespaces.append(item)
 *             if new_item is not None:
 *                 namespaces.append(new_item)             # <<<<<<<<<<<<<<
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_new_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(11, 180, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":179
 *                     new_item = None
 *                 namespaces.append(item)
 *             if new_item is not None:             # <<<<<<<<<<<<<<
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 */
    }

    /* "src/lxml/extensions.pxi":181
 *             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:;

  /* "src/lxml/extensions.pxi":182
 *                 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_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":183
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
    (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

    /* "src/lxml/extensions.pxi":182
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 */
  }

  /* "src/lxml/extensions.pxi":163
 *     # 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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/extensions.pxi":186
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, "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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerNamespace", 1);

  /* "src/lxml/extensions.pxi":187
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":188
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:
 *             raise TypeError, "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_ERR(11, 188, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":187
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  }

  /* "src/lxml/extensions.pxi":189
 *         if prefix is None:
 *             raise TypeError, "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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":190
 *             raise TypeError, "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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":191
 *         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 '%.30s'", "append");
    __PYX_ERR(11, 191, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(11, 191, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":192
 *         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))
 * 
 */
  (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

  /* "src/lxml/extensions.pxi":186
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, "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_2);
  __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;
}

/* "src/lxml/extensions.pxi":195
 *                                  _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;
  PyObject *__pyx_t_2 = NULL;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalNamespaces", 1);

  /* "src/lxml/extensions.pxi":196
 * 
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":197
 *     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;

    /* "src/lxml/extensions.pxi":196
 * 
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 */
  }

  /* "src/lxml/extensions.pxi":198
 *         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_ERR(11, 198, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 198, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __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_ERR(11, 198, __pyx_L1_error)
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(11, 198, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(11, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 198, __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_ERR(11, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      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_ERR(11, 198, __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_ERR(11, 198, __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;

    /* "src/lxml/extensions.pxi":199
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
    (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

    /* "src/lxml/extensions.pxi":198
 *         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))
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":195
 *                                  _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_2);
  __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.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;
}

/* "src/lxml/extensions.pxi":202
 *                 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", 1);

  /* "src/lxml/extensions.pxi":203
 * 
 *     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_ERR(11, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":204
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":205
 *         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_ERR(11, 205, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 205, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __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_ERR(11, 205, __pyx_L1_error)
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(11, 205, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        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_ERR(11, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 205, __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_ERR(11, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        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_ERR(11, 205, __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_ERR(11, 205, __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;

      /* "src/lxml/extensions.pxi":206
 *         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 '%.30s'", "append");
        __PYX_ERR(11, 206, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(11, 206, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":207
 *             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))
 * 
 */
      (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf)));

      /* "src/lxml/extensions.pxi":205
 *         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(
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":204
 *     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)
 */
  }

  /* "src/lxml/extensions.pxi":202
 *                 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;
}

/* "src/lxml/extensions.pxi":210
 *                     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", 1);

  /* "src/lxml/extensions.pxi":211
 * 
 *     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);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":212
 *     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_ERR(11, 212, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_self->_global_namespaces; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 212, __pyx_L1_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __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_ERR(11, 212, __pyx_L1_error)
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "src/lxml/extensions.pxi":213
 *         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[:]
 */
      (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL));

      /* "src/lxml/extensions.pxi":212
 *     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)
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":215
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]             # <<<<<<<<<<<<<<
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:
 */
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(11, 215, __pyx_L1_error)
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_global_namespaces, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(11, 215, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":211
 * 
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 */
  }

  /* "src/lxml/extensions.pxi":210
 *                     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;
}

/* "src/lxml/extensions.pxi":217
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:             # <<<<<<<<<<<<<<
 *         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) {

  /* "src/lxml/extensions.pxi":218
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                  _xcstr(prefix_utf), NULL)
 * 
 */
  (void)(xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL));

  /* "src/lxml/extensions.pxi":217
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf) noexcept:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), NULL)
 */

  /* function exit code */
}

/* "src/lxml/extensions.pxi":223
 *     # 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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addLocalExtensionFunction", 1);

  /* "src/lxml/extensions.pxi":224
 * 
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":225
 *     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_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_extensions);
    __Pyx_DECREF(__pyx_v_self->_extensions);
    __pyx_v_self->_extensions = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":224
 * 
 *     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
 */
  }

  /* "src/lxml/extensions.pxi":226
 *         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_ERR(11, 226, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_ns_utf);
  __Pyx_GIVEREF(__pyx_v_ns_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ns_utf)) __PYX_ERR(11, 226, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_name_utf);
  __Pyx_GIVEREF(__pyx_v_name_utf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_name_utf)) __PYX_ERR(11, 226, __pyx_L1_error);
  if (unlikely((PyDict_SetItem(__pyx_v_self->_extensions, __pyx_t_2, __pyx_v_function) < 0))) __PYX_ERR(11, 226, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":227
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":223
 *     # 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_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext._addLocalExtensionFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":229
 *         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", 1);

  /* "src/lxml/extensions.pxi":233
 *         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 '%.30s'", "iteritems");
    __PYX_ERR(11, 233, __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_ERR(11, 233, __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_ERR(11, 233, __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;

    /* "src/lxml/extensions.pxi":235
 *         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);

    /* "src/lxml/extensions.pxi":234
 *         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;

    /* "src/lxml/extensions.pxi":236
 *             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);
    if (__pyx_t_8) {

      /* "src/lxml/extensions.pxi":237
 *                 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;

      /* "src/lxml/extensions.pxi":236
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 d = <dict>dict_result
 *             else:
 */
      goto __pyx_L5;
    }

    /* "src/lxml/extensions.pxi":239
 *                 d = <dict>dict_result
 *             else:
 *                 d = {}             # <<<<<<<<<<<<<<
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 */
    /*else*/ {
      __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":240
 *             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_ERR(11, 240, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0))) __PYX_ERR(11, 240, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "src/lxml/extensions.pxi":241
 *                 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 '%.30s'", "iteritems");
      __PYX_ERR(11, 241, __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_ERR(11, 241, __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_ERR(11, 241, __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;

      /* "src/lxml/extensions.pxi":242
 *                 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_ERR(11, 242, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0))) __PYX_ERR(11, 242, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":243
 *             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); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 243, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":229
 *         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;
}

/* "src/lxml/extensions.pxi":245
 *                 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;
  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;
  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)(PyObject *);
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalFunctions", 1);

  /* "src/lxml/extensions.pxi":249
 *         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));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":250
 *         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;

    /* "src/lxml/extensions.pxi":249
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             return # done
 *         last_ns = None
 */
  }

  /* "src/lxml/extensions.pxi":251
 *         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;

  /* "src/lxml/extensions.pxi":252
 *             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);

  /* "src/lxml/extensions.pxi":253
 *         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_3 = 0;
  if (unlikely(__pyx_v_self->_extensions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(11, 253, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_self->_extensions, 1, __pyx_n_s_iteritems, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 253, __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_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(11, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(11, 253, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(11, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 253, __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_ERR(11, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
      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_ERR(11, 253, __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_ERR(11, 253, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "src/lxml/extensions.pxi":254
 *         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_13 = (__pyx_v_ns_utf != __pyx_v_last_ns);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_1 = __pyx_t_13;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_d == ((PyObject*)Py_None));
    __pyx_t_1 = __pyx_t_13;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":255
 *         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);

      /* "src/lxml/extensions.pxi":257
 *                 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_7 = __pyx_v_self->_function_cache;
      __Pyx_INCREF(__pyx_t_7);

      /* "src/lxml/extensions.pxi":256
 *             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_7, __pyx_v_ns_utf);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/extensions.pxi":258
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
 */
      __pyx_t_1 = (__pyx_v_dict_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/extensions.pxi":259
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result             # <<<<<<<<<<<<<<
 *                 else:
 *                     d = {}
 */
        __pyx_t_7 = ((PyObject *)__pyx_v_dict_result);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "src/lxml/extensions.pxi":258
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
 */
        goto __pyx_L11;
      }

      /* "src/lxml/extensions.pxi":261
 *                     d = <dict>dict_result
 *                 else:
 *                     d = {}             # <<<<<<<<<<<<<<
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 */
      /*else*/ {
        __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "src/lxml/extensions.pxi":262
 *                 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_ERR(11, 262, __pyx_L1_error)
        }
        if (unlikely((PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0))) __PYX_ERR(11, 262, __pyx_L1_error)
      }
      __pyx_L11:;

      /* "src/lxml/extensions.pxi":254
 *         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(
 */
    }

    /* "src/lxml/extensions.pxi":263
 *                     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_ERR(11, 263, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0))) __PYX_ERR(11, 263, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":264
 *                     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); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 264, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/extensions.pxi":245
 *                 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_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __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;
}

/* "src/lxml/extensions.pxi":266
 *             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", 1);

  /* "src/lxml/extensions.pxi":268
 *     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 '%.30s'", "iteritems");
    __PYX_ERR(11, 268, __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_ERR(11, 268, __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_ERR(11, 268, __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;

    /* "src/lxml/extensions.pxi":269
 *                                       _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 (likely(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_ERR(11, 269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 269, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 269, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 269, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 269, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 269, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(11, 269, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":270
 *         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); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 270, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":269
 *                                       _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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":266
 *             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;
}

/* "src/lxml/extensions.pxi":272
 *                 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;
  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_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterGlobalFunctions", 1);

  /* "src/lxml/extensions.pxi":274
 *     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 \
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(11, 274, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_function_cache, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 274, __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_ERR(11, 274, __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;

    /* "src/lxml/extensions.pxi":275
 *                                          _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 (likely(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_ERR(11, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 275, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 275, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 275, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 275, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 275, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 275, __pyx_L1_error)
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 275, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(11, 275, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "src/lxml/extensions.pxi":276
 *         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) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L8_bool_binop_done;
      }

      /* "src/lxml/extensions.pxi":277
 *             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_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_ns_utf);
      __Pyx_GIVEREF(__pyx_v_ns_utf);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns_utf)) __PYX_ERR(11, 277, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_name_utf);
      __Pyx_GIVEREF(__pyx_v_name_utf);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_name_utf)) __PYX_ERR(11, 277, __pyx_L1_error);
      if (unlikely(__pyx_v_self->_extensions == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(11, 277, __pyx_L1_error)
      }
      __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_t_5, __pyx_v_self->_extensions, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(11, 277, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __pyx_t_11;
      __pyx_L8_bool_binop_done:;

      /* "src/lxml/extensions.pxi":276
 *         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)
 */
      if (__pyx_t_10) {

        /* "src/lxml/extensions.pxi":278
 *                 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); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 278, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":276
 *         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)
 */
      }

      /* "src/lxml/extensions.pxi":275
 *                                          _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:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":272
 *                 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/extensions.pxi":281
 * 
 *     @cython.final
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *         """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;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_cached_function", 1);

  /* "src/lxml/extensions.pxi":289
 *         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);
  __pyx_t_3 = (__pyx_v_c_ns_uri == NULL);
  if (__pyx_t_3) {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  } else {
    __pyx_t_4 = __Pyx_PyBytes_FromCString(__pyx_v_c_ns_uri); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/extensions.pxi":288
 *         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;

  /* "src/lxml/extensions.pxi":290
 *         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_3 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_3) {

    /* "src/lxml/extensions.pxi":292
 *         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_FromCString(((unsigned char *)__pyx_v_c_name)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "src/lxml/extensions.pxi":291
 *             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;

    /* "src/lxml/extensions.pxi":293
 *             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_3 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/extensions.pxi":294
 *                 <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;

      /* "src/lxml/extensions.pxi":293
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 return <object>dict_result
 *         return None
 */
    }

    /* "src/lxml/extensions.pxi":290
 *         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)
 */
  }

  /* "src/lxml/extensions.pxi":295
 *             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_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":281
 * 
 *     @cython.final
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *         """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_4);
  __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;
}

/* "src/lxml/extensions.pxi":299
 *     # Python access to the XPath context for extension functions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def context_node(self):
 *         cdef xmlNode* c_node
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  xmlNode *__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("__get__", 1);

  /* "src/lxml/extensions.pxi":302
 *     def context_node(self):
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
 */
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":303
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:
 *             raise XPathError, \             # <<<<<<<<<<<<<<
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathError), __pyx_kp_u_XPath_context_is_only_usable_dur, 0, 0);
    __PYX_ERR(11, 303, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":302
 *     def context_node(self):
 *         cdef xmlNode* c_node
 *         if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
 */
  }

  /* "src/lxml/extensions.pxi":305
 *             raise XPathError, \
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
 */
  __pyx_t_2 = __pyx_v_self->_xpathCtxt->node;
  __pyx_v_c_node = __pyx_t_2;

  /* "src/lxml/extensions.pxi":306
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":307
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:
 *             raise XPathError, "no context node"             # <<<<<<<<<<<<<<
 *         if c_node.doc != self._xpathCtxt.doc:
 *             raise XPathError, \
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathError), __pyx_kp_u_no_context_node, 0, 0);
    __PYX_ERR(11, 307, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":306
 *                 "XPath context is only usable during the evaluation"
 *         c_node = self._xpathCtxt.node
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
 */
  }

  /* "src/lxml/extensions.pxi":308
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 */
  __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_self->_xpathCtxt->doc);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":309
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:
 *             raise XPathError, \             # <<<<<<<<<<<<<<
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathError), __pyx_kp_u_document_external_context_nodes, 0, 0);
    __PYX_ERR(11, 309, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":308
 *         if c_node is NULL:
 *             raise XPathError, "no context node"
 *         if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 */
  }

  /* "src/lxml/extensions.pxi":311
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:             # <<<<<<<<<<<<<<
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":312
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:
 *             raise XPathError, "document context is missing"             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathError), __pyx_kp_u_document_context_is_missing, 0, 0);
    __PYX_ERR(11, 312, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":311
 *             raise XPathError, \
 *                 "document-external context nodes are not supported"
 *         if self._doc is None:             # <<<<<<<<<<<<<<
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)
 */
  }

  /* "src/lxml/extensions.pxi":313
 *         if self._doc is None:
 *             raise XPathError, "document context is missing"
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 313, __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;

  /* "src/lxml/extensions.pxi":299
 *     # Python access to the XPath context for extension functions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def context_node(self):
 *         cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/extensions.pxi":315
 *         return _elementFactory(self._doc, c_node)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/extensions.pxi":317
 *     @property
 *     def eval_context(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));
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":318
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
 *             self._eval_context_dict = {}             # <<<<<<<<<<<<<<
 *         return self._eval_context_dict
 * 
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __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_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":317
 *     @property
 *     def eval_context(self):
 *         if self._eval_context_dict is None:             # <<<<<<<<<<<<<<
 *             self._eval_context_dict = {}
 *         return self._eval_context_dict
 */
  }

  /* "src/lxml/extensions.pxi":319
 *         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;

  /* "src/lxml/extensions.pxi":315
 *         return _elementFactory(self._doc, c_node)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def eval_context(self):
 *         if self._eval_context_dict is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/extensions.pxi":324
 * 
 *     @cython.final
 *     cdef _release_temp_refs(self):             # <<<<<<<<<<<<<<
 *         "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", 1);

  /* "src/lxml/extensions.pxi":326
 *     cdef _release_temp_refs(self):
 *         "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 == ((int)-1))) __PYX_ERR(11, 326, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":327
 *         "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 '%.30s'", "clear");
    __PYX_ERR(11, 327, __pyx_L1_error)
  }
  __pyx_t_2 = PySet_Clear(__pyx_v_self->_temp_documents); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(11, 327, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":324
 * 
 *     @cython.final
 *     cdef _release_temp_refs(self):             # <<<<<<<<<<<<<<
 *         "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;
}

/* "src/lxml/extensions.pxi":330
 * 
 *     @cython.final
 *     cdef _hold(self, obj):             # <<<<<<<<<<<<<<
 *         """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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  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("_hold", 1);

  /* "src/lxml/extensions.pxi":338
 *         """
 *         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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":339
 *         cdef _Element element
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)             # <<<<<<<<<<<<<<
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(11, 339, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":340
 *         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 '%.30s'", "add");
      __PYX_ERR(11, 340, __pyx_L1_error)
    }
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_obj)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(11, 340, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":341
 *             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;

    /* "src/lxml/extensions.pxi":338
 *         """
 *         cdef _Element element
 *         if isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 */
  }

  /* "src/lxml/extensions.pxi":342
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
 */
  __pyx_t_5 = _isString(__pyx_v_obj);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (!PySequence_Check(__pyx_v_obj));
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":343
 *             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;

    /* "src/lxml/extensions.pxi":342
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
 */
  }

  /* "src/lxml/extensions.pxi":344
 *         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 (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_3 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 344, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 344, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(11, 344, __pyx_L1_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 344, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 344, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(11, 344, __pyx_L1_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 344, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(11, 344, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "src/lxml/extensions.pxi":345
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":347
 *             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_2 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_o); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(11, 347, __pyx_L1_error)

      /* "src/lxml/extensions.pxi":349
 *                 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 '%.30s'", "add");
        __PYX_ERR(11, 349, __pyx_L1_error)
      }
      __pyx_t_8 = ((PyObject *)((struct LxmlElement *)__pyx_v_o)->_doc);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_4 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_8); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(11, 349, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "src/lxml/extensions.pxi":345
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
 */
    }

    /* "src/lxml/extensions.pxi":344
 *         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
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":330
 * 
 *     @cython.final
 *     cdef _hold(self, obj):             # <<<<<<<<<<<<<<
 *         """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_3);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "src/lxml/extensions.pxi":352
 * 
 *     @cython.final
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         """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;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findDocumentForNode", 1);

  /* "src/lxml/extensions.pxi":359
 *         """
 *         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_2 = 0;
  __pyx_t_5 = __Pyx_set_iterator(__pyx_v_self->_temp_documents, 1, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 359, __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_set_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(11, 359, __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__Document))))) __PYX_ERR(11, 359, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "src/lxml/extensions.pxi":360
 *         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_8 = (((PyObject *)__pyx_v_doc) != Py_None);
    if (__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_doc->_c_doc == __pyx_v_c_node->doc);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "src/lxml/extensions.pxi":361
 *         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;

      /* "src/lxml/extensions.pxi":360
 *         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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":362
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":352
 * 
 *     @cython.final
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         """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_5);
  __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;
}

/* "src/lxml/extensions.pxi":397
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 */

static void __pyx_f_4lxml_5etree__forwardXPathError(void *__pyx_v_c_ctxt, xmlError const *__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;
  xmlErrorLevel __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardXPathError", 0);

  /* "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);
  if (__pyx_t_1) {

    /* "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;

    /* "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:
 */
    goto __pyx_L3;
  }

  /* "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])
 */
  /*else*/ {
    __pyx_v_xpath_code = (__pyx_v_c_error->code - XML_XPATH_EXPRESSION_OK);

    /* "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_ERR(11, 404, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(11, 404, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = (__pyx_v_xpath_code < __pyx_t_4);
    }
    if (__pyx_t_1) {

      /* "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_ERR(11, 405, __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)) __PYX_ERR(11, 405, __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;

      /* "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:
 */
      goto __pyx_L4;
    }

    /* "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
 */
    /*else*/ {
      __pyx_v_error.message = ((char *)"unknown error");
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "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_5 = __pyx_v_c_error->domain;
  __pyx_v_error.domain = __pyx_t_5;

  /* "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_5 = __pyx_v_c_error->code;
  __pyx_v_error.code = __pyx_t_5;

  /* "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_6 = __pyx_v_c_error->level;
  __pyx_v_error.level = __pyx_t_6;

  /* "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_5 = __pyx_v_c_error->line;
  __pyx_v_error.line = __pyx_t_5;

  /* "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
 *     error.node = NULL
 */
  __pyx_t_5 = __pyx_v_c_error->int1;
  __pyx_v_error.int2 = __pyx_t_5;

  /* "src/lxml/extensions.pxi":413
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file             # <<<<<<<<<<<<<<
 *     error.node = NULL
 * 
 */
  __pyx_t_2 = __pyx_v_c_error->file;
  __pyx_v_error.file = __pyx_t_2;

  /* "src/lxml/extensions.pxi":414
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file
 *     error.node = NULL             # <<<<<<<<<<<<<<
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 */
  __pyx_v_error.node = NULL;

  /* "src/lxml/extensions.pxi":416
 *     error.node = NULL
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:
 */
  __pyx_t_5 = __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)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(11, 416, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":397
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) noexcept 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, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/extensions.pxi":418
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
 */

static void __pyx_f_4lxml_5etree__receiveXPathError(void *__pyx_v_c_context, xmlError const *__pyx_v_error) {
  int __pyx_t_1;

  /* "src/lxml/extensions.pxi":421
 *     if not __DEBUG:
 *         return
 *     if c_context is NULL:             # <<<<<<<<<<<<<<
 *         _forwardError(NULL, error)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_context == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":422
 *         return
 *     if c_context is NULL:
 *         _forwardError(NULL, error)             # <<<<<<<<<<<<<<
 *     else:
 *         _forwardXPathError(c_context, error)
 */
    __pyx_f_4lxml_5etree__forwardError(NULL, __pyx_v_error);

    /* "src/lxml/extensions.pxi":421
 *     if not __DEBUG:
 *         return
 *     if c_context is NULL:             # <<<<<<<<<<<<<<
 *         _forwardError(NULL, error)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":424
 *         _forwardError(NULL, error)
 *     else:
 *         _forwardXPathError(c_context, error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_f_4lxml_5etree__forwardXPathError(__pyx_v_c_context, __pyx_v_error);
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":418
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) noexcept nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
 */

  /* function exit code */
}

/* "src/lxml/extensions.pxi":427
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_70Extension(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_69Extension, "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_70Extension = {"Extension", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_70Extension, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_69Extension};
static PyObject *__pyx_pw_4lxml_5etree_70Extension(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_function_mapping = 0;
  PyObject *__pyx_v_ns = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_module,&__pyx_n_s_function_mapping,&__pyx_n_s_ns,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_module)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 427, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_function_mapping);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 427, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 427, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "Extension") < 0)) __PYX_ERR(11, 427, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Extension", 0, 1, 2, __pyx_nargs); __PYX_ERR(11, 427, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_69Extension(__pyx_self, __pyx_v_module, __pyx_v_function_mapping, __pyx_v_ns);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_69Extension(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_9genexpr18__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __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)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Extension", 0);
  __Pyx_INCREF(__pyx_v_function_mapping);

  /* "src/lxml/extensions.pxi":440
 *     functions.
 *     """
 *     cdef dict functions = {}             # <<<<<<<<<<<<<<
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_functions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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)
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_function_mapping); 
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":442
 *     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_3 = 0;
    if (unlikely(__pyx_v_function_mapping == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(11, 442, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_function_mapping, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(11, 442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xpath_name, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "src/lxml/extensions.pxi":443
 *     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_7 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns)) __PYX_ERR(11, 443, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_xpath_name);
      __Pyx_GIVEREF(__pyx_v_xpath_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_xpath_name)) __PYX_ERR(11, 443, __pyx_L1_error);
      if (unlikely((PyDict_SetItem(__pyx_v_functions, __pyx_t_6, __pyx_t_7) < 0))) __PYX_ERR(11, 443, __pyx_L1_error)
      __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;

    /* "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)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":445
 *             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('_') ]
 */
  /*else*/ {
    __pyx_t_2 = (__pyx_v_function_mapping == Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":446
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
 */
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 446, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = PyObject_Dir(__pyx_v_module); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 446, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
          __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6);
          __pyx_t_4 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 446, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 446, __pyx_L9_error)
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_6))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 446, __pyx_L9_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(11, 446, __pyx_L9_error)
              #else
              __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 446, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_7);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 446, __pyx_L9_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(11, 446, __pyx_L9_error)
              #else
              __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 446, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_7);
              #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(11, 446, __pyx_L9_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_7);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_name, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "src/lxml/extensions.pxi":447
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr18__pyx_v_name, __pyx_n_s_startswith); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 447, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = NULL;
          __pyx_t_5 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
              __pyx_t_5 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_n_u__56};
            __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 447, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 447, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = (!__pyx_t_2);
          if (__pyx_t_12) {

            /* "src/lxml/extensions.pxi":446
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
 */
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr18__pyx_v_name))) __PYX_ERR(11, 446, __pyx_L9_error)

            /* "src/lxml/extensions.pxi":447
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
          }

          /* "src/lxml/extensions.pxi":446
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
 */
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_name); __pyx_9genexpr18__pyx_v_name = 0;
        goto __pyx_L14_exit_scope;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_name); __pyx_9genexpr18__pyx_v_name = 0;
        goto __pyx_L1_error;
        __pyx_L14_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_function_mapping, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":445
 *             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('_') ]
 */
    }

    /* "src/lxml/extensions.pxi":448
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
 */
    if (likely(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_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_function_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 448, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 448, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 448, __pyx_L1_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 448, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 448, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __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_ERR(11, 448, __pyx_L1_error)
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 448, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(11, 448, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":449
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     return functions
 * 
 */
      __pyx_t_6 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns)) __PYX_ERR(11, 449, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_function_name);
      __Pyx_GIVEREF(__pyx_v_function_name);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_function_name)) __PYX_ERR(11, 449, __pyx_L1_error);
      if (unlikely((PyDict_SetItem(__pyx_v_functions, __pyx_t_7, __pyx_t_6) < 0))) __PYX_ERR(11, 449, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/extensions.pxi":448
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith('_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":450
 *         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;

  /* "src/lxml/extensions.pxi":427
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
 */

  /* function exit code */
  __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_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_9genexpr18__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_function_mapping);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":459
 * 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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/extensions.pxi":460
 *     cdef dict _compile_map
 *     def __cinit__(self):
 *         self._compile_map = {}             # <<<<<<<<<<<<<<
 * 
 *     cdef _make_string(self, value):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 460, __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;

  /* "src/lxml/extensions.pxi":459
 * 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;
}

/* "src/lxml/extensions.pxi":462
 *         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;
  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("_make_string", 1);

  /* "src/lxml/extensions.pxi":463
 * 
 *     cdef _make_string(self, value):
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif isinstance(value, list):
 */
  __pyx_t_1 = _isString(__pyx_v_value);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":464
 *     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;

    /* "src/lxml/extensions.pxi":463
 * 
 *     cdef _make_string(self, value):
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif isinstance(value, list):
 */
  }

  /* "src/lxml/extensions.pxi":465
 *         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); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":467
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return ''
 *             firstnode = value[0]
 */
    __pyx_t_1 = (PyList_GET_SIZE(__pyx_v_value) == 0);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":468
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return ''             # <<<<<<<<<<<<<<
 *             firstnode = value[0]
 *             if _isString(firstnode):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u__12);
      __pyx_r = __pyx_kp_u__12;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":467
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return ''
 *             firstnode = value[0]
 */
    }

    /* "src/lxml/extensions.pxi":469
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return ''
 *             firstnode = value[0]             # <<<<<<<<<<<<<<
 *             if _isString(firstnode):
 *                 return firstnode
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_firstnode = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":470
 *                 return ''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 */
    __pyx_t_1 = _isString(__pyx_v_firstnode);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":471
 *             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;

      /* "src/lxml/extensions.pxi":470
 *                 return ''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 */
    }

    /* "src/lxml/extensions.pxi":472
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_firstnode, __pyx_ptype_4lxml_5etree__Element); 
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":473
 *                 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);

      /* "src/lxml/extensions.pxi":474
 *             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);
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/extensions.pxi":475
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 try:
 *                     return funicode(c_text)
 */
        PyErr_NoMemory(); __PYX_ERR(11, 475, __pyx_L1_error)

        /* "src/lxml/extensions.pxi":474
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 try:
 */
      }

      /* "src/lxml/extensions.pxi":476
 *                 if c_text is NULL:
 *                     raise MemoryError()
 *                 try:             # <<<<<<<<<<<<<<
 *                     return funicode(c_text)
 *                 finally:
 */
      /*try:*/ {

        /* "src/lxml/extensions.pxi":477
 *                     raise MemoryError()
 *                 try:
 *                     return funicode(c_text)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(c_text)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 477, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L7_return;
      }

      /* "src/lxml/extensions.pxi":479
 *                     return funicode(c_text)
 *                 finally:
 *                     tree.xmlFree(c_text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return unicode(firstnode)
 */
      /*finally:*/ {
        __pyx_L8_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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_text);
          }
          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_L7_return: {
          __pyx_t_11 = __pyx_r;
          __pyx_r = 0;
          xmlFree(__pyx_v_c_text);
          __pyx_r = __pyx_t_11;
          __pyx_t_11 = 0;
          goto __pyx_L0;
        }
      }

      /* "src/lxml/extensions.pxi":472
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 */
    }

    /* "src/lxml/extensions.pxi":481
 *                     tree.xmlFree(c_text)
 *             else:
 *                 return unicode(firstnode)             # <<<<<<<<<<<<<<
 *         else:
 *             return unicode(value)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_firstnode); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "src/lxml/extensions.pxi":465
 *         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:
 */
  }

  /* "src/lxml/extensions.pxi":483
 *                 return unicode(firstnode)
 *         else:
 *             return unicode(value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _compile(self, rexp, ignore_case):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "src/lxml/extensions.pxi":462
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         if _isString(value):
 *             return value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/extensions.pxi":485
 *             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_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compile", 0);
  __Pyx_INCREF(__pyx_v_rexp);

  /* "src/lxml/extensions.pxi":487
 *     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_ERR(11, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rexp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":488
 *         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_ERR(11, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp)) __PYX_ERR(11, 488, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ignore_case);
  __Pyx_GIVEREF(__pyx_v_ignore_case);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ignore_case)) __PYX_ERR(11, 488, __pyx_L1_error);
  __pyx_v_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":489
 *         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;

  /* "src/lxml/extensions.pxi":490
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":491
 *         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;

    /* "src/lxml/extensions.pxi":490
 *         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
 */
  }

  /* "src/lxml/extensions.pxi":492
 *         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_ERR(11, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":493
 *             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_ERR(11, 493, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":494
 *         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_ERR(11, 494, __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_ERR(11, 494, __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;

    /* "src/lxml/extensions.pxi":493
 *             return <object>c_result
 *         py_flags = re.UNICODE
 *         if ignore_case:             # <<<<<<<<<<<<<<
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 */
  }

  /* "src/lxml/extensions.pxi":495
 *         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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_rexp, __pyx_v_py_flags};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_v_rexp_compiled = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":496
 *             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_ERR(11, 496, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->_compile_map, __pyx_v_key, __pyx_v_rexp_compiled) < 0))) __PYX_ERR(11, 496, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":497
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled             # <<<<<<<<<<<<<<
 * 
 *     def test(self, ctxt, s, rexp, flags=''):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rexp_compiled);
  __pyx_r = __pyx_v_rexp_compiled;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":485
 *             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;
}

/* "src/lxml/extensions.pxi":499
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_3test = {"test", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctxt,&__pyx_n_s_s_4,&__pyx_n_s_rexp,&__pyx_n_s_flags,0};
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_u__12));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctxt)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 499, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s_4)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 499, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 1); __PYX_ERR(11, 499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 499, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 2); __PYX_ERR(11, 499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 499, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "test") < 0)) __PYX_ERR(11, 499, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, __pyx_nargs); __PYX_ERR(11, 499, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/extensions.pxi":500
 * 
 *     def test(self, ctxt, s, rexp, flags=''):
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, '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_ERR(11, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":501
 *     def test(self, ctxt, s, rexp, flags=''):
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, '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_ERR(11, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":502
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         if rexpc.search(s) is None:
 *             return False
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 502, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 502, __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_ERR(11, 502, __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;

  /* "src/lxml/extensions.pxi":503
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_s};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_t_2 = (__pyx_t_3 == Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":504
 *         rexpc = self._compile(rexp, '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;

    /* "src/lxml/extensions.pxi":503
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  }

  /* "src/lxml/extensions.pxi":506
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def match(self, ctxt, s, rexp, flags=''):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "src/lxml/extensions.pxi":499
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         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;
}

/* "src/lxml/extensions.pxi":508
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_5match = {"match", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctxt,&__pyx_n_s_s_4,&__pyx_n_s_rexp,&__pyx_n_s_flags,0};
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_u__12));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctxt)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 508, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s_4)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 508, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 1); __PYX_ERR(11, 508, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 508, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 2); __PYX_ERR(11, 508, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 508, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "match") < 0)) __PYX_ERR(11, 508, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, __pyx_nargs); __PYX_ERR(11, 508, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  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);

  /* "src/lxml/extensions.pxi":510
 *     def match(self, ctxt, s, rexp, flags=''):
 *         cdef list result_list
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, '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_ERR(11, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":511
 *         cdef list result_list
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if '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_ERR(11, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":512
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 512, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 512, __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_ERR(11, 512, __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;

  /* "src/lxml/extensions.pxi":513
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 513, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":514
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:
 *             results = rexpc.findall(s)             # <<<<<<<<<<<<<<
 *             if not results:
 *                 return ()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_findall); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_s};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_v_results = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":515
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_results); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 515, __pyx_L1_error)
    __pyx_t_6 = (!__pyx_t_2);
    if (__pyx_t_6) {

      /* "src/lxml/extensions.pxi":516
 *             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;

      /* "src/lxml/extensions.pxi":515
 *         if 'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
 */
    }

    /* "src/lxml/extensions.pxi":513
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         if 'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":518
 *                 return ()
 *         else:
 *             result = rexpc.search(s)             # <<<<<<<<<<<<<<
 *             if not result:
 *                 return ()
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_s};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 518, __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;

    /* "src/lxml/extensions.pxi":519
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(11, 519, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_6);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":520
 *             result = rexpc.search(s)
 *             if not result:
 *                 return ()             # <<<<<<<<<<<<<<
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_r = __pyx_empty_tuple;
      goto __pyx_L0;

      /* "src/lxml/extensions.pxi":519
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
 */
    }

    /* "src/lxml/extensions.pxi":521
 *             if not result:
 *                 return ()
 *             results = [ result.group() ]             # <<<<<<<<<<<<<<
 *             results.extend( result.groups('') )
 *         result_list = []
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(11, 521, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_v_results = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":522
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element('matches')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_results, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_groups); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u__12};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 522, __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;
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":523
 *             results = [ result.group() ]
 *             results.extend( result.groups('') )
 *         result_list = []             # <<<<<<<<<<<<<<
 *         root = Element('matches')
 *         for s_match in results:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":524
 *             results.extend( result.groups('') )
 *         result_list = []
 *         root = Element('matches')             # <<<<<<<<<<<<<<
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Element_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_matches};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":525
 *         result_list = []
 *         root = Element('matches')
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
 */
  if (likely(PyList_CheckExact(__pyx_v_results)) || PyTuple_CheckExact(__pyx_v_results)) {
    __pyx_t_1 = __pyx_v_results; __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_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 525, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 525, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(11, 525, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 525, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(11, 525, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(11, 525, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_s_match, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":526
 *         root = Element('matches')
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')
 */
    __pyx_t_2 = PyTuple_CheckExact(__pyx_v_s_match);
    if (__pyx_t_2) {

      /* "src/lxml/extensions.pxi":527
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)             # <<<<<<<<<<<<<<
 *             elem = SubElement(root, 'match')
 *             elem.text = s_match
 */
      __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__12, __pyx_v_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_s_match, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "src/lxml/extensions.pxi":526
 *         root = Element('matches')
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')
 */
    }

    /* "src/lxml/extensions.pxi":528
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, 'match')             # <<<<<<<<<<<<<<
 *             elem.text = s_match
 *             result_list.append(elem)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_root, __pyx_n_u_match};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":529
 *                 s_match = ''.join(s_match)
 *             elem = SubElement(root, '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_ERR(11, 529, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":530
 *             elem = SubElement(root, 'match')
 *             elem.text = s_match
 *             result_list.append(elem)             # <<<<<<<<<<<<<<
 *         return result_list
 * 
 */
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_v_elem); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(11, 530, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":525
 *         result_list = []
 *         root = Element('matches')
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = ''.join(s_match)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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;

  /* "src/lxml/extensions.pxi":508
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         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_4);
  __Pyx_XDECREF(__pyx_t_7);
  __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_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;
}

/* "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_12_ExsltRegExp_7replace = {"replace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctxt)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 533, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s_4)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 533, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 1); __PYX_ERR(11, 533, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 533, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 2); __PYX_ERR(11, 533, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 533, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 3); __PYX_ERR(11, 533, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_replacement)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 533, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 4); __PYX_ERR(11, 533, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "replace") < 0)) __PYX_ERR(11, 533, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, __pyx_nargs); __PYX_ERR(11, 533, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_v_count = 0;
  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("replace", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __Pyx_INCREF(__pyx_v_replacement);

  /* "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_ERR(11, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_replacement, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "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, '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_ERR(11, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":536
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":537
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)             # <<<<<<<<<<<<<<
 *         count: object = 0 if 'g' in flags else 1
 *         return rexpc.sub(replacement, s, count)
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 537, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 537, __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_ERR(11, 537, __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;

  /* "src/lxml/extensions.pxi":538
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1             # <<<<<<<<<<<<<<
 *         return rexpc.sub(replacement, s, count)
 * 
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(11, 538, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
  } else {
    __Pyx_INCREF(__pyx_int_1);
    __pyx_t_3 = __pyx_int_1;
  }
  __pyx_v_count = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/extensions.pxi":539
 *         rexpc = self._compile(rexp, 'i' in flags)
 *         count: object = 0 if 'g' in flags else 1
 *         return rexpc.sub(replacement, s, count)             # <<<<<<<<<<<<<<
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_sub); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_replacement, __pyx_v_s, __pyx_v_count};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 3+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 539, __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;

  /* "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_4);
  __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_count);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XDECREF(__pyx_v_replacement);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":541
 *         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", 1);

  /* "src/lxml/extensions.pxi":542
 * 
 *     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;

  /* "src/lxml/extensions.pxi":543
 *     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_ERR(11, 543, __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 == ((int)-1))) __PYX_ERR(11, 543, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":544
 *         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_ERR(11, 544, __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 == ((int)-1))) __PYX_ERR(11, 544, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":545
 *         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_ERR(11, 545, __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 == ((int)-1))) __PYX_ERR(11, 545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":541
 *         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;
}

/* "src/lxml/extensions.pxi":551
 * # 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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  const char *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_wrapXPathObject", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "src/lxml/extensions.pxi":554
 *                                             _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);

  /* "src/lxml/extensions.pxi":557
 *     cdef xmlNode* c_node
 * 
 *     if isinstance(obj, unicode):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_obj); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":558
 * 
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)             # <<<<<<<<<<<<<<
 *     if isinstance(obj, bytes):
 *         # libxml2 copies the string value
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":557
 *     cdef xmlNode* c_node
 * 
 *     if isinstance(obj, unicode):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):
 */
  }

  /* "src/lxml/extensions.pxi":559
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_obj); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":561
 *     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;

    /* "src/lxml/extensions.pxi":559
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 */
  }

  /* "src/lxml/extensions.pxi":562
 *         # 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_2 = ((PyObject*)&PyBool_Type);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(11, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":563
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)             # <<<<<<<<<<<<<<
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 */
    __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_obj); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(11, 563, __pyx_L1_error)
    __pyx_r = xmlXPathNewBoolean(__pyx_t_3);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":562
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 */
  }

  /* "src/lxml/extensions.pxi":564
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 */
  __pyx_t_1 = PyNumber_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":565
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)             # <<<<<<<<<<<<<<
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(11, 565, __pyx_L1_error)
    __pyx_r = xmlXPathNewFloat(__pyx_t_4);
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":564
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 */
  }

  /* "src/lxml/extensions.pxi":566
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 */
  __pyx_t_1 = (__pyx_v_obj == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":567
 *         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);

    /* "src/lxml/extensions.pxi":566
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 */
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":568
 *     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, __pyx_ptype_4lxml_5etree__Element); 
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":569
 *         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);

    /* "src/lxml/extensions.pxi":568
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 */
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":570
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 */
  __pyx_t_1 = PySequence_Check(__pyx_v_obj);
  if (likely(__pyx_t_1)) {

    /* "src/lxml/extensions.pxi":571
 *         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);

    /* "src/lxml/extensions.pxi":572
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/extensions.pxi":573
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 */
        if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
          __pyx_t_2 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_2);
          __pyx_t_8 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 573, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 573, __pyx_L8_error)
        }
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_2))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 573, __pyx_L8_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(11, 573, __pyx_L8_error)
              #else
              __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 573, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(11, 573, __pyx_L8_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(11, 573, __pyx_L8_error)
              #else
              __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 573, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              #endif
            }
          } else {
            __pyx_t_10 = __pyx_t_9(__pyx_t_2);
            if (unlikely(!__pyx_t_10)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(11, 573, __pyx_L8_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_10);
          }
          __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
          __pyx_t_10 = 0;

          /* "src/lxml/extensions.pxi":574
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
 */
          __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_4lxml_5etree__Element); 
          if (__pyx_t_1) {

            /* "src/lxml/extensions.pxi":575
 *             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);
            if (__pyx_t_1) {

              /* "src/lxml/extensions.pxi":576
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 */
              __pyx_t_10 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 576, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

              /* "src/lxml/extensions.pxi":575
 *             for value in obj:
 *                 if isinstance(value, _Element):
 *                     if context is not None:             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 */
            }

            /* "src/lxml/extensions.pxi":577
 *                     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);

            /* "src/lxml/extensions.pxi":574
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
 */
            goto __pyx_L16;
          }

          /* "src/lxml/extensions.pxi":579
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"
 */
          /*else*/ {
            __pyx_t_11 = (((PyObject *)__pyx_v_context) == Py_None);
            if (!__pyx_t_11) {
            } else {
              __pyx_t_1 = __pyx_t_11;
              goto __pyx_L19_bool_binop_done;
            }
            __pyx_t_11 = (((PyObject *)__pyx_v_doc) == Py_None);
            __pyx_t_1 = __pyx_t_11;
            __pyx_L19_bool_binop_done:;
            if (unlikely(__pyx_t_1)) {

              /* "src/lxml/extensions.pxi":581
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"             # <<<<<<<<<<<<<<
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):
 */
              __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 581, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Non_Element_values_not_supported, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 581, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_12, 0, 0);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __PYX_ERR(11, 580, __pyx_L8_error)

              /* "src/lxml/extensions.pxi":579
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               f"Non-Element values not supported at this point - got {value!r}"
 */
            }

            /* "src/lxml/extensions.pxi":583
 *                               f"Non-Element values not supported at this point - got {value!r}"
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 */
            __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
            if (__pyx_t_1) {

              /* "src/lxml/extensions.pxi":584
 *                     # 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_12 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 584, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_12);
              __pyx_t_12 = 0;

              /* "src/lxml/extensions.pxi":583
 *                               f"Non-Element values not supported at this point - got {value!r}"
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 */
            }

            /* "src/lxml/extensions.pxi":585
 *                     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_1 = PyBytes_Check(__pyx_v_value); 
            if (likely(__pyx_t_1)) {

              /* "src/lxml/extensions.pxi":586
 *                         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_1 = (((PyObject *)__pyx_v_fake_node) == Py_None);
              if (__pyx_t_1) {

                /* "src/lxml/extensions.pxi":587
 *                     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_12 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_kp_u_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_12)) __PYX_ERR(11, 587, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF_SET(__pyx_v_fake_node, ((struct LxmlElement *)__pyx_t_12));
                __pyx_t_12 = 0;

                /* "src/lxml/extensions.pxi":589
 *                             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_12 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, ((PyObject *)__pyx_v_fake_node)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 589, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

                /* "src/lxml/extensions.pxi":586
 *                         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)
 */
                goto __pyx_L23;
              }

              /* "src/lxml/extensions.pxi":592
 *                         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()
 */
              /*else*/ {
                __pyx_v_c_node = xmlNewDocComment(__pyx_v_doc->_c_doc, ((unsigned char *)((unsigned char *)((char const *)""))));

                /* "src/lxml/extensions.pxi":593
 *                             # 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_1 = (__pyx_v_c_node == NULL);
                if (unlikely(__pyx_t_1)) {

                  /* "src/lxml/extensions.pxi":594
 *                             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_ERR(11, 594, __pyx_L8_error)

                  /* "src/lxml/extensions.pxi":593
 *                             # 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)
 */
                }

                /* "src/lxml/extensions.pxi":595
 *                             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))
 */
                (void)(xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node));
              }
              __pyx_L23:;

              /* "src/lxml/extensions.pxi":596
 *                                 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_12 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 596, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

              /* "src/lxml/extensions.pxi":597
 *                             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));

              /* "src/lxml/extensions.pxi":598
 *                         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_1 = (__pyx_v_c_node == NULL);
              if (unlikely(__pyx_t_1)) {

                /* "src/lxml/extensions.pxi":599
 *                         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_ERR(11, 599, __pyx_L8_error)

                /* "src/lxml/extensions.pxi":598
 *                         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)
 */
              }

              /* "src/lxml/extensions.pxi":600
 *                         if c_node is NULL:
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 */
              (void)(xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node));

              /* "src/lxml/extensions.pxi":601
 *                             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);

              /* "src/lxml/extensions.pxi":585
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):             # <<<<<<<<<<<<<<
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 */
              goto __pyx_L22;
            }

            /* "src/lxml/extensions.pxi":603
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:
 */
            /*else*/ {

              /* "src/lxml/extensions.pxi":604
 *                     else:
 *                         raise XPathResultError, \
 *                               f"This is not a supported node-set result: {value!r}"             # <<<<<<<<<<<<<<
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 */
              __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 604, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_This_is_not_a_supported_node_set, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 604, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_10, 0, 0);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __PYX_ERR(11, 603, __pyx_L8_error)
            }
            __pyx_L22:;
          }
          __pyx_L16:;

          /* "src/lxml/extensions.pxi":573
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 */
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/extensions.pxi":572
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
 */
      }
      __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_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/extensions.pxi":605
 *                         raise XPathResultError, \
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._wrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_12) < 0) __PYX_ERR(11, 605, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);

        /* "src/lxml/extensions.pxi":606
 *                               f"This is not a supported node-set result: {value!r}"
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)             # <<<<<<<<<<<<<<
 *             raise
 *     else:
 */
        xmlXPathFreeNodeSet(__pyx_v_resultSet);

        /* "src/lxml/extensions.pxi":607
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"
 */
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_10, __pyx_t_12);
        __pyx_t_2 = 0; __pyx_t_10 = 0; __pyx_t_12 = 0; 
        __PYX_ERR(11, 607, __pyx_L10_except_error)
      }

      /* "src/lxml/extensions.pxi":572
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
 */
      __pyx_L10_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_L13_try_end:;
    }

    /* "src/lxml/extensions.pxi":570
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 */
    goto __pyx_L7;
  }

  /* "src/lxml/extensions.pxi":609
 *             raise
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"             # <<<<<<<<<<<<<<
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 */
  /*else*/ {
    __pyx_t_13 = _fqtypename(__pyx_v_obj);
    __pyx_t_8 = __Pyx_ssize_strlen(__pyx_t_13); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(11, 609, __pyx_L1_error)
    __pyx_t_12 = __Pyx_decode_c_string(__pyx_t_13, 0, __pyx_t_8, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_return_type, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_10, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(11, 609, __pyx_L1_error)
  }
  __pyx_L7:;

  /* "src/lxml/extensions.pxi":610
 *     else:
 *         raise XPathResultError, f"Unknown return type: {python._fqtypename(obj).decode('utf8')}"
 *     return xpath.xmlXPathWrapNodeSet(resultSet)             # <<<<<<<<<<<<<<
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 */
  __pyx_r = xmlXPathWrapNodeSet(__pyx_v_resultSet);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":551
 * # 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_2);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __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;
}

/* "src/lxml/extensions.pxi":612
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unwrapXPathObject", 1);

  /* "src/lxml/extensions.pxi":614
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 */
  switch (__pyx_v_xpathObj->type) {
    case XPATH_UNDEFINED:

    /* "src/lxml/extensions.pxi":615
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, "Undefined xpath result"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_kp_u_Undefined_xpath_result, 0, 0);
    __PYX_ERR(11, 615, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":614
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 */
    break;
    case XPATH_NODESET:

    /* "src/lxml/extensions.pxi":617
 *         raise XPathResultError, "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_ERR(11, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":616
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, "Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 */
    break;
    case XPATH_BOOLEAN:

    /* "src/lxml/extensions.pxi":619
 *         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_ERR(11, 619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":618
 *     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:
 */
    break;
    case XPATH_NUMBER:

    /* "src/lxml/extensions.pxi":621
 *         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_ERR(11, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":620
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:             # <<<<<<<<<<<<<<
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 */
    break;
    case XPATH_STRING:

    /* "src/lxml/extensions.pxi":623
 *         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_ERR(11, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_stringval = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/extensions.pxi":624
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
 */
    if (__pyx_v_context->_build_smart_strings) {

      /* "src/lxml/extensions.pxi":625
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *                 stringval, None, None, False)
 *         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_ERR(11, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_stringval, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/extensions.pxi":624
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
 */
    }

    /* "src/lxml/extensions.pxi":627
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, False)
 *         return stringval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_stringval);
    __pyx_r = __pyx_v_stringval;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":622
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:             # <<<<<<<<<<<<<<
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 */
    break;
    case XPATH_POINT:

    /* "src/lxml/extensions.pxi":629
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_POINT, 0, 0);
    __PYX_ERR(11, 629, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":628
 *                 stringval, None, None, False)
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 */
    break;
    case XPATH_RANGE:

    /* "src/lxml/extensions.pxi":631
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_RANGE, 0, 0);
    __PYX_ERR(11, 631, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":630
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, "XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 */
    break;
    case XPATH_LOCATIONSET:

    /* "src/lxml/extensions.pxi":633
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "XPATH_USERS"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_LOCATIONSET, 0, 0);
    __PYX_ERR(11, 633, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":632
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, "XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 */
    break;
    case XPATH_USERS:

    /* "src/lxml/extensions.pxi":635
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "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_ERR(11, 635, __pyx_L1_error)

    /* "src/lxml/extensions.pxi":634
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, "XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 */
    break;
    case XPATH_XSLT_TREE:

    /* "src/lxml/extensions.pxi":637
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, f"Unknown xpath result {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_ERR(11, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "src/lxml/extensions.pxi":636
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, "XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 */
    break;
    default:

    /* "src/lxml/extensions.pxi":639
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 *         raise XPathResultError, f"Unknown xpath result {xpathObj.type}"             # <<<<<<<<<<<<<<
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,
 */
    __pyx_t_1 = __Pyx_PyUnicode_From_xmlXPathObjectType(__pyx_v_xpathObj->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_xpath_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathResultError), __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(11, 639, __pyx_L1_error)
    break;
  }

  /* "src/lxml/extensions.pxi":612
 *     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_2);
  __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;
}

/* "src/lxml/extensions.pxi":641
 *         raise XPathResultError, f"Unknown xpath result {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_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createNodeSetResult", 1);

  /* "src/lxml/extensions.pxi":646
 *     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_ERR(11, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":647
 *     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);
  if (__pyx_t_2) {

    /* "src/lxml/extensions.pxi":648
 *     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;

    /* "src/lxml/extensions.pxi":647
 *     cdef list result
 *     result = []
 *     if xpathObj.nodesetval is NULL:             # <<<<<<<<<<<<<<
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 */
  }

  /* "src/lxml/extensions.pxi":649
 *     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;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "src/lxml/extensions.pxi":650
 *         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]);

    /* "src/lxml/extensions.pxi":651
 *     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_ERR(11, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "src/lxml/extensions.pxi":653
 *         _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;

  /* "src/lxml/extensions.pxi":641
 *         raise XPathResultError, f"Unknown xpath result {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;
}

/* "src/lxml/extensions.pxi":655
 *     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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlNode *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unpackNodeSetEntry", 1);

  /* "src/lxml/extensions.pxi":658
 *                          _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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":659
 *     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_2 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":664
 *             #        -> 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);

      /* "src/lxml/extensions.pxi":659
 *     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
 */
    }

    /* "src/lxml/extensions.pxi":666
 *             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 '%.30s'", "append");
      __PYX_ERR(11, 666, __pyx_L1_error)
    }

    /* "src/lxml/extensions.pxi":667
 *             # 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_3 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":666
 *             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_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(11, 666, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":658
 *                          _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?
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":668
 *         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:
    case XML_CDATA_SECTION_NODE:

    /* "src/lxml/extensions.pxi":669
 *             _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_ATTRIBUTE_NODE:

    /* "src/lxml/extensions.pxi":668
 *         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_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":671
 *              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 '%.30s'", "append");
      __PYX_ERR(11, 671, __pyx_L1_error)
    }

    /* "src/lxml/extensions.pxi":672
 *              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_3 = __pyx_f_4lxml_5etree__buildElementStringResult(__pyx_v_doc, __pyx_v_c_node, __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":671
 *              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_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(11, 671, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":668
 *         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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":673
 *         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_1 = (__pyx_v_c_node->type == XML_NAMESPACE_DECL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":674
 *             _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 '%.30s'", "append");
      __PYX_ERR(11, 674, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/extensions.pxi":675
 *     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_5 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->href); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "src/lxml/extensions.pxi":674
 *             _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_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(11, 674, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(11, 674, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(11, 674, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/extensions.pxi":673
 *         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)) )
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":676
 *         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:
    case XML_HTML_DOCUMENT_NODE:

    /* "src/lxml/extensions.pxi":677
 *                          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:
 */
    __pyx_t_1 = 1;

    /* "src/lxml/extensions.pxi":676
 *         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
 */
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":679
 *             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:
 */
    if (__pyx_v_is_fragment) {

      /* "src/lxml/extensions.pxi":680
 *         # 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_7 = __pyx_v_c_node->children;
      __pyx_v_c_child = __pyx_t_7;

      /* "src/lxml/extensions.pxi":681
 *         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_1 = (__pyx_v_c_child != NULL);
        if (!__pyx_t_1) break;

        /* "src/lxml/extensions.pxi":682
 *             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_6 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_results, __pyx_v_c_child, __pyx_v_doc, __pyx_v_context, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "src/lxml/extensions.pxi":683
 *             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_7 = __pyx_v_c_child->next;
        __pyx_v_c_child = __pyx_t_7;
      }

      /* "src/lxml/extensions.pxi":679
 *             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:
 */
    }

    /* "src/lxml/extensions.pxi":676
 *         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
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":684
 *                 _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:
    case XML_XINCLUDE_END:

    /* "src/lxml/extensions.pxi":685
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
 */
    __pyx_t_1 = 1;

    /* "src/lxml/extensions.pxi":684
 *                 _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
 */
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (likely(__pyx_t_1)) {
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":688
 *         pass
 *     else:
 *         raise NotImplementedError, \             # <<<<<<<<<<<<<<
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
 */
  /*else*/ {

    /* "src/lxml/extensions.pxi":689
 *     else:
 *         raise NotImplementedError, \
 *             f"Not yet implemented result node type: {c_node.type}"             # <<<<<<<<<<<<<<
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:
 */
    __pyx_t_6 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(11, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Not_yet_implemented_result_node, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(11, 688, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/extensions.pxi":655
 *     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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/extensions.pxi":691
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:             # <<<<<<<<<<<<<<
 *     """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) {
  int __pyx_t_1;

  /* "src/lxml/extensions.pxi":695
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":696
 *     """
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)             # <<<<<<<<<<<<<<
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)
 */
    xmlXPathFreeNodeSet(__pyx_v_xpathObj->nodesetval);

    /* "src/lxml/extensions.pxi":697
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL             # <<<<<<<<<<<<<<
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 */
    __pyx_v_xpathObj->nodesetval = NULL;

    /* "src/lxml/extensions.pxi":695
 *     Python dealloc will do that for us.
 *     """
 *     if xpathObj.nodesetval is not NULL:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 */
  }

  /* "src/lxml/extensions.pxi":698
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,
 */
  xmlXPathFreeObject(__pyx_v_xpathObj);

  /* "src/lxml/extensions.pxi":691
 *             f"Not yet implemented result node type: {c_node.type}"
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj) noexcept:             # <<<<<<<<<<<<<<
 *     """Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
 */

  /* function exit code */
}

/* "src/lxml/extensions.pxi":700
 *     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 LxmlDocument *__pyx_v_node_doc = NULL;
  struct LxmlElement *__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("_instantiateElementFromXPath", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "src/lxml/extensions.pxi":703
 *                                            _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_2 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":707
 *         # either => may still be from a known document, e.g. one
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)             # <<<<<<<<<<<<<<
 *         if node_doc is None:
 *             # not from a known document at all! => can only make a
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(__pyx_v_context, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_node_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/extensions.pxi":708
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)
 *         if node_doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_node_doc) == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/extensions.pxi":711
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *         else:
 *             doc = node_doc
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);

      /* "src/lxml/extensions.pxi":708
 *         # created by an extension function
 *         node_doc = context._findDocumentForNode(c_node)
 *         if node_doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 */
      goto __pyx_L6;
    }

    /* "src/lxml/extensions.pxi":713
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *         else:
 *             doc = node_doc             # <<<<<<<<<<<<<<
 *     return _fakeDocElementFactory(doc, c_node)
 * 
 */
    /*else*/ {
      __Pyx_INCREF((PyObject *)__pyx_v_node_doc);
      __Pyx_DECREF_SET(__pyx_v_doc, __pyx_v_node_doc);
    }
    __pyx_L6:;

    /* "src/lxml/extensions.pxi":703
 *                                            _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
 */
  }

  /* "src/lxml/extensions.pxi":714
 *         else:
 *             doc = node_doc
 *     return _fakeDocElementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":700
 *     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_3);
  __Pyx_AddTraceback("lxml.etree._instantiateElementFromXPath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/extensions.pxi":725
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_21_ElementUnicodeResult_1getparent = {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("getparent", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getparent", 0))) return NULL;
  __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", 1);

  /* "src/lxml/extensions.pxi":726
 * 
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_parent);
  __pyx_r = ((PyObject *)__pyx_v_self->_parent);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":725
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

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

/* "src/lxml/extensions.pxi":728
 *         return self._parent
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/extensions.pxi":730
 *     @property
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_parent) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  if (!__pyx_v_self->is_tail) {
  } else {
    __pyx_t_2 = __pyx_v_self->is_tail;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_self->attrname != Py_None);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  __pyx_t_4 = (!__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":728
 *         return self._parent
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_text(self):
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/extensions.pxi":732
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_attribute(self):
 *         return self.attrname is not None
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  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__", 1);

  /* "src/lxml/extensions.pxi":734
 *     @property
 *     def is_attribute(self):
 *         return self.attrname is not None             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_self->attrname != Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":732
 *         return self._parent is not None and not (self.is_tail or self.attrname is not None)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_attribute(self):
 *         return self.attrname is not None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/extensions.pxi":722
 * cdef class _ElementUnicodeResult(unicode):
 *     cdef _Element _parent
 *     cdef readonly object attrname             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_tail
 * 
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __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;
}

/* "src/lxml/extensions.pxi":723
 *     cdef _Element _parent
 *     cdef readonly object attrname
 *     cdef readonly bint is_tail             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 723, __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;
}

/* "src/lxml/extensions.pxi":736
 *         return self.attrname is not None
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
 */

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_result = 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("_elementStringResultFactory", 1);

  /* "src/lxml/extensions.pxi":738
 * cdef object _elementStringResultFactory(string_value, _Element parent,
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)             # <<<<<<<<<<<<<<
 *     result._parent = parent
 *     result.is_tail = is_tail
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__ElementUnicodeResult), __pyx_v_string_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/extensions.pxi":739
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
 *     result._parent = parent             # <<<<<<<<<<<<<<
 *     result.is_tail = is_tail
 *     result.attrname = attrname
 */
  __Pyx_INCREF((PyObject *)__pyx_v_parent);
  __Pyx_GIVEREF((PyObject *)__pyx_v_parent);
  __Pyx_GOTREF((PyObject *)__pyx_v_result->_parent);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_parent);
  __pyx_v_result->_parent = __pyx_v_parent;

  /* "src/lxml/extensions.pxi":740
 *     result = _ElementUnicodeResult(string_value)
 *     result._parent = parent
 *     result.is_tail = is_tail             # <<<<<<<<<<<<<<
 *     result.attrname = attrname
 *     return result
 */
  __pyx_v_result->is_tail = __pyx_v_is_tail;

  /* "src/lxml/extensions.pxi":741
 *     result._parent = parent
 *     result.is_tail = is_tail
 *     result.attrname = attrname             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(__pyx_v_attrname);
  __Pyx_GIVEREF(__pyx_v_attrname);
  __Pyx_GOTREF(__pyx_v_result->attrname);
  __Pyx_DECREF(__pyx_v_result->attrname);
  __pyx_v_result->attrname = __pyx_v_attrname;

  /* "src/lxml/extensions.pxi":742
 *     result.is_tail = is_tail
 *     result.attrname = attrname
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":736
 *         return self.attrname is not None
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     result = _ElementUnicodeResult(string_value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._elementStringResultFactory", __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;
}

/* "src/lxml/extensions.pxi":744
 *     return result
 * 
 * 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildElementStringResult", 1);

  /* "src/lxml/extensions.pxi":746
 * 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);

  /* "src/lxml/extensions.pxi":747
 *                                       _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;

  /* "src/lxml/extensions.pxi":751
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":752
 * 
 *     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_ERR(11, 752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_attrname, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":753
 *     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;

    /* "src/lxml/extensions.pxi":754
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)             # <<<<<<<<<<<<<<
 *         try:
 *             value = funicode(s)
 */
    __pyx_v_s = xmlNodeGetContent(__pyx_v_c_node);

    /* "src/lxml/extensions.pxi":755
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:             # <<<<<<<<<<<<<<
 *             value = funicode(s)
 *         finally:
 */
    /*try:*/ {

      /* "src/lxml/extensions.pxi":756
 *         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_ERR(11, 756, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_value = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "src/lxml/extensions.pxi":758
 *             value = funicode(s)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         c_element = NULL
 *     else:
 */
    /*finally:*/ {
      /*normal exit:*/{
        xmlFree(__pyx_v_s);
        goto __pyx_L6;
      }
      __pyx_L5_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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:;
    }

    /* "src/lxml/extensions.pxi":759
 *         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;

    /* "src/lxml/extensions.pxi":751
 *     cdef bint is_tail
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 */
    goto __pyx_L3;
  }

  /* "src/lxml/extensions.pxi":763
 *         #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
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":764
 *         # 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);

    /* "src/lxml/extensions.pxi":765
 *         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:;

  /* "src/lxml/extensions.pxi":767
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
  __pyx_t_1 = (!__pyx_v_context->_build_smart_strings);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":768
 * 
 *     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;

    /* "src/lxml/extensions.pxi":767
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
  }

  /* "src/lxml/extensions.pxi":770
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":772
 *     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;

    /* "src/lxml/extensions.pxi":773
 *         # 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_13 = (__pyx_v_c_element != NULL);
      if (__pyx_t_13) {
      } else {
        __pyx_t_1 = __pyx_t_13;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_13 = (!_isElement(__pyx_v_c_element));
      __pyx_t_1 = __pyx_t_13;
      __pyx_L13_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/extensions.pxi":774
 *         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;
    }

    /* "src/lxml/extensions.pxi":770
 *         return value
 * 
 *     if c_element is NULL:             # <<<<<<<<<<<<<<
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 */
  }

  /* "src/lxml/extensions.pxi":776
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_element != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/extensions.pxi":777
 * 
 *     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_ERR(11, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parent, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/extensions.pxi":776
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 */
  }

  /* "src/lxml/extensions.pxi":779
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 *     return _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *         value, parent, attrname, is_tail)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/extensions.pxi":780
 * 
 *     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_ERR(11, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/extensions.pxi":744
 *     return result
 * 
 * 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;
}

/* "src/lxml/extensions.pxi":785
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs) noexcept:
 *     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;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  xmlXPathObject *__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("_extension_function_call", 1);

  /* "src/lxml/extensions.pxi":791
 *     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;

  /* "src/lxml/extensions.pxi":792
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/extensions.pxi":793
 *     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_ERR(11, 793, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_args = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "src/lxml/extensions.pxi":794
 *     try:
 *         args = []
 *         for i in range(nargs):             # <<<<<<<<<<<<<<
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 */
        __pyx_t_5 = __pyx_v_nargs;
        __pyx_t_6 = __pyx_t_5;
        for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
          __pyx_v_i = __pyx_t_7;

          /* "src/lxml/extensions.pxi":795
 *         args = []
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)             # <<<<<<<<<<<<<<
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 */
          __pyx_v_obj = valuePop(__pyx_v_ctxt);

          /* "src/lxml/extensions.pxi":796
 *         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_ERR(11, 796, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "src/lxml/extensions.pxi":797
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)             # <<<<<<<<<<<<<<
 *             args.append(o)
 *         args.reverse()
 */
          __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj);

          /* "src/lxml/extensions.pxi":798
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 *             args.append(o)             # <<<<<<<<<<<<<<
 *         args.reverse()
 * 
 */
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_args, __pyx_v_o); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(11, 798, __pyx_L6_error)
        }

        /* "src/lxml/extensions.pxi":799
 *             _freeXPathObject(obj)
 *             args.append(o)
 *         args.reverse()             # <<<<<<<<<<<<<<
 * 
 *         res = function(context, *args)
 */
        __pyx_t_8 = PyList_Reverse(__pyx_v_args); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(11, 799, __pyx_L6_error)

        /* "src/lxml/extensions.pxi":801
 *         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_ERR(11, 801, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF((PyObject *)__pyx_v_context);
        __Pyx_GIVEREF((PyObject *)__pyx_v_context);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_context))) __PYX_ERR(11, 801, __pyx_L6_error);
        __pyx_t_9 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 801, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 801, __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;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 801, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_v_res = __pyx_t_9;
        __pyx_t_9 = 0;

        /* "src/lxml/extensions.pxi":803
 *         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_11 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_res, __pyx_v_doc, __pyx_v_context); if (unlikely(__pyx_t_11 == ((xmlXPathObject *)NULL))) __PYX_ERR(11, 803, __pyx_L6_error)
        __pyx_v_obj = __pyx_t_11;

        /* "src/lxml/extensions.pxi":805
 *         obj = _wrapXPathObject(res, doc, context)
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)             # <<<<<<<<<<<<<<
 *         xpath.valuePush(ctxt, obj)
 *     except:
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_res); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 805, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "src/lxml/extensions.pxi":806
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)             # <<<<<<<<<<<<<<
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 */
        (void)(valuePush(__pyx_v_ctxt, __pyx_v_obj));

        /* "src/lxml/extensions.pxi":792
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
 */
      }
      __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_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/extensions.pxi":807
 *         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_9, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(11, 807, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_1);

        /* "src/lxml/extensions.pxi":808
 *         xpath.valuePush(ctxt, obj)
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 *     finally:
 */
        xmlXPathErr(__pyx_v_ctxt, XPATH_EXPR_ERROR);

        /* "src/lxml/extensions.pxi":809
 *     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_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/extensions.pxi":792
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/extensions.pxi":811
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * # lookup the function by name and call it
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 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_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_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_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L16_return;
      }
      __pyx_L16_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_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_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/extensions.pxi":785
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs) noexcept:
 *     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();
}

/* "src/lxml/extensions.pxi":815
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) noexcept 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;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xpath_function_call", 0);

  /* "src/lxml/extensions.pxi":818
 *                                int nargs) noexcept 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;

  /* "src/lxml/extensions.pxi":819
 *     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;

  /* "src/lxml/extensions.pxi":820
 *     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_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/extensions.pxi":821
 *     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_ERR(11, 821, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_function = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "src/lxml/extensions.pxi":822
 *     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);
        if (__pyx_t_6) {

          /* "src/lxml/extensions.pxi":823
 *         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);

          /* "src/lxml/extensions.pxi":822
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
 */
          goto __pyx_L12;
        }

        /* "src/lxml/extensions.pxi":825
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 */
        /*else*/ {
          xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

          /* "src/lxml/extensions.pxi":827
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))             # <<<<<<<<<<<<<<
 *     except:
 *         # may not be the right error, but we need to tell libxml2 *something*
 */
          __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 827, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = 0;
          __pyx_t_8 = 127;
          __Pyx_INCREF(__pyx_kp_u_XPath_function);
          __pyx_t_7 += 16;
          __Pyx_GIVEREF(__pyx_kp_u_XPath_function);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_XPath_function);
          __pyx_t_9 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 827, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 827, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8;
          __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_10);
          __pyx_t_10 = 0;
          __Pyx_INCREF(__pyx_kp_u_not_found);
          __pyx_t_7 += 11;
          __Pyx_GIVEREF(__pyx_kp_u_not_found);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_not_found);
          __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 827, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "src/lxml/extensions.pxi":826
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(XPathFunctionError(             # <<<<<<<<<<<<<<
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 *     except:
 */
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_XPathFunctionError), __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 826, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_11 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_exception(__pyx_v_context->_exc, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(11, 826, __pyx_L6_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L12:;

        /* "src/lxml/extensions.pxi":820
 *     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:
 */
      }
      __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_L6_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/extensions.pxi":828
 *             context._exc._store_exception(XPathFunctionError(
 *                 f"XPath function '{_namespacedNameFromNsName(rctxt.functionURI, rctxt.function)}' not found"))
 *     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_2, &__pyx_t_10, &__pyx_t_9) < 0) __PYX_ERR(11, 828, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);

        /* "src/lxml/extensions.pxi":830
 *     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);

        /* "src/lxml/extensions.pxi":831
 *         # 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_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/extensions.pxi":820
 *     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:
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/extensions.pxi":833
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_10); __pyx_t_10 = 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_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_L15_return;
      }
      __pyx_L15_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;
    }
  }

  /* "src/lxml/extensions.pxi":815
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) noexcept 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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/xpath.pxi":29
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":30
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":31
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     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;

    /* "src/lxml/xpath.pxi":30
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
 */
  }

  /* "src/lxml/xpath.pxi":35
 *             _xpath_function_call)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             _xpath_function_call)
 */
  /*else*/ {

    /* "src/lxml/xpath.pxi":37
 *         return xpath.xmlXPathRegisterFuncNS(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             _xpath_function_call)             # <<<<<<<<<<<<<<
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 */
    __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;
  }

  /* "src/lxml/xpath.pxi":29
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":39
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":40
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":41
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     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;

    /* "src/lxml/xpath.pxi":40
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 */
  }

  /* "src/lxml/xpath.pxi":44
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf), NULL)
 * 
 */
  /*else*/ {

    /* "src/lxml/xpath.pxi":45
 *     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;
  }

  /* "src/lxml/xpath.pxi":39
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":52
 * 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extensions)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); __PYX_ERR(18, 52, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_error_log)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); __PYX_ERR(18, 52, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_enable_regexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); __PYX_ERR(18, 52, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variables)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); __PYX_ERR(18, 52, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_build_smart_strings)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 52, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); __PYX_ERR(18, 52, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 52, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
      values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
      values[5] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, __pyx_nargs); __PYX_ERR(18, 52, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/xpath.pxi":54
 *     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;

  /* "src/lxml/xpath.pxi":55
 *                  build_smart_strings):
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__BaseContext), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":56
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 6+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 55, __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;

  /* "src/lxml/xpath.pxi":52
 * 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;
}

/* "src/lxml/xpath.pxi":58
 *                               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", 1);

  /* "src/lxml/xpath.pxi":59
 * 
 *     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);

  /* "src/lxml/xpath.pxi":63
 *         # 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_ERR(18, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":64
 *         # 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_ERR(18, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":58
 *                               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;
}

/* "src/lxml/xpath.pxi":66
 *         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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_context", 1);

  /* "src/lxml/xpath.pxi":67
 * 
 *     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_ERR(18, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":68
 *     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_ERR(18, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":69
 *         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_ERR(18, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":70
 *         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);

  /* "src/lxml/xpath.pxi":71
 *         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);
  if (__pyx_t_2) {

    /* "src/lxml/xpath.pxi":72
 *         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_3 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xpath.pxi":71
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 *         if self._variables is not None:             # <<<<<<<<<<<<<<
 *             self.registerVariables(self._variables)
 * 
 */
  }

  /* "src/lxml/xpath.pxi":66
 *         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_3);
  __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;
}

/* "src/lxml/xpath.pxi":74
 *             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", 1);

  /* "src/lxml/xpath.pxi":75
 * 
 *     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_ERR(18, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":77
 *         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_ERR(18, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":78
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 * 
 */
  xmlXPathRegisteredVariablesCleanup(__pyx_v_self->__pyx_base._xpathCtxt);

  /* "src/lxml/xpath.pxi":79
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
 */
  __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_ERR(18, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":74
 *             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;
}

/* "src/lxml/xpath.pxi":81
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":82
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
 */
  __pyx_t_1 = (LIBXSLT_VERSION < 0x278D);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":84
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 */
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":82
 * 
 *     cdef void registerExsltFunctions(self) noexcept:
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
 */
  }

  /* "src/lxml/xpath.pxi":85
 *             # 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);

  /* "src/lxml/xpath.pxi":81
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self) noexcept:             # <<<<<<<<<<<<<<
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xpath.pxi":89
 *             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;
  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;
  xmlXPathObject *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerVariables", 1);

  /* "src/lxml/xpath.pxi":90
 * 
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():             # <<<<<<<<<<<<<<
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_variable_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(18, 90, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_variable_dict, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 90, __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_ERR(18, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __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;

    /* "src/lxml/xpath.pxi":91
 *     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_6 = ((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_6)) __PYX_ERR(18, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "src/lxml/xpath.pxi":93
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerVariable(self, name, value):
 */
    __pyx_t_8 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_8 == ((xmlXPathObject *)NULL))) __PYX_ERR(18, 93, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":92
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 */
    (void)(xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_8));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":89
 *             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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* "src/lxml/xpath.pxi":95
 *                 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", 1);

  /* "src/lxml/xpath.pxi":96
 * 
 *     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_ERR(18, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":98
 *         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 == ((xmlXPathObject *)NULL))) __PYX_ERR(18, 98, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":97
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 */
  (void)(xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_2));

  /* "src/lxml/xpath.pxi":95
 *                 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;
}

/* "src/lxml/xpath.pxi":101
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href
 */

static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *__pyx_v__c_href, void *__pyx_v__ctxt, const xmlChar *__pyx_v_c_prefix) {
  const xmlChar *__pyx_v_c_href;
  xmlXPathContext *__pyx_v_ctxt;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":103
 * cdef void _registerExsltFunctionsForNamespaces(
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href             # <<<<<<<<<<<<<<
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 */
  __pyx_v_c_href = ((const xmlChar *)__pyx_v__c_href);

  /* "src/lxml/xpath.pxi":104
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     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);

  /* "src/lxml/xpath.pxi":106
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":107
 * 
 *     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)
 */
    (void)(exsltDateXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":106
 *     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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":108
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":109
 *         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)
 */
    (void)(exsltSetsXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":108
 *     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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":110
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":111
 *         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)
 */
    (void)(exsltMathXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":110
 *     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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xpath.pxi":112
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":113
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (void)(exsltStrXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix));

    /* "src/lxml/xpath.pxi":112
 *     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_L3:;

  /* "src/lxml/xpath.pxi":101
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept:
 *     c_href = <const_xmlChar*> _c_href
 */

  /* function exit code */
}

/* "src/lxml/xpath.pxi":121
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "src/lxml/xpath.pxi":122
 *     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;

  /* "src/lxml/xpath.pxi":123
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 */
  if (ENABLE_THREADING) {

    /* "src/lxml/xpath.pxi":124
 *         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();

    /* "src/lxml/xpath.pxi":125
 *         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);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xpath.pxi":126
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
      PyErr_NoMemory(); __PYX_ERR(18, 126, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":125
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()
 */
    }

    /* "src/lxml/xpath.pxi":123
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 */
  }

  /* "src/lxml/xpath.pxi":127
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/xpath.pxi":121
 *     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;
}

/* "src/lxml/xpath.pxi":129
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
 */

/* 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_enable_regexp,&__pyx_n_s_smart_strings,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 129, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extensions)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 129, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(18, 129, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_enable_regexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 129, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(18, 129, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_smart_strings)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 129, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(18, 129, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 129, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(18, 129, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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) {
  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("__init__", 1);

  /* "src/lxml/xpath.pxi":131
 *     def __init__(self, namespaces, extensions, enable_regexp,
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,             # <<<<<<<<<<<<<<
 *                                       enable_regexp, None, smart_strings)
 * 
 */
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_namespaces)) __PYX_ERR(18, 131, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_extensions)) __PYX_ERR(18, 131, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(18, 131, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_enable_regexp)) __PYX_ERR(18, 131, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, Py_None)) __PYX_ERR(18, 131, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_smart_strings)) __PYX_ERR(18, 131, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__XPathContext), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/xpath.pxi":129
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
 */

  /* 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._XPathEvaluatorBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":134
 *                                       enable_regexp, None, smart_strings)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xpath.pxi":136
 *     @property
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_evaluator_not_initialised, 0, 0);
      __PYX_ERR(18, 136, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 136, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":137
 *     def error_log(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_ERR(18, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":134
 *                                       enable_regexp, None, smart_strings)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 */

  /* 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;
}

/* "src/lxml/xpath.pxi":139
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":140
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":141
 *     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);

    /* "src/lxml/xpath.pxi":140
 * 
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 */
  }

  /* "src/lxml/xpath.pxi":142
 *         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)
 */
  if (ENABLE_THREADING) {

    /* "src/lxml/xpath.pxi":143
 *             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);
    if (__pyx_t_1) {

      /* "src/lxml/xpath.pxi":144
 *         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);

      /* "src/lxml/xpath.pxi":143
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 */
    }

    /* "src/lxml/xpath.pxi":142
 *         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)
 */
  }

  /* "src/lxml/xpath.pxi":139
 *         return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 */

  /* function exit code */
}

/* "src/lxml/xpath.pxi":146
 *                 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", 1);

  /* "src/lxml/xpath.pxi":147
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         self._context.set_context(xpathCtxt)
 * 
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "src/lxml/xpath.pxi":148
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_set_context(__pyx_v_self->_context, __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":146
 *                 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;
}

/* "src/lxml/xpath.pxi":150
 *         self._context.set_context(xpathCtxt)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":152
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
 */
  __pyx_t_1 = (__pyx_v_path == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":153
 *         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;

    /* "src/lxml/xpath.pxi":152
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
 */
  }

  /* "src/lxml/xpath.pxi":154
 *         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]);

  /* "src/lxml/xpath.pxi":155
 *             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;

    /* "src/lxml/xpath.pxi":156
 *         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);

    /* "src/lxml/xpath.pxi":157
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 *             c = path[0]             # <<<<<<<<<<<<<<
 *         return c == c'/'
 * 
 */
    __pyx_v_c = (__pyx_v_path[0]);
  }

  /* "src/lxml/xpath.pxi":158
 *             path = path + 1
 *             c = path[0]
 *         return c == c'/'             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = (__pyx_v_c == '/');
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":150
 *         self._context.set_context(xpathCtxt)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path) noexcept:             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":161
 * 
 *     @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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xpath.pxi":163
 *     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) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_eval_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":164
 *         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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xpath.pxi":165
 *         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);
        }

        /* "src/lxml/xpath.pxi":164
 *         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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":167
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0
 */
    __pyx_t_1 = (__pyx_v_result == 0);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xpath.pxi":168
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise XPathError, "XPath evaluator locking failed"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XPathError), __pyx_kp_u_XPath_evaluator_locking_failed, 0, 0);
      __PYX_ERR(18, 168, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":167
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0
 */
    }

    /* "src/lxml/xpath.pxi":163
 *     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(
 */
  }

  /* "src/lxml/xpath.pxi":169
 *             if result == 0:
 *                 raise XPathError, "XPath evaluator locking failed"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":161
 * 
 *     @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_AddTraceback("lxml.etree._XPathEvaluatorBase._lock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":172
 * 
 *     @cython.final
 *     cdef void _unlock(self) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/xpath.pxi":173
 *     @cython.final
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 */
  if (ENABLE_THREADING) {
  } else {
    __pyx_t_1 = ENABLE_THREADING;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_eval_lock != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":174
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_parse_error(self):
 */
    PyThread_release_lock(__pyx_v_self->_eval_lock);

    /* "src/lxml/xpath.pxi":173
 *     @cython.final
 *     cdef void _unlock(self) noexcept:
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 */
  }

  /* "src/lxml/xpath.pxi":172
 * 
 *     @cython.final
 *     cdef void _unlock(self) noexcept:             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)
 */

  /* function exit code */
}

/* "src/lxml/xpath.pxi":176
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _build_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_parse_error", 1);

  /* "src/lxml/xpath.pxi":178
 *     cdef _build_parse_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_ERR(18, 178, __pyx_L1_error)
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":179
 *         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_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(18, 179, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "src/lxml/xpath.pxi":180
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 return XPathSyntaxError(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_ERR(18, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":181
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
 */
    __pyx_t_5 = (__pyx_v_message != Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/xpath.pxi":182
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 return XPathSyntaxError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XPathSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_message, ((PyObject *)__pyx_v_self->_error_log)};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 182, __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;

      /* "src/lxml/xpath.pxi":181
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
 */
    }

    /* "src/lxml/xpath.pxi":179
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  }

  /* "src/lxml/xpath.pxi":183
 *             if message is not None:
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(             # <<<<<<<<<<<<<<
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XPathSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":184
 *                 return XPathSyntaxError(message, self._error_log)
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),             # <<<<<<<<<<<<<<
 *             self._error_log)
 * 
 */
  __pyx_t_3 = __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_3)) __PYX_ERR(18, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":185
 *         return XPathSyntaxError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_eval_error(self):
 */
  __pyx_t_6 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, ((PyObject *)__pyx_v_self->_error_log)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 183, __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;

  /* "src/lxml/xpath.pxi":176
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _build_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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._build_parse_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":187
 *             self._error_log)
 * 
 *     cdef _build_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_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_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_eval_error", 1);

  /* "src/lxml/xpath.pxi":189
 *     cdef _build_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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_ERR(18, 189, __pyx_L1_error)
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":190
 *         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_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(18, 190, __pyx_L1_error)
  __pyx_t_6 = (!__pyx_t_5);
  if (__pyx_t_6) {

    /* "src/lxml/xpath.pxi":191
 *         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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __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_ERR(18, 191, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_entries, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":190
 *         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:
 */
  }

  /* "src/lxml/xpath.pxi":192
 *         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_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(18, 192, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "src/lxml/xpath.pxi":193
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 return 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_ERR(18, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":194
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
 */
    __pyx_t_6 = (__pyx_v_message != Py_None);
    if (__pyx_t_6) {

      /* "src/lxml/xpath.pxi":195
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         return XPathEvalError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message)) __PYX_ERR(18, 195, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(18, 195, __pyx_L1_error);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPathEvalError), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 195, __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;

      /* "src/lxml/xpath.pxi":194
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
 */
    }

    /* "src/lxml/xpath.pxi":192
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  }

  /* "src/lxml/xpath.pxi":196
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(             # <<<<<<<<<<<<<<
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/xpath.pxi":197
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),             # <<<<<<<<<<<<<<
 *             self._error_log)
 * 
 */
  __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_ERR(18, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":196
 *             if message is not None:
 *                 return XPathEvalError(message, self._error_log)
 *         return XPathEvalError(             # <<<<<<<<<<<<<<
 *             self._error_log._buildExceptionMessage("Error in xpath expression"),
 *             self._error_log)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(18, 196, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(18, 196, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPathEvalError), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 196, __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;

  /* "src/lxml/xpath.pxi":187
 *             self._error_log)
 * 
 *     cdef _build_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._build_eval_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":200
 *             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", 1);

  /* "src/lxml/xpath.pxi":201
 * 
 *     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); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(18, 201, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":202
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/xpath.pxi":203
 *         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);

      /* "src/lxml/xpath.pxi":204
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()
 */
      __pyx_v_xpathObj = NULL;

      /* "src/lxml/xpath.pxi":202
 *     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
 */
    }

    /* "src/lxml/xpath.pxi":205
 *                 _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_ERR(18, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":206
 *                 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 == ((int)-1))) __PYX_ERR(18, 206, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":201
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():             # <<<<<<<<<<<<<<
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 */
  }

  /* "src/lxml/xpath.pxi":208
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()
 */
  __pyx_t_1 = (__pyx_v_xpathObj == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xpath.pxi":209
 * 
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             raise self._build_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_ERR(18, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":210
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self->__pyx_vtab)->_build_eval_error(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 210, __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_ERR(18, 210, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":208
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             raise self._build_eval_error()
 */
  }

  /* "src/lxml/xpath.pxi":212
 *             raise self._build_eval_error()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 */
  /*try:*/ {

    /* "src/lxml/xpath.pxi":213
 * 
 *         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_ERR(18, 213, __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;
  }

  /* "src/lxml/xpath.pxi":215
 *             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);

      /* "src/lxml/xpath.pxi":216
 *         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_ERR(18, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    __pyx_L7_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      {

        /* "src/lxml/xpath.pxi":215
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
 */
        __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

        /* "src/lxml/xpath.pxi":216
 *         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_ERR(18, 216, __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:;
  }

  /* "src/lxml/xpath.pxi":218
 *             self._context._release_temp_refs()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":200
 *             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;
}

/* "src/lxml/xpath.pxi":235
 *     """
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/xpath.pxi":236
 *     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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 235, __pyx_L3_error)
        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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 235, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 235, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 235, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(18, 235, __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);

  /* "src/lxml/xpath.pxi":235
 *     """
 *     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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/xpath.pxi":240
 *         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 == ((int)-1))) __PYX_ERR(18, 240, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":241
 *         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 == ((int)-1))) __PYX_ERR(18, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":242
 *         _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((PyObject *)__pyx_v_self->_element);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element;

  /* "src/lxml/xpath.pxi":243
 *         _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;

  /* "src/lxml/xpath.pxi":244
 *         self._element = element
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":245
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 5+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":246
 *         _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);

  /* "src/lxml/xpath.pxi":247
 *                                      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);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xpath.pxi":248
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 * 
 */
    PyErr_NoMemory(); __PYX_ERR(18, 248, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":247
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 */
  }

  /* "src/lxml/xpath.pxi":249
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespace(self, prefix, uri):
 */
  __pyx_t_2 = ((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_2)) __PYX_ERR(18, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":235
 *     """
 *     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;
}

/* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace, "Register a namespace with the XPath context.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21XPathElementEvaluator_3register_namespace = {"register_namespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace};
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_prefix)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 251, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_uri)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 251, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); __PYX_ERR(18, 251, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "register_namespace") < 0)) __PYX_ERR(18, 251, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, __pyx_nargs); __PYX_ERR(18, 251, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespace", 1);

  /* "src/lxml/xpath.pxi":254
 *         """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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(18, 254, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 254, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":255
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespaces(self, namespaces):
 */
  __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_ERR(18, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """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_2);
  __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;
}

/* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces, "Register a prefix -> uri dict.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_21XPathElementEvaluator_5register_namespaces = {"register_namespaces", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces};
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_namespaces = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespaces (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 257, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "register_namespaces") < 0)) __PYX_ERR(18, 257, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_namespaces = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespaces", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 257, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_namespaces);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespaces", 1);

  /* "src/lxml/xpath.pxi":260
 *         """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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(18, 260, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 260, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":261
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():             # <<<<<<<<<<<<<<
 *             self._context.addNamespace(prefix, uri)
 * 
 */
  __pyx_t_3 = 0;
  if (unlikely(__pyx_v_namespaces == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(18, 261, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_namespaces, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 261, __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_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(18, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "src/lxml/xpath.pxi":262
 *         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_7 = ((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_7)) __PYX_ERR(18, 262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """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_2);
  __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;
}

/* "src/lxml/xpath.pxi":264
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 264, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(18, 264, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 264, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__variables);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __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__", 1);

  /* "src/lxml/xpath.pxi":277
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(18, 277, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 277, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":278
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_path = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":279
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":281
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(18, 281, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":282
 * 
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  __pyx_t_4 = __pyx_v_self->_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_4;

  /* "src/lxml/xpath.pxi":283
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "src/lxml/xpath.pxi":284
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 284, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":285
 *         try:
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             c_path = _xcstr(path)
 *             with nogil:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 285, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":286
 *             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);

    /* "src/lxml/xpath.pxi":287
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xpath.pxi":288
 *             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);
        }

        /* "src/lxml/xpath.pxi":287
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":290
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
 */
    __pyx_t_2 = ((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_2)) __PYX_ERR(18, 290, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "src/lxml/xpath.pxi":292
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":293
 *         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;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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;
      {

        /* "src/lxml/xpath.pxi":292
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 292, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/xpath.pxi":293
 *         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_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_L5:;
  }

  /* "src/lxml/xpath.pxi":295
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":264
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/xpath.pxi":308
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/xpath.pxi":309
 *     """
 *     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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 308, __pyx_L3_error)
        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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 308, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 308, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 308, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_ERR(18, 308, __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);

  /* "src/lxml/xpath.pxi":308
 *     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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "src/lxml/xpath.pxi":310
 *     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 *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/xpath.pxi":311
 *                  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_ERR(18, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(18, 310, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_etree->_context_node);
  __Pyx_GIVEREF((PyObject *)__pyx_v_etree->_context_node);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_etree->_context_node))) __PYX_ERR(18, 310, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(18, 311, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":312
 *         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_ERR(18, 311, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_regexp, __pyx_v_regexp) < 0) __PYX_ERR(18, 311, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":313
 *             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_ERR(18, 311, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":310
 *     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_ERR(18, 310, __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;

  /* "src/lxml/xpath.pxi":308
 *     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;
}

/* "src/lxml/xpath.pxi":315
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 315, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(18, 315, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 315, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__variables);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__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;
  char const *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/xpath.pxi":326
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(18, 326, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 326, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":327
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_path = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":328
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":330
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(18, 330, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":331
 * 
 *         self._lock()
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 */
  /*try:*/ {

    /* "src/lxml/xpath.pxi":332
 *         self._lock()
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 332, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":333
 *         try:
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)             # <<<<<<<<<<<<<<
 *             try:
 *                 self._context.registerVariables(_variables)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_self->__pyx_base._element->_c_node); if (unlikely(__pyx_t_4 == ((xmlDoc *)NULL))) __PYX_ERR(18, 333, __pyx_L4_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/xpath.pxi":334
 *             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:*/ {

      /* "src/lxml/xpath.pxi":335
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 *                 self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *                 c_path = _xcstr(path)
 *                 with nogil:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 335, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":336
 *             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);

      /* "src/lxml/xpath.pxi":337
 *                 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;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {

            /* "src/lxml/xpath.pxi":338
 *                 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;

            /* "src/lxml/xpath.pxi":339
 *                 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);

            /* "src/lxml/xpath.pxi":340
 *                     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);
          }

          /* "src/lxml/xpath.pxi":337
 *                 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
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }

      /* "src/lxml/xpath.pxi":342
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
      __pyx_t_2 = ((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_2)) __PYX_ERR(18, 342, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "src/lxml/xpath.pxi":344
 *                 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);

        /* "src/lxml/xpath.pxi":345
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 345, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8;
      }
      __pyx_L7_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __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;
        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;
        {

          /* "src/lxml/xpath.pxi":344
 *                 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);

          /* "src/lxml/xpath.pxi":345
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 345, __pyx_L13_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_L4_error;
        __pyx_L13_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_L4_error;
      }
      __pyx_L8:;
    }
  }

  /* "src/lxml/xpath.pxi":347
 *                 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;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __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_XGOTREF(__pyx_t_7);
      __pyx_t_5 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_13 = __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_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_13;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "src/lxml/xpath.pxi":349
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":315
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         """__call__(self, _path, **_variables)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_72XPathEvaluator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_71XPathEvaluator, "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_72XPathEvaluator = {"XPathEvaluator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_72XPathEvaluator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_71XPathEvaluator};
static PyObject *__pyx_pw_4lxml_5etree_72XPathEvaluator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "src/lxml/xpath.pxi":353
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,
 *                    regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 * 
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_True)));
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_True)));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree_or_element)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 352, __pyx_L3_error)
        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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 352, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "XPathEvaluator") < 0)) __PYX_ERR(18, 352, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XPathEvaluator", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 352, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_71XPathEvaluator(__pyx_self, __pyx_v_etree_or_element, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_71XPathEvaluator(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;
  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("XPathEvaluator", 1);

  /* "src/lxml/xpath.pxi":367
 *     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, __pyx_ptype_4lxml_5etree__ElementTree); 
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":368
 *     """
 *     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);

    /* "src/lxml/xpath.pxi":369
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_etree_or_element)) __PYX_ERR(18, 368, __pyx_L1_error);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(18, 369, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":370
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *     else:
 *         return XPathElementEvaluator(
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, __pyx_v_extensions) < 0) __PYX_ERR(18, 369, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_regexp, __pyx_v_regexp) < 0) __PYX_ERR(18, 369, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) __PYX_ERR(18, 369, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":368
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 368, __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_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "src/lxml/xpath.pxi":367
 *     you pass ``smart_strings=False``.
 *     """
 *     if isinstance(etree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 */
  }

  /* "src/lxml/xpath.pxi":372
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/xpath.pxi":373
 *     else:
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_etree_or_element)) __PYX_ERR(18, 372, __pyx_L1_error);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(18, 373, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":374
 *         return XPathElementEvaluator(
 *             etree_or_element, 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_ERR(18, 373, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_regexp, __pyx_v_regexp) < 0) __PYX_ERR(18, 373, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) __PYX_ERR(18, 373, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":372
 *             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_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 372, __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;
  }

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

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

/* "src/lxml/xpath.pxi":391
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/xpath.pxi":392
 *     cdef bytes _path
 *     def __cinit__(self):
 *         self._xpath = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 */
  __pyx_v_self->_xpath = NULL;

  /* "src/lxml/xpath.pxi":391
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xpath.pxi":394
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));

    /* "src/lxml/xpath.pxi":395
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 *                  regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 */
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 394, __pyx_L3_error)
        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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 394, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 394, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 394, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/xpath.pxi":394
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/xpath.pxi":397
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":398
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 5+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 397, __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;

  /* "src/lxml/xpath.pxi":399
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_path);
  __Pyx_DECREF(__pyx_v_self->_path);
  __pyx_v_self->_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":400
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 */
  __pyx_v_xpathCtxt = xmlXPathNewContext(NULL);

  /* "src/lxml/xpath.pxi":401
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 */
  __pyx_t_5 = (__pyx_v_xpathCtxt == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xpath.pxi":402
 *         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_ERR(18, 402, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":401
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 */
  }

  /* "src/lxml/xpath.pxi":403
 *         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_1 = ((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_1)) __PYX_ERR(18, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":404
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))             # <<<<<<<<<<<<<<
 *         if self._xpath is NULL:
 *             raise self._build_parse_error()
 */
  __pyx_t_1 = __pyx_v_self->_path;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_self->_xpath = xmlXPathCtxtCompile(__pyx_v_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":405
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             raise self._build_parse_error()
 * 
 */
  __pyx_t_5 = (__pyx_v_self->_xpath == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xpath.pxi":406
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:
 *             raise self._build_parse_error()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _etree_or_element, **_variables):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._build_parse_error(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 406, __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_ERR(18, 406, __pyx_L1_error)

    /* "src/lxml/xpath.pxi":405
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             raise self._build_parse_error()
 * 
 */
  }

  /* "src/lxml/xpath.pxi":394
 *         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;
}

/* "src/lxml/xpath.pxi":408
 *             raise self._build_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         "__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*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_5XPath_4__call__, "__call__(self, _etree_or_element, **_variables)");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree_or_element_2,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree_or_element_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 408, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v__variables, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(18, 408, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v__etree_or_element = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 408, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_DECREF(__pyx_v__variables);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  xmlNode *__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("__call__", 1);

  /* "src/lxml/xpath.pxi":414
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->__pyx_base._xpathCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_context_not_initialised, 0, 0);
      __PYX_ERR(18, 414, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(18, 414, __pyx_L1_error)
  #endif

  /* "src/lxml/xpath.pxi":415
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_document = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":416
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":418
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(18, 418, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":419
 * 
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = element._c_node
 * 
 */
  __pyx_t_4 = __pyx_v_document->_c_doc;
  __pyx_v_self->__pyx_base._xpathCtxt->doc = __pyx_t_4;

  /* "src/lxml/xpath.pxi":420
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_5 = __pyx_v_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_5;

  /* "src/lxml/xpath.pxi":422
 *         self._xpathCtxt.node = element._c_node
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "src/lxml/xpath.pxi":423
 * 
 *         try:
 *             self._context.register_context(document)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             with nogil:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_document); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 423, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":424
 *         try:
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 424, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xpath.pxi":425
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xpath.pxi":426
 *             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);
        }

        /* "src/lxml/xpath.pxi":425
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "src/lxml/xpath.pxi":428
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
 */
    __pyx_t_2 = ((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_2)) __PYX_ERR(18, 428, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "src/lxml/xpath.pxi":430
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/xpath.pxi":431
 *         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;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_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_3 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {

        /* "src/lxml/xpath.pxi":430
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 430, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "src/lxml/xpath.pxi":431
 *         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_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_3; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
      __pyx_L10_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_L5:;
  }

  /* "src/lxml/xpath.pxi":432
 *             self._context.unregister_context()
 *             self._unlock()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":408
 *             raise self._build_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         "__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/xpath.pxi":434
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The literal XPath expression.
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xpath.pxi":438
 *         """The literal XPath expression.
 *         """
 *         return self._path.decode('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 '%.30s'", "decode");
    __PYX_ERR(18, 438, __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_ERR(18, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":434
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def path(self):
 *         """The literal XPath expression.
 */

  /* 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;
}

/* "src/lxml/xpath.pxi":440
 *         return self._path.decode('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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/xpath.pxi":441
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_xpath != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xpath.pxi":442
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    xmlXPathFreeCompExpr(__pyx_v_self->_xpath);

    /* "src/lxml/xpath.pxi":441
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 */
  }

  /* "src/lxml/xpath.pxi":440
 *         return self._path.decode('UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 */

  /* function exit code */
}

/* "src/lxml/xpath.pxi":444
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xpath.pxi":445
 * 
 *     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_ERR(18, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":444
 *             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;
}

/* "src/lxml/xpath.pxi":460
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/xpath.pxi":461
 *     """
 *     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] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_path)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 460, __pyx_L3_error)
        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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 460, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(18, 460, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(18, 460, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/xpath.pxi":460
 *     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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/xpath.pxi":462
 *     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_ERR(18, 462, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(18, 462, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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_ERR(18, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 462, __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_ERR(18, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    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_ERR(18, 462, __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_ERR(18, 462, __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;

  /* "src/lxml/xpath.pxi":463
 *                  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 *)__pyx_ptype_4lxml_5etree_XPath), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(18, 463, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path)) __PYX_ERR(18, 463, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) __PYX_ERR(18, 463, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":464
 *         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_ERR(18, 463, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_regexp, __pyx_v_regexp) < 0) __PYX_ERR(18, 463, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":465
 *         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_ERR(18, 463, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":463
 *                  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_ERR(18, 463, __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;

  /* "src/lxml/xpath.pxi":460
 *     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;
}

/* "src/lxml/xpath.pxi":467
 *                        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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  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);

  /* "src/lxml/xpath.pxi":469
 *     cdef _nsextract_path(self, path):
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}             # <<<<<<<<<<<<<<
 *         cdef list namespace_defs = []
 *         cdef int i
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":470
 *         # 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_ERR(18, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespace_defs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":472
 *         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_ERR(18, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":473
 *         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_INCREF(__pyx_v_4lxml_5etree__replace_strings);
  __pyx_t_2 = __pyx_v_4lxml_5etree__replace_strings; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_kp_b__12, __pyx_v_path_utf};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_stripped_path = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/xpath.pxi":474
 *         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;

  /* "src/lxml/xpath.pxi":475
 *         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_INCREF(__pyx_v_4lxml_5etree__find_namespaces);
  __pyx_t_2 = __pyx_v_4lxml_5etree__find_namespaces; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_stripped_path};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 475, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 475, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(18, 475, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 475, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(18, 475, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(18, 475, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 475, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(18, 475, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_namespace_def, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xpath.pxi":476
 *         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_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_namespace_def, __pyx_v_namespace_defs, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(18, 476, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "src/lxml/xpath.pxi":477
 *         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(((char *)"__xpp%02d"), __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":478
 *             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);

      /* "src/lxml/xpath.pxi":479
 *                 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_8 = __Pyx_PyList_Append(__pyx_v_namespace_defs, __pyx_v_namespace_def); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(18, 479, __pyx_L1_error)

      /* "src/lxml/xpath.pxi":480
 *                 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, -1L, NULL, NULL, &__pyx_slice__94, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":481
 *                 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 '%.30s'", "decode");
        __PYX_ERR(18, 481, __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_ERR(18, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":482
 *                 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 '%.30s'", "decode");
        __PYX_ERR(18, 482, __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_ERR(18, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely((PyDict_SetItem(__pyx_v_namespaces, __pyx_t_1, __pyx_v_namespace) < 0))) __PYX_ERR(18, 482, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":483
 *                 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__17); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix_str, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":485
 *                 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_path_utf, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_v_namespace_def, __pyx_v_prefix_str};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_path_utf, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/xpath.pxi":476
 *         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
 */
    }

    /* "src/lxml/xpath.pxi":475
 *         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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":486
 *                 # 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_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_n_u_utf8};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xpath.pxi":487
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')
 *         return path, namespaces             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path)) __PYX_ERR(18, 487, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces)) __PYX_ERR(18, 487, __pyx_L1_error);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xpath.pxi":467
 *                        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_3);
  __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;
}

/* "src/lxml/xslt.pxi":52
 *     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", 1);

  /* "src/lxml/xslt.pxi":54
 *     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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__XSLTResolverContext)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":55
 *         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_ERR(5, 55, __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;

  /* "src/lxml/xslt.pxi":56
 *         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;

  /* "src/lxml/xslt.pxi":57
 *         _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;

  /* "src/lxml/xslt.pxi":52
 *     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;
}

/* "src/lxml/xslt.pxi":59
 *         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", 1);

  /* "src/lxml/xslt.pxi":61
 * 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_ERR(5, 61, __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_ERR(5, 61, __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_ERR(5, 61, __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;

  /* "src/lxml/xslt.pxi":62
 *                               _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((PyObject *)__pyx_v_context->_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_parser);
  __pyx_v_context->_parser = __pyx_v_parser;

  /* "src/lxml/xslt.pxi":63
 *     _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;

  /* "src/lxml/xslt.pxi":59
 *         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;
}

/* "src/lxml/xslt.pxi":65
 *     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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_resolve_from_python", 0);

  /* "src/lxml/xslt.pxi":72
 *     cdef _InputDocument doc_ref
 *     cdef xmlDoc* c_doc
 *     cdef xmlDoc* c_return_doc = NULL             # <<<<<<<<<<<<<<
 * 
 *     error[0] = 0
 */
  __pyx_v_c_return_doc = NULL;

  /* "src/lxml/xslt.pxi":74
 *     cdef xmlDoc* c_return_doc = NULL
 * 
 *     error[0] = 0             # <<<<<<<<<<<<<<
 *     context = <_XSLTResolverContext>c_context
 * 
 */
  (__pyx_v_error[0]) = 0;

  /* "src/lxml/xslt.pxi":75
 * 
 *     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;

  /* "src/lxml/xslt.pxi":78
 * 
 *     # 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;

  /* "src/lxml/xslt.pxi":79
 *     # 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_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/xslt.pxi":80
 *     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_7 = (__pyx_v_c_doc != NULL);
        if (__pyx_t_7) {
        } else {
          __pyx_t_6 = __pyx_t_7;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_7 = (__pyx_v_c_doc->URL != NULL);
        __pyx_t_6 = __pyx_t_7;
        __pyx_L13_bool_binop_done:;
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":81
 *     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_6 = (xmlStrcmp(__pyx_v_c_uri, __pyx_v_c_doc->URL) == 0);
          if (__pyx_t_6) {

            /* "src/lxml/xslt.pxi":82
 *         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 == ((xmlDoc *)NULL))) __PYX_ERR(5, 82, __pyx_L6_error)
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":83
 *             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;

            /* "src/lxml/xslt.pxi":81
 *     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
 */
          }

          /* "src/lxml/xslt.pxi":80
 *     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)
 */
        }

        /* "src/lxml/xslt.pxi":86
 * 
 *         # 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;

        /* "src/lxml/xslt.pxi":87
 *         # 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_6 = (xmlStrncmp(((unsigned char *)((unsigned char *)((char const *)"string://__STRING__XSLT__/"))), __pyx_v_c_uri, 26) == 0);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":88
 *         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);

          /* "src/lxml/xslt.pxi":87
 *         # 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)
 */
        }

        /* "src/lxml/xslt.pxi":89
 *         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_ERR(5, 89, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_uri = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "src/lxml/xslt.pxi":90
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)             # <<<<<<<<<<<<<<
 * 
 *         if doc_ref is not None:
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_resolvers), __pyx_n_s_resolve); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 90, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = NULL;
        __pyx_t_10 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_10 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_9, __pyx_v_uri, Py_None, ((PyObject *)__pyx_v_context)};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 3+__pyx_t_10);
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 90, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__InputDocument))))) __PYX_ERR(5, 90, __pyx_L6_error)
        __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "src/lxml/xslt.pxi":92
 *         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_6 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":93
 * 
 *         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)
 */
          switch (__pyx_v_doc_ref->_type) {
            case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

            /* "src/lxml/xslt.pxi":95
 *             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_1 = __pyx_v_doc_ref->_data_bytes;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_8 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_8);
            __pyx_t_9 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_9);

            /* "src/lxml/xslt.pxi":94
 *         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_1, __pyx_t_8, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_9)); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(5, 94, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":93
 * 
 *         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)
 */
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

            /* "src/lxml/xslt.pxi":98
 *             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_9 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_9);
            __pyx_t_8 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_8);

            /* "src/lxml/xslt.pxi":97
 *                     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_9, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_8)); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(5, 97, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":96
 *                 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)
 */
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

            /* "src/lxml/xslt.pxi":101
 *             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_8 = __pyx_v_doc_ref->_file;
            __Pyx_INCREF(__pyx_t_8);
            __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);

            /* "src/lxml/xslt.pxi":100
 *                     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_8, __pyx_t_9, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(__pyx_t_2 == ((xmlDoc *)NULL))) __PYX_ERR(5, 100, __pyx_L6_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":99
 *                 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)
 */
            break;
            case __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY:

            /* "src/lxml/xslt.pxi":103
 *                     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 == ((xmlDoc *)NULL))) __PYX_ERR(5, 103, __pyx_L6_error)
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "src/lxml/xslt.pxi":102
 *                 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:
 */
            break;
            default: break;
          }

          /* "src/lxml/xslt.pxi":104
 *             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_7 = (__pyx_v_c_return_doc != NULL);
          if (__pyx_t_7) {
          } else {
            __pyx_t_6 = __pyx_t_7;
            goto __pyx_L19_bool_binop_done;
          }
          __pyx_t_7 = (__pyx_v_c_return_doc->URL == NULL);
          __pyx_t_6 = __pyx_t_7;
          __pyx_L19_bool_binop_done:;
          if (__pyx_t_6) {

            /* "src/lxml/xslt.pxi":105
 *                 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);

            /* "src/lxml/xslt.pxi":104
 *             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:
 */
          }

          /* "src/lxml/xslt.pxi":92
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 *         if doc_ref is not None:             # <<<<<<<<<<<<<<
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
 */
        }

        /* "src/lxml/xslt.pxi":79
 *     # 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:
 */
      }
      __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_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/xslt.pxi":106
 *             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_1, &__pyx_t_9, &__pyx_t_8) < 0) __PYX_ERR(5, 106, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "src/lxml/xslt.pxi":107
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
 *         error[0] = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *     finally:
 */
        (__pyx_v_error[0]) = 1;

        /* "src/lxml/xslt.pxi":108
 *     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_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;
        goto __pyx_L7_exception_handled;
      }

      /* "src/lxml/xslt.pxi":79
 *     # 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:
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/xslt.pxi":110
 *         context._store_raised()
 *     finally:
 *         return c_return_doc  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_return_doc;
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_1); __pyx_t_1 = 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_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_L23_return;
      }
      __pyx_L23_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;
    }
  }

  /* "src/lxml/xslt.pxi":65
 *     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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":113
 * 
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) noexcept 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;
  struct __pyx_obj_4lxml_5etree_XSLTError *__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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  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;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_store_resolver_exception", 0);

  /* "src/lxml/xslt.pxi":115
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/xslt.pxi":116
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:
 *         message = f"Cannot resolve URI {_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_ERR(5, 116, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 116, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Cannot_resolve_URI, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 116, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_message = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "src/lxml/xslt.pxi":117
 *     try:
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
 */
        __pyx_t_6 = (__pyx_v_c_type == XSLT_LOAD_DOCUMENT);
        if (__pyx_t_6) {

          /* "src/lxml/xslt.pxi":118
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)             # <<<<<<<<<<<<<<
 *         else:
 *             exception = XSLTParseError(message)
 */
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTApplyError), __pyx_v_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 118, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_v_exception = ((struct __pyx_obj_4lxml_5etree_XSLTError *)__pyx_t_4);
          __pyx_t_4 = 0;

          /* "src/lxml/xslt.pxi":117
 *     try:
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
 */
          goto __pyx_L12;
        }

        /* "src/lxml/xslt.pxi":120
 *             exception = XSLTApplyError(message)
 *         else:
 *             exception = XSLTParseError(message)             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
 */
        /*else*/ {
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTParseError), __pyx_v_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 120, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_v_exception = ((struct __pyx_obj_4lxml_5etree_XSLTError *)__pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L12:;

        /* "src/lxml/xslt.pxi":121
 *         else:
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)             # <<<<<<<<<<<<<<
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)
 */
        __pyx_t_7 = ((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)), ((PyObject *)__pyx_v_exception)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 121, __pyx_L6_error)

        /* "src/lxml/xslt.pxi":115
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
      }
      __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_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "src/lxml/xslt.pxi":122
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_BaseException);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree._xslt_store_resolver_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(5, 122, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_e = __pyx_t_5;
        /*try:*/ {

          /* "src/lxml/xslt.pxi":123
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # and swallow any further exceptions
 */
          __pyx_t_7 = ((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); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 123, __pyx_L18_error)
        }

        /* "src/lxml/xslt.pxi":122
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L19;
          }
          __pyx_L18_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 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_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            }
            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_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
            goto __pyx_L8_except_error;
          }
          __pyx_L19:;
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;

      /* "src/lxml/xslt.pxi":115
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = f"Cannot resolve URI {_decodeFilename(c_uri)}"
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
      __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_L11_try_end:;
    }
  }

  /* "src/lxml/xslt.pxi":125
 *         (<_XSLTResolverContext>context)._store_exception(e)
 *     finally:
 *         return  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
      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_16);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L24_return;
      }
      __pyx_L24_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
      }
      __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_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "src/lxml/xslt.pxi":113
 * 
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) noexcept with gil:
 *     try:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF((PyObject *)__pyx_v_exception);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "src/lxml/xslt.pxi":128
 * 
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) noexcept 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;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save;
  #endif

  /* "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;

  /* "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
 */
  switch (__pyx_v_c_type) {
    case XSLT_LOAD_DOCUMENT:

    /* "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;

    /* "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
 */
    break;
    case XSLT_LOAD_STYLESHEET:

    /* "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;

    /* "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
 */
    break;
    default:

    /* "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;
  }

  /* "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);
  if (__pyx_t_2) {

    /* "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;

    /* "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(
 */
  }

  /* "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_t_3 = __pyx_f_4lxml_5etree__xslt_resolve_from_python(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_parse_options, (&__pyx_v_error)); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(5, 151, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "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_4 = (__pyx_v_c_doc == NULL);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_error != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

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

    /* "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_2 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_2) {

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

      /* "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)
 * 
 */
    }

    /* "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)
 */
  }

  /* "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);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_2) {

    /* "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;

    /* "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
 */
  }

  /* "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;

  /* "src/lxml/xslt.pxi":128
 * 
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) noexcept nogil:
 */

  /* function exit code */
  __pyx_L1_error:;
  #ifdef WITH_THREAD
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_WriteUnraisable("lxml.etree._xslt_doc_loader", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  __pyx_L0:;
  return __pyx_r;
}

/* "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

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

  /* "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);
  if (unlikely(__pyx_t_1)) {

    /* "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_ERR(5, 193, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":192
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "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:;
  return __pyx_r;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 195, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, 0, "__init__") < 0)) __PYX_ERR(5, 195, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 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_ERR(5, 195, __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_ERR(5, 195, __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_ERR(5, 195, __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_ERR(5, 196, __pyx_L3_error)
    } else {

      /* "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_ERR(5, 196, __pyx_L3_error)
    } else {
      __pyx_v_write_network = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(5, 195, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "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_ERR(5, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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;
}

/* "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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "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);
  if (__pyx_t_1) {

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

    /* "src/lxml/xslt.pxi":212
 * 
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 */
  }

  /* "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 */
}

/* "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
  __Pyx_RefNannySetupContext("_setAccess", 1);

  /* "src/lxml/xslt.pxi":218
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
 */
  if (__pyx_v_allow) {

    /* "src/lxml/xslt.pxi":219
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 *             function = xslt.xsltSecurityAllow             # <<<<<<<<<<<<<<
 *         else:
 *             function = xslt.xsltSecurityForbid
 */
    __pyx_v_function = xsltSecurityAllow;

    /* "src/lxml/xslt.pxi":218
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":221
 *             function = xslt.xsltSecurityAllow
 *         else:
 *             function = xslt.xsltSecurityForbid             # <<<<<<<<<<<<<<
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 */
  /*else*/ {
    __pyx_v_function = xsltSecurityForbid;
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":222
 *         else:
 *             function = xslt.xsltSecurityForbid
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  (void)(xsltSetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option, __pyx_v_function));

  /* "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;
}

/* "src/lxml/xslt.pxi":225
 * 
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         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) {

  /* "src/lxml/xslt.pxi":226
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  (void)(xsltSetCtxtSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_ctxt));

  /* "src/lxml/xslt.pxi":225
 * 
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt) noexcept:             # <<<<<<<<<<<<<<
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 */

  /* function exit code */
}

/* "src/lxml/xslt.pxi":228
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def options(self):
 *         """The access control configuration as a map of options."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xslt.pxi":231
 *     def options(self):
 *         """The access control configuration as a map of options."""
 *         return {             # <<<<<<<<<<<<<<
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/xslt.pxi":232
 *         """The access control configuration as a map of options."""
 *         return {
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),             # <<<<<<<<<<<<<<
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_READ_FILE); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_file, __pyx_t_2) < 0) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":233
 *         return {
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),             # <<<<<<<<<<<<<<
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             '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_ERR(5, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_write_file, __pyx_t_2) < 0) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":234
 *             'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),             # <<<<<<<<<<<<<<
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *             '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_ERR(5, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_create_dir, __pyx_t_2) < 0) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":235
 *             'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),             # <<<<<<<<<<<<<<
 *             '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_ERR(5, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_network, __pyx_t_2) < 0) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":236
 *             'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *             'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *             '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_ERR(5, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_write_network, __pyx_t_2) < 0) __PYX_ERR(5, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":228
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def options(self):
 *         """The access control configuration as a map of options."""
 */

  /* 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;
}

/* "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", 1);

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

  /* "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));
  if (__pyx_t_1) {

    /* "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;

    /* "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:
 */
  }

  /* "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));
  if (__pyx_t_1) {

    /* "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;

    /* "src/lxml/xslt.pxi":245
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  }

  /* "src/lxml/xslt.pxi":248
 *             return False
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "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;
}

/* "src/lxml/xslt.pxi":250
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return "%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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_9genexpr19__pyx_v_item = 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;
  Py_ssize_t __pyx_t_7;
  Py_UCS4 __pyx_t_8;
  const char *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 1);

  /* "src/lxml/xslt.pxi":251
 * 
 *     def __repr__(self):
 *         items = sorted(self.options.items())             # <<<<<<<<<<<<<<
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_6 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(5, 251, __pyx_L1_error)
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":252
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = 0;
  __pyx_t_8 = 127;

  /* "src/lxml/xslt.pxi":253
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],             # <<<<<<<<<<<<<<
 *             ', '.join(["%s=%r" % item for item in items]))
 * 
 */
  __pyx_t_9 = _fqtypename(((PyObject *)__pyx_v_self));
  __pyx_t_10 = __Pyx_ssize_strlen(__pyx_t_9); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(5, 253, __pyx_L1_error)
  __pyx_t_4 = __Pyx_decode_c_string(__pyx_t_9, 0, __pyx_t_10, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyUnicode_Split(__pyx_t_4, __Pyx_NoneAsNull(__pyx_kp_u__4), -1L); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_t_2, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_8;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_kp_u__95);
  __pyx_t_7 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__95);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__95);

  /* "src/lxml/xslt.pxi":254
 *         return "%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 254, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_v_items; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(5, 254, __pyx_L5_error)
        #endif
        if (__pyx_t_10 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(5, 254, __pyx_L5_error)
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 254, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_item, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_r, __pyx_9genexpr19__pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 254, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(5, 254, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_item); __pyx_9genexpr19__pyx_v_item = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_item); __pyx_9genexpr19__pyx_v_item = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__96, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_8;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__61);
  __pyx_t_7 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__61);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__61);

  /* "src/lxml/xslt.pxi":252
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split('.')[-1],
 *             ', '.join(["%s=%r" % item for item in items]))
 */
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 252, __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;

  /* "src/lxml/xslt.pxi":250
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return "%s(%s)" % (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_9genexpr19__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":259
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;

  /* "src/lxml/xslt.pxi":260
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":261
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     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;

    /* "src/lxml/xslt.pxi":260
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
 */
  }

  /* "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;

  /* "src/lxml/xslt.pxi":259
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf) noexcept:             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "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;

  /* "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;

  /* "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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    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};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_namespaces)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 279, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extensions)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 279, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(5, 279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_error_log)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 279, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(5, 279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_enable_regexp)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 279, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(5, 279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_build_smart_strings)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 279, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(5, 279, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(5, 279, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
      values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
      values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
      values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
      values[4] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(5, 279, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_extensions);

  /* "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_2 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extensions); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(5, 281, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "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 = 0;
    if (unlikely(__pyx_v_extensions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(5, 282, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_extensions, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 282, __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_ERR(5, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_ns_name_tuple, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "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, \
 *                         "extensions must not have empty namespaces"
 */
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 == Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "src/lxml/xslt.pxi":284
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \             # <<<<<<<<<<<<<<
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 */
        __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTExtensionError), __pyx_kp_u_extensions_must_not_have_empty_n, 0, 0);
        __PYX_ERR(5, 284, __pyx_L1_error)

        /* "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, \
 *                         "extensions must not have empty namespaces"
 */
      }

      /* "src/lxml/xslt.pxi":286
 *                     raise XSLTExtensionError, \
 *                         "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, __pyx_ptype_4lxml_5etree_XSLTExtension); 
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":287
 *                         "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_1 = (__pyx_v_self->_extension_elements == __pyx_v_4lxml_5etree_EMPTY_DICT);
        if (__pyx_t_1) {

          /* "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_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 288, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_v_self->_extension_elements);
          __Pyx_DECREF(__pyx_v_self->_extension_elements);
          __pyx_v_self->_extension_elements = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;

          /* "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_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_copy); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 289, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_10 = NULL;
          __pyx_t_9 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_9 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
            __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 289, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "src/lxml/xslt.pxi":287
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:             # <<<<<<<<<<<<<<
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 */
        }

        /* "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_8 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 290, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = __pyx_f_4lxml_5etree__utf8(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 290, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "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_7 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __pyx_f_4lxml_5etree__utf8(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "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_ERR(5, 292, __pyx_L1_error)
        }
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns_utf)) __PYX_ERR(5, 292, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name_utf)) __PYX_ERR(5, 292, __pyx_L1_error);
        if (unlikely((PyDict_SetItem(__pyx_v_self->_extension_elements, __pyx_t_8, __pyx_v_extension) < 0))) __PYX_ERR(5, 292, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "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 (unlikely((PyObject_DelItem(__pyx_v_extensions, __pyx_v_ns_name_tuple) < 0))) __PYX_ERR(5, 293, __pyx_L1_error)

        /* "src/lxml/xslt.pxi":286
 *                     raise XSLTExtensionError, \
 *                         "extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):             # <<<<<<<<<<<<<<
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 */
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "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:
 */
  }

  /* "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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__BaseContext), __pyx_n_s_init); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "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_7 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 6+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "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_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "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", 1);

  /* "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_f_4lxml_5etree_12_BaseContext__copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 299, __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;

  /* "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;

  /* "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;

  /* "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;
}

/* "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", 1);

  /* "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;

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

  /* "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_ERR(5, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 310, __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;

  /* "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;
}

/* "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", 1);

  /* "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_ERR(5, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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_ERR(5, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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);
  if (__pyx_t_2) {

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

    /* "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;

    /* "src/lxml/xslt.pxi":315
 *         self._cleanup_context()
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 */
  }

  /* "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_ERR(5, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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;
}

/* "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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strval,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strval)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 329, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(5, 329, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 329, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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__", 1);

  /* "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_ERR(5, 330, __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;

  /* "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;
}

/* "src/lxml/xslt.pxi":367
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/xslt.pxi":368
 * 
 *     def __cinit__(self):
 *         self._c_style = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 */
  __pyx_v_self->_c_style = NULL;

  /* "src/lxml/xslt.pxi":367
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":370
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
 */

/* 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xslt_input,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_access_control,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));

    /* "src/lxml/xslt.pxi":371
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style = NULL
 *         cdef xmlDoc* c_doc
 */
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xslt_input)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 370, __pyx_L3_error)
        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 = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 370, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(5, 370, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 370, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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);

  /* "src/lxml/xslt.pxi":370
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __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;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/xslt.pxi":372
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_doc
 *         cdef _Document doc
 */
  __pyx_v_c_style = NULL;

  /* "src/lxml/xslt.pxi":377
 *         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_ERR(5, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":378
 * 
 *         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_ERR(5, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":381
 * 
 *         # 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_ERR(5, 381, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_access_control;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "src/lxml/xslt.pxi":384
 * 
 *         # 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 == ((xmlDoc *)NULL))) __PYX_ERR(5, 384, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_2;

  /* "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(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 */
  __pyx_t_3 = (__pyx_v_c_doc->URL == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/xslt.pxi":389
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")             # <<<<<<<<<<<<<<
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 * 
 */
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = 0;
    __pyx_t_5 = 127;
    __Pyx_INCREF(__pyx_kp_u_string___STRING__XSLT);
    __pyx_t_4 += 26;
    __Pyx_GIVEREF(__pyx_kp_u_string___STRING__XSLT);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_string___STRING__XSLT);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
    __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u_xslt_2);
    __pyx_t_4 += 5;
    __Pyx_GIVEREF(__pyx_kp_u_xslt_2);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_xslt_2);
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/xslt.pxi":388
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(             # <<<<<<<<<<<<<<
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 */
    __pyx_t_1 = PyUnicode_AsASCIIString(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_doc_url_utf = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xslt.pxi":390
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 *             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));

    /* "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(
 *                 f"string://__STRING__XSLT__/{id(self)}.xslt")
 */
  }

  /* "src/lxml/xslt.pxi":392
 *             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_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "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()'
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__XSLTResolverContext)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":394
 *         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_1 = ((PyObject *)__pyx_v_self->_xslt_resolver_context);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_7 = ((PyObject *)__pyx_v_doc->_parser);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_6 = __pyx_f_4lxml_5etree__initXSLTResolverContext(((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __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;

  /* "src/lxml/xslt.pxi":396
 *         _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 == ((xmlDoc *)NULL))) __PYX_ERR(5, 396, __pyx_L1_error)
  __pyx_v_self->_xslt_resolver_context->_c_style_doc = __pyx_t_2;

  /* "src/lxml/xslt.pxi":397
 *         # 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);

  /* "src/lxml/xslt.pxi":399
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 */
  /*with:*/ {
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->_error_log); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(5, 399, __pyx_L4_error)
    /*try:*/ {
      {
        (void)__pyx_t_10; (void)__pyx_t_11; (void)__pyx_t_12; /* mark used */
        /*try:*/ {

          /* "src/lxml/xslt.pxi":400
 * 
 *         with self._error_log:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *             _reset_document_loader(orig_loader)
 */
          __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

          /* "src/lxml/xslt.pxi":401
 *         with self._error_log:
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 * 
 */
          __pyx_v_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

          /* "src/lxml/xslt.pxi":402
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 * 
 *         if c_style is NULL or c_style.errors:
 */
          __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

          /* "src/lxml/xslt.pxi":399
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 */
        }
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_8) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__38, NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 399, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L14;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L1_error;
    __pyx_L14:;
  }

  /* "src/lxml/xslt.pxi":404
 *             _reset_document_loader(orig_loader)
 * 
 *         if c_style is NULL or c_style.errors:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
 */
  __pyx_t_13 = (__pyx_v_c_style == NULL);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_3 = __pyx_t_13;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_c_style->errors != 0);
  __pyx_t_3 = __pyx_t_13;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_3) {

    /* "src/lxml/xslt.pxi":405
 * 
 *         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);

    /* "src/lxml/xslt.pxi":406
 *         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_3 = (__pyx_v_c_style != NULL);
    if (__pyx_t_3) {

      /* "src/lxml/xslt.pxi":407
 *             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);

      /* "src/lxml/xslt.pxi":406
 *         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()
 */
    }

    /* "src/lxml/xslt.pxi":408
 *             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_9 = ((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_9 == ((int)-1))) __PYX_ERR(5, 408, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":410
 *             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_13 = (__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error != Py_None);
    if (__pyx_t_13) {
    } else {
      __pyx_t_3 = __pyx_t_13;
      goto __pyx_L20_bool_binop_done;
    }

    /* "src/lxml/xslt.pxi":411
 *             # 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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(5, 411, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __pyx_t_13;
    __pyx_L20_bool_binop_done:;

    /* "src/lxml/xslt.pxi":410
 *             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,
 */
    if (unlikely(__pyx_t_3)) {

      /* "src/lxml/xslt.pxi":412
 *             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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "src/lxml/xslt.pxi":413
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise XSLTParseError(
 */
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6)) __PYX_ERR(5, 412, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(5, 412, __pyx_L1_error);
      __pyx_t_6 = 0;

      /* "src/lxml/xslt.pxi":412
 *             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_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTParseError), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(5, 412, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":410
 *             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,
 */
    }

    /* "src/lxml/xslt.pxi":415
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         "Cannot parse stylesheet"),
 */
    /*else*/ {

      /* "src/lxml/xslt.pxi":416
 *             else:
 *                 raise XSLTParseError(
 *                     self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                         "Cannot parse stylesheet"),
 *                     self._error_log)
 */
      __pyx_t_6 = __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_6)) __PYX_ERR(5, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "src/lxml/xslt.pxi":415
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         "Cannot parse stylesheet"),
 */
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6)) __PYX_ERR(5, 415, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(5, 415, __pyx_L1_error);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTParseError), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(5, 415, __pyx_L1_error)
    }

    /* "src/lxml/xslt.pxi":404
 *             _reset_document_loader(orig_loader)
 * 
 *         if c_style is NULL or c_style.errors:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
 */
  }

  /* "src/lxml/xslt.pxi":420
 *                     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;

  /* "src/lxml/xslt.pxi":421
 * 
 *         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;

  /* "src/lxml/xslt.pxi":422
 *         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_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, Py_None)) __PYX_ERR(5, 422, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_extensions)) __PYX_ERR(5, 422, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(5, 422, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_regexp)) __PYX_ERR(5, 422, __pyx_L1_error);
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, Py_True)) __PYX_ERR(5, 422, __pyx_L1_error);
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__XSLTContext), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_context);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_context);
  __pyx_v_self->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/xslt.pxi":370
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style = NULL
 */

  /* 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_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;
}

/* "src/lxml/xslt.pxi":424
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/xslt.pxi":425
 * 
 *     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_2 = (((PyObject *)__pyx_v_self->_xslt_resolver_context) != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":426
 *     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);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "src/lxml/xslt.pxi":425
 * 
 *     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)
 */
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":427
 *         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);

    /* "src/lxml/xslt.pxi":425
 * 
 *     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)
 */
  }

  /* "src/lxml/xslt.pxi":429
 *             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_1 = (__pyx_v_self->_c_style != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":430
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 *             xslt.xsltFreeStylesheet(self._c_style)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    xsltFreeStylesheet(__pyx_v_self->_c_style);

    /* "src/lxml/xslt.pxi":429
 *             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)
 * 
 */
  }

  /* "src/lxml/xslt.pxi":424
 *         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 */
}

/* "src/lxml/xslt.pxi":432
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xslt.pxi":435
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
 *         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_ERR(5, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":432
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of errors and warnings of an XSLT execution."""
 */

  /* 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;
}

/* "src/lxml/xslt.pxi":437
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"strparam", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_7strparam, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_6strparam};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_strval = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strval,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_strval)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 437, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "strparam") < 0)) __PYX_ERR(5, 437, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strparam", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 437, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strparam", 1);

  /* "src/lxml/xslt.pxi":449
 *         Escaped string parameters can be reused without restriction.
 *         """
 *         return _XSLTQuotedStringParam(strval)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam), __pyx_v_strval); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":437
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
 */

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

/* "src/lxml/xslt.pxi":451
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 = {"set_global_max_depth", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_max_depth;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_depth,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_depth)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 451, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_global_max_depth") < 0)) __PYX_ERR(5, 451, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_max_depth = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_max_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 452, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_global_max_depth", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 451, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "src/lxml/xslt.pxi":467
 *         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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":468
 *         """
 *         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__97, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 468, __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_ERR(5, 468, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":467
 *         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
 */
  }

  /* "src/lxml/xslt.pxi":469
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth             # <<<<<<<<<<<<<<
 * 
 *     def tostring(self, _ElementTree result_tree):
 */
  xsltMaxDepth = __pyx_v_max_depth;

  /* "src/lxml/xslt.pxi":451
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """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;
}

/* "src/lxml/xslt.pxi":471
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11tostring(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_10tostring, "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 PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_11tostring = {"tostring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_11tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_10tostring};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11tostring(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct LxmlElementTree *__pyx_v_result_tree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result_tree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result_tree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 471, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tostring") < 0)) __PYX_ERR(5, 471, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_result_tree = ((struct LxmlElementTree *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 471, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result_tree), __pyx_ptype_4lxml_5etree__ElementTree, 1, "result_tree", 0))) __PYX_ERR(5, 471, __pyx_L1_error)
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_10tostring(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_result_tree);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_10tostring(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 1);

  /* "src/lxml/xslt.pxi":478
 *         :deprecated: use str(result_tree) instead.
 *         """
 *         return str(result_tree)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_Str(((PyObject *)__pyx_v_result_tree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":471
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
 */

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

/* "src/lxml/xslt.pxi":480
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_13__deepcopy__ = {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_memo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_memo)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 480, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__deepcopy__") < 0)) __PYX_ERR(5, 480, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_memo = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 480, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.XSLT.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_12__deepcopy__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_memo);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_12__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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 1);

  /* "src/lxml/xslt.pxi":481
 * 
 *     def __deepcopy__(self, memo):
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 481, __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;

  /* "src/lxml/xslt.pxi":480
 *         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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/xslt.pxi":483
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_15__copy__ = {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_14__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_14__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__", 1);

  /* "src/lxml/xslt.pxi":484
 * 
 *     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_ERR(5, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":483
 *         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;
}

/* "src/lxml/xslt.pxi":486
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         """__call__(self, _input, profile_run=False, **kw)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_4XSLT_16__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_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input,&__pyx_n_s_profile_run,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_input)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 486, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 486, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kw, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(5, 486, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 486, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_16__call__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v__input, __pyx_v_profile_run, __pyx_v_kw);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_kw);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  xmlDict *__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_t_15;
  Py_ssize_t __pyx_t_16;
  Py_UCS4 __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  char const *__pyx_t_19;
  int __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/xslt.pxi":495
 *         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);

  /* "src/lxml/xslt.pxi":500
 *         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);

  /* "src/lxml/xslt.pxi":503
 *         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;

  /* "src/lxml/xslt.pxi":506
 *         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;

  /* "src/lxml/xslt.pxi":508
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_style != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XSLT_stylesheet_not_initialised, 0, 0);
      __PYX_ERR(5, 508, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(5, 508, __pyx_L1_error)
  #endif

  /* "src/lxml/xslt.pxi":509
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(_input)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_input_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":510
 *         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_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":512
 *         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_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_input_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(5, 512, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/xslt.pxi":514
 *         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);

  /* "src/lxml/xslt.pxi":515
 * 
 *         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_1 = (__pyx_v_transform_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":516
 *         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);

    /* "src/lxml/xslt.pxi":517
 *         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_ERR(5, 517, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":515
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()
 */
  }

  /* "src/lxml/xslt.pxi":523
 *         # 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_1 = (__pyx_v_transform_ctxt->dict != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":524
 *         # 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);

    /* "src/lxml/xslt.pxi":523
 *         # 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:
 */
  }

  /* "src/lxml/xslt.pxi":525
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_kw); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(5, 525, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":528
 *             # 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);

    /* "src/lxml/xslt.pxi":529
 *             # => 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_1 = (__pyx_v_transform_ctxt->dict == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xslt.pxi":530
 *             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);

      /* "src/lxml/xslt.pxi":531
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
 */
      PyErr_NoMemory(); __PYX_ERR(5, 531, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":529
 *             # => 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()
 */
    }

    /* "src/lxml/xslt.pxi":525
 *         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
 */
    goto __pyx_L5;
  }

  /* "src/lxml/xslt.pxi":533
 *                 raise MemoryError()
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_self->_c_style->doc->dict;
    __pyx_v_transform_ctxt->dict = __pyx_t_4;

    /* "src/lxml/xslt.pxi":534
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
 *             xmlparser.xmlDictReference(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *         xslt.xsltSetCtxtParseOptions(
 */
    (void)(xmlDictReference(__pyx_v_transform_ctxt->dict));
  }
  __pyx_L5:;

  /* "src/lxml/xslt.pxi":536
 *             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);

  /* "src/lxml/xslt.pxi":539
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_profile_run); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(5, 539, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":540
 * 
 *         if profile_run:
 *             transform_ctxt.profile = 1             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_v_transform_ctxt->profile = 1;

    /* "src/lxml/xslt.pxi":539
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
 */
  }

  /* "src/lxml/xslt.pxi":542
 *             transform_ctxt.profile = 1
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)
 */
  /*try:*/ {

    /* "src/lxml/xslt.pxi":543
 * 
 *         try:
 *             context = self._context._copy()             # <<<<<<<<<<<<<<
 *             context.register_context(transform_ctxt, input_doc)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 543, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__XSLTContext))))) __PYX_ERR(5, 543, __pyx_L9_error)
    __Pyx_DECREF_SET(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":544
 *         try:
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)             # <<<<<<<<<<<<<<
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_XSLTContext_register_context(__pyx_v_context, __pyx_v_transform_ctxt, __pyx_v_input_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 544, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":546
 *             context.register_context(transform_ctxt, input_doc)
 * 
 *             resolver_context = self._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_self->_xslt_resolver_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 546, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":547
 * 
 *             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);

    /* "src/lxml/xslt.pxi":549
 *             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_2 = __pyx_f_4lxml_5etree__convert_xslt_parameters(__pyx_v_transform_ctxt, __pyx_v_kw, (&__pyx_v_params)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 549, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":550
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)
 *             c_result = self._run_transform(             # <<<<<<<<<<<<<<
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:
 */
    __pyx_t_3 = ((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); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 550, __pyx_L9_error)
    __pyx_v_c_result = __pyx_t_3;

    /* "src/lxml/xslt.pxi":552
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 */
    __pyx_t_1 = (__pyx_v_params != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":554
 *             if params is not NULL:
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 */
      lxml_free(__pyx_v_params);

      /* "src/lxml/xslt.pxi":552
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.lxml_free(params)
 */
    }

    /* "src/lxml/xslt.pxi":556
 *                 python.lxml_free(params)
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_1 = (__pyx_v_transform_ctxt->state != XSLT_STATE_OK);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":557
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":558
 *             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);

        /* "src/lxml/xslt.pxi":559
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.profile:
 */
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":557
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      }

      /* "src/lxml/xslt.pxi":556
 *                 python.lxml_free(params)
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    }

    /* "src/lxml/xslt.pxi":561
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 */
    __pyx_t_1 = (__pyx_v_transform_ctxt->profile != 0);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":562
 * 
 *             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);

      /* "src/lxml/xslt.pxi":563
 *             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_1 = (__pyx_v_c_profile_doc != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":565
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             if context is not None:
 */
        __pyx_t_2 = ((PyObject *)__pyx_v_input_doc->_parser);
        __Pyx_INCREF(__pyx_t_2);

        /* "src/lxml/xslt.pxi":564
 *                 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_2))); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 564, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_profile_doc, ((struct LxmlDocument *)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "src/lxml/xslt.pxi":563
 *             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)
 */
      }

      /* "src/lxml/xslt.pxi":561
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 */
    }
  }

  /* "src/lxml/xslt.pxi":567
 *                         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_1 = (((PyObject *)__pyx_v_context) != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":568
 *         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_ERR(5, 568, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "src/lxml/xslt.pxi":567
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
      }

      /* "src/lxml/xslt.pxi":569
 *             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;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_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;
      {

        /* "src/lxml/xslt.pxi":567
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
        __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":568
 *         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_ERR(5, 568, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "src/lxml/xslt.pxi":567
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
        }

        /* "src/lxml/xslt.pxi":569
 *             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_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_L18_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_L10:;
  }

  /* "src/lxml/xslt.pxi":571
 *             _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:*/ {

    /* "src/lxml/xslt.pxi":572
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_15 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
    if (__pyx_t_15) {
    } else {
      __pyx_t_1 = __pyx_t_15;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_t_15 = ((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)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(5, 572, __pyx_L21_error)
    __pyx_t_1 = __pyx_t_15;
    __pyx_L24_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":573
 *         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_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":574
 *             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);

        /* "src/lxml/xslt.pxi":575
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 resolver_context._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":573
 *         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
 */
      }

      /* "src/lxml/xslt.pxi":576
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if context._exc._has_raised():
 */
      __pyx_t_7 = ((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_7 == ((int)-1))) __PYX_ERR(5, 576, __pyx_L21_error)

      /* "src/lxml/xslt.pxi":572
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    }

    /* "src/lxml/xslt.pxi":578
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_has_raised(__pyx_v_context->__pyx_base._exc); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 578, __pyx_L21_error)
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":579
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_1 = (__pyx_v_c_result != NULL);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":580
 *             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);

        /* "src/lxml/xslt.pxi":581
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 context._exc._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;

        /* "src/lxml/xslt.pxi":579
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      }

      /* "src/lxml/xslt.pxi":582
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if c_result is NULL:
 */
      __pyx_t_7 = ((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_7 == ((int)-1))) __PYX_ERR(5, 582, __pyx_L21_error)

      /* "src/lxml/xslt.pxi":578
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    }

    /* "src/lxml/xslt.pxi":584
 *                 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_1 = (__pyx_v_c_result == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":586
 *             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;

      /* "src/lxml/xslt.pxi":587
 *                 # 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 = f"{error.message}, line {error.line}"
 */
      __pyx_t_15 = (__pyx_v_error != Py_None);
      if (__pyx_t_15) {
      } else {
        __pyx_t_1 = __pyx_t_15;
        goto __pyx_L31_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 587, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(5, 587, __pyx_L21_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_15;
      __pyx_L31_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":588
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 588, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 588, __pyx_L21_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(5, 588, __pyx_L21_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":589
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 *                         message = f"{error.message}, line {error.line}"             # <<<<<<<<<<<<<<
 *                     else:
 *                         message = error.message
 */
          __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_16 = 0;
          __pyx_t_17 = 127;
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_17;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18);
          __Pyx_GIVEREF(__pyx_t_18);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
          __pyx_t_18 = 0;
          __Pyx_INCREF(__pyx_kp_u_line);
          __pyx_t_16 += 7;
          __Pyx_GIVEREF(__pyx_kp_u_line);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_line);
          __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_18);
          __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_18, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_17;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 589, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_message = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "src/lxml/xslt.pxi":588
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
 */
          goto __pyx_L33;
        }

        /* "src/lxml/xslt.pxi":591
 *                         message = f"{error.message}, line {error.line}"
 *                     else:
 *                         message = error.message             # <<<<<<<<<<<<<<
 *                 elif error is not None and error.line > 0:
 *                     message = f"Error applying stylesheet, line {error.line}"
 */
        /*else*/ {
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 591, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_v_message = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __pyx_L33:;

        /* "src/lxml/xslt.pxi":587
 *                 # 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 = f"{error.message}, line {error.line}"
 */
        goto __pyx_L30;
      }

      /* "src/lxml/xslt.pxi":592
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
 */
      __pyx_t_15 = (__pyx_v_error != Py_None);
      if (__pyx_t_15) {
      } else {
        __pyx_t_1 = __pyx_t_15;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 592, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 592, __pyx_L21_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(5, 592, __pyx_L21_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __pyx_t_15;
      __pyx_L34_bool_binop_done:;
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":593
 *                         message = error.message
 *                 elif error is not None and error.line > 0:
 *                     message = f"Error applying stylesheet, line {error.line}"             # <<<<<<<<<<<<<<
 *                 else:
 *                     message = "Error applying stylesheet"
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 593, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 593, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_applying_stylesheet_line, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 593, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_message = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "src/lxml/xslt.pxi":592
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
 */
        goto __pyx_L30;
      }

      /* "src/lxml/xslt.pxi":595
 *                     message = f"Error applying stylesheet, line {error.line}"
 *                 else:
 *                     message = "Error applying stylesheet"             # <<<<<<<<<<<<<<
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_kp_u_Error_applying_stylesheet);
        __pyx_v_message = __pyx_kp_u_Error_applying_stylesheet;
      }
      __pyx_L30:;

      /* "src/lxml/xslt.pxi":596
 *                 else:
 *                     message = "Error applying stylesheet"
 *                 raise XSLTApplyError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if resolver_context is not None:
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 596, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message)) __PYX_ERR(5, 596, __pyx_L21_error);
      __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(5, 596, __pyx_L21_error);
      __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTApplyError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 596, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(5, 596, __pyx_L21_error)

      /* "src/lxml/xslt.pxi":584
 *                 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
 */
    }
  }

  /* "src/lxml/xslt.pxi":598
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
      if (__pyx_t_1) {

        /* "src/lxml/xslt.pxi":599
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 */
        __pyx_t_7 = ((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)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(5, 599, __pyx_L1_error)

        /* "src/lxml/xslt.pxi":598
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
      }
      goto __pyx_L22;
    }
    __pyx_L21_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      __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_XGOTREF(__pyx_t_9);
      __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
      {
        __pyx_t_1 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
        if (__pyx_t_1) {

          /* "src/lxml/xslt.pxi":599
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 */
          __pyx_t_20 = ((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)); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(5, 599, __pyx_L38_error)

          /* "src/lxml/xslt.pxi":598
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
        }
      }
      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_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_19;
      goto __pyx_L1_error;
      __pyx_L38_error:;
      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_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L22:;
  }

  /* "src/lxml/xslt.pxi":601
 *                 resolver_context.clear()
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)             # <<<<<<<<<<<<<<
 * 
 *         c_dict = c_result.dict
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_input_doc->_parser);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_result, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_5))); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":603
 *         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;

  /* "src/lxml/xslt.pxi":604
 * 
 *         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 \
 */
  (void)(xmlDictReference(__pyx_v_c_dict));

  /* "src/lxml/xslt.pxi":605
 *         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_t_6 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, (&__pyx_v_c_result->dict)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(5, 605, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":606
 *         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_15 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
  if (!__pyx_t_15) {
  } else {
    __pyx_t_1 = __pyx_t_15;
    goto __pyx_L41_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":607
 *         __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_15 = (__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict);
  if (!__pyx_t_15) {
  } else {
    __pyx_t_1 = __pyx_t_15;
    goto __pyx_L41_bool_binop_done;
  }

  /* "src/lxml/xslt.pxi":608
 *         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_15 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
  __pyx_t_1 = __pyx_t_15;
  __pyx_L41_bool_binop_done:;

  /* "src/lxml/xslt.pxi":606
 *         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:
 */
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":609
 *                 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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xslt.pxi":610
 *                 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_1 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":611
 *             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);

            /* "src/lxml/xslt.pxi":610
 *                 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)
 */
          }

          /* "src/lxml/xslt.pxi":613
 *                     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_1 = (__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":614
 *                                        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);

            /* "src/lxml/xslt.pxi":613
 *                     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)
 */
          }

          /* "src/lxml/xslt.pxi":616
 *                     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_1 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
          if (__pyx_t_1) {

            /* "src/lxml/xslt.pxi":617
 *                                        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);

            /* "src/lxml/xslt.pxi":616
 *                     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)
 */
          }
        }

        /* "src/lxml/xslt.pxi":609
 *                 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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L46;
          }
          __pyx_L46:;
        }
    }

    /* "src/lxml/xslt.pxi":606
 *         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:
 */
  }

  /* "src/lxml/xslt.pxi":619
 *                     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);

  /* "src/lxml/xslt.pxi":621
 *         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_2 = __pyx_f_4lxml_5etree__xsltResultTreeFactory(__pyx_v_result_doc, __pyx_v_self, __pyx_v_profile_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":486
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         """__call__(self, _input, profile_run=False, **kw)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_18);
  __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;
}

/* "src/lxml/xslt.pxi":623
 *         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;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  xmlDoc *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_run_transform", 1);

  /* "src/lxml/xslt.pxi":627
 *                                 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));

  /* "src/lxml/xslt.pxi":629
 *         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 self._error_log, nogil:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_access_control) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":630
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)             # <<<<<<<<<<<<<<
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()
 */
    __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(__pyx_v_self->_access_control, __pyx_v_transform_ctxt);

    /* "src/lxml/xslt.pxi":629
 *         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 self._error_log, nogil:
 */
  }

  /* "src/lxml/xslt.pxi":631
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(
 */
  /*with:*/ {
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->_error_log); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(5, 631, __pyx_L4_error)
    /*try:*/ {
      {
        (void)__pyx_t_4; (void)__pyx_t_5; (void)__pyx_t_6; /* mark used */
        /*try:*/ {
          {
              #ifdef WITH_THREAD
              PyThreadState *_save;
              _save = NULL;
              Py_UNBLOCK_THREADS
              __Pyx_FastGIL_Remember();
              #endif
              /*try:*/ {

                /* "src/lxml/xslt.pxi":632
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 */
                __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

                /* "src/lxml/xslt.pxi":633
 *         with self._error_log, nogil:
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(             # <<<<<<<<<<<<<<
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)
 */
                __pyx_v_c_result = xsltApplyStylesheetUser(__pyx_v_self->_c_style, __pyx_v_c_input_doc, __pyx_v_params, NULL, NULL, __pyx_v_transform_ctxt);

                /* "src/lxml/xslt.pxi":635
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         return c_result
 * 
 */
                __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
              }

              /* "src/lxml/xslt.pxi":631
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with self._error_log, nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             c_result = xslt.xsltApplyStylesheetUser(
 */
              /*finally:*/ {
                /*normal exit:*/{
                  #ifdef WITH_THREAD
                  __Pyx_FastGIL_Forget();
                  Py_BLOCK_THREADS
                  #endif
                  goto __pyx_L16;
                }
                __pyx_L16:;
              }
          }
        }
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__38, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 631, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L17;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "src/lxml/xslt.pxi":636
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *             _reset_document_loader(orig_loader)
 *         return c_result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_result;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":623
 *         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_L1_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT._run_transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":639
 * 
 * 
 * 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;
  Py_ssize_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_xslt_parameters", 1);

  /* "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;

  /* "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;

  /* "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_ERR(5, 645, __pyx_L1_error)
  }
  __pyx_t_2 = PyDict_Size(__pyx_v_parameters); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(5, 645, __pyx_L1_error)
  __pyx_v_parameter_count = __pyx_t_2;

  /* "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);
  if (__pyx_t_3) {

    /* "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;

    /* "src/lxml/xslt.pxi":646
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:             # <<<<<<<<<<<<<<
 *         return
 *     # allocate space for parameters
 */
  }

  /* "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.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))             # <<<<<<<<<<<<<<
 *     if not params:
 *         raise MemoryError()
 */
  __pyx_v_params = ((const char **)lxml_malloc(((__pyx_v_parameter_count * 2) + 1), (sizeof(const char *))));

  /* "src/lxml/xslt.pxi":652
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
 */
  __pyx_t_3 = (!(__pyx_v_params != 0));
  if (unlikely(__pyx_t_3)) {

    /* "src/lxml/xslt.pxi":653
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     try:
 *         i = 0
 */
    PyErr_NoMemory(); __PYX_ERR(5, 653, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":652
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.lxml_malloc(parameter_count * 2 + 1, sizeof(const_char*))
 *     if not params:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
 */
  }

  /* "src/lxml/xslt.pxi":654
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "src/lxml/xslt.pxi":655
 *         raise MemoryError()
 *     try:
 *         i = 0             # <<<<<<<<<<<<<<
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 */
      __pyx_v_i = 0;

      /* "src/lxml/xslt.pxi":656
 *     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 '%.30s'", "iteritems");
        __PYX_ERR(5, 656, __pyx_L5_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_ERR(5, 656, __pyx_L5_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_ERR(5, 656, __pyx_L5_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;

        /* "src/lxml/xslt.pxi":657
 *         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_ERR(5, 657, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_11));
        __pyx_t_11 = 0;

        /* "src/lxml/xslt.pxi":658
 *         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, __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam); 
        if (__pyx_t_3) {

          /* "src/lxml/xslt.pxi":659
 *             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;

          /* "src/lxml/xslt.pxi":660
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(             # <<<<<<<<<<<<<<
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 */
          (void)(xsltQuoteOneUserParam(__pyx_v_transform_ctxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v)));

          /* "src/lxml/xslt.pxi":658
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):             # <<<<<<<<<<<<<<
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
 */
          goto __pyx_L13;
        }

        /* "src/lxml/xslt.pxi":663
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
 */
        /*else*/ {
          __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_4lxml_5etree_XPath); 
          if (__pyx_t_3) {

            /* "src/lxml/xslt.pxi":664
 *             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;

            /* "src/lxml/xslt.pxi":663
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
 */
            goto __pyx_L14;
          }

          /* "src/lxml/xslt.pxi":666
 *                     v = (<XPath>value)._path
 *                 else:
 *                     v = _utf8(value)             # <<<<<<<<<<<<<<
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(k), len(k))
 *                 i += 1
 */
          /*else*/ {
            __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 666, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;
          }
          __pyx_L14:;

          /* "src/lxml/xslt.pxi":667
 *                 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_ERR(5, 667, __pyx_L5_error)
          }
          __pyx_t_13 = __Pyx_PyBytes_GET_SIZE(__pyx_v_k); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(5, 667, __pyx_L5_error)
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), __pyx_t_13));

          /* "src/lxml/xslt.pxi":668
 *                     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);

          /* "src/lxml/xslt.pxi":669
 *                 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_ERR(5, 669, __pyx_L5_error)
          }
          __pyx_t_13 = __Pyx_PyBytes_GET_SIZE(__pyx_v_v); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(5, 669, __pyx_L5_error)
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v), __pyx_t_13));

          /* "src/lxml/xslt.pxi":670
 *                 i += 1
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 *                 i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.lxml_free(params)
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }
        __pyx_L13:;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "src/lxml/xslt.pxi":654
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
 */
    }
    __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_L5_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;

    /* "src/lxml/xslt.pxi":671
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 *                 i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.lxml_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_ERR(5, 671, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "src/lxml/xslt.pxi":672
 *                 i += 1
 *     except:
 *         python.lxml_free(params)             # <<<<<<<<<<<<<<
 *         raise
 *     params[i] = NULL
 */
      lxml_free(__pyx_v_params);

      /* "src/lxml/xslt.pxi":673
 *     except:
 *         python.lxml_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_ErrRestoreWithState(__pyx_t_7, __pyx_t_11, __pyx_t_10);
      __pyx_t_7 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; 
      __PYX_ERR(5, 673, __pyx_L7_except_error)
    }

    /* "src/lxml/xslt.pxi":654
 *     if not params:
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
 */
    __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_L10_try_end:;
  }

  /* "src/lxml/xslt.pxi":674
 *         python.lxml_free(params)
 *         raise
 *     params[i] = NULL             # <<<<<<<<<<<<<<
 *     params_ptr[0] = params
 * 
 */
  (__pyx_v_params[__pyx_v_i]) = NULL;

  /* "src/lxml/xslt.pxi":675
 *         raise
 *     params[i] = NULL
 *     params_ptr[0] = params             # <<<<<<<<<<<<<<
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):
 */
  (__pyx_v_params_ptr[0]) = __pyx_v_params;

  /* "src/lxml/xslt.pxi":639
 * 
 * 
 * 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;
}

/* "src/lxml/xslt.pxi":677
 *     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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyXSLT", 1);

  /* "src/lxml/xslt.pxi":680
 *     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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_stylesheet->_c_style != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XSLT_stylesheet_not_initialised, 0, 0);
      __PYX_ERR(5, 680, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(5, 680, __pyx_L1_error)
  #endif

  /* "src/lxml/xslt.pxi":681
 *     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_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree_XSLT(((PyTypeObject *)__pyx_ptype_4lxml_5etree_XSLT), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 681, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":682
 *     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_2 = ((PyObject *)__pyx_v_stylesheet->_access_control);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":683
 *     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_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":684
 *     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_2 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(__pyx_v_stylesheet->_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 684, __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__XSLTContext))))) __PYX_ERR(5, 684, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":686
 *     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_2 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_stylesheet->_xslt_resolver_context)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF((PyObject *)__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_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":687
 * 
 *     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_3 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_xslt_resolver_context->_c_style_doc, 1); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(5, 687, __pyx_L1_error)
  __pyx_v_new_xslt->_xslt_resolver_context->_c_style_doc = __pyx_t_3;

  /* "src/lxml/xslt.pxi":690
 *         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_3 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_c_style->doc, 1); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(5, 690, __pyx_L1_error)
  __pyx_v_c_doc = __pyx_t_3;

  /* "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)
 */
  __pyx_v_new_xslt->_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

  /* "src/lxml/xslt.pxi":692
 *     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_1 = (__pyx_v_new_xslt->_c_style == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":693
 *     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);

    /* "src/lxml/xslt.pxi":694
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     return new_xslt
 */
    PyErr_NoMemory(); __PYX_ERR(5, 694, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":692
 *     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()
 */
  }

  /* "src/lxml/xslt.pxi":696
 *         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;

  /* "src/lxml/xslt.pxi":677
 *     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_2);
  __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;
}

/* "src/lxml/xslt.pxi":711
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output, "write_output(self, file, *, compression=0)\n\n        Serialise the XSLT output to a file or file-like object.\n\n        As opposed to the generic ``.write()`` method, ``.write_output()`` serialises\n        the result as defined by the ``<xsl:output>`` tag.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_15_XSLTResultTree_1write_output = {"write_output", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output};
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_compression = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_output (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_compression,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 711, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 711, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_output") < 0)) __PYX_ERR(5, 711, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_file = values[0];
    __pyx_v_compression = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_output", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 711, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.write_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), __pyx_v_file, __pyx_v_compression);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_write_output(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_v_r;
  int __pyx_v_rclose;
  CYTHON_UNUSED int __pyx_v_c_compression;
  const xmlChar *__pyx_v_c_encoding;
  xmlOutputBuffer *__pyx_v_c_buffer;
  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_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_output", 1);

  /* "src/lxml/xslt.pxi":719
 *         the result as defined by the ``<xsl:output>`` tag.
 *         """
 *         cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r, rclose, c_compression
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "src/lxml/xslt.pxi":722
 *         cdef _Document doc
 *         cdef int r, rclose, c_compression
 *         cdef const_xmlChar* c_encoding = NULL             # <<<<<<<<<<<<<<
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
 */
  __pyx_v_c_encoding = NULL;

  /* "src/lxml/xslt.pxi":725
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":726
 * 
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":725
 *         cdef tree.xmlOutputBuffer* c_buffer
 * 
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":728
 *             doc = self._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_doc = ((struct LxmlDocument *)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":729
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":730
 *             doc = None
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":731
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xslt.pxi":732
 *             doc = self._doc
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")             # <<<<<<<<<<<<<<
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_XSLTSaveError); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_No_document_to_serialise};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 732, __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_ERR(5, 732, __pyx_L1_error)

      /* "src/lxml/xslt.pxi":731
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
 */
    }

    /* "src/lxml/xslt.pxi":729
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  }

  /* "src/lxml/xslt.pxi":733
 *             if doc is None:
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0             # <<<<<<<<<<<<<<
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compression); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(5, 733, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 733, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = 0;
  __pyx_L6_bool_binop_done:;
  __pyx_v_c_compression = __pyx_t_5;

  /* "src/lxml/xslt.pxi":734
 *                 raise XSLTSaveError("No document to serialise")
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 *         if writer is None:
 */
  LXML_GET_XSLT_ENCODING(__pyx_v_c_encoding, __pyx_v_self->_xslt->_c_style);

  /* "src/lxml/xslt.pxi":735
 *         c_compression = compression or 0
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)             # <<<<<<<<<<<<<<
 *         if writer is None:
 *             with nogil:
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 735, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_file, ((const char *)__pyx_v_c_encoding), __pyx_t_5, (&__pyx_v_c_buffer), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":736
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 *         if writer is None:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_writer) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":737
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 *         if writer is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xslt.pxi":738
 *         if writer is None:
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 *         else:
 */
          __pyx_v_r = xsltSaveResultTo(__pyx_v_c_buffer, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);

          /* "src/lxml/xslt.pxi":739
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 */
          __pyx_v_rclose = xmlOutputBufferClose(__pyx_v_c_buffer);
        }

        /* "src/lxml/xslt.pxi":737
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 *         if writer is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "src/lxml/xslt.pxi":736
 *         xslt.LXML_GET_XSLT_ENCODING(c_encoding, self._xslt._c_style)
 *         writer = _create_output_buffer(file, <const_char*>c_encoding, compression, &c_buffer, close=False)
 *         if writer is None:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 */
    goto __pyx_L8;
  }

  /* "src/lxml/xslt.pxi":741
 *                 rclose = tree.xmlOutputBufferClose(c_buffer)
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)             # <<<<<<<<<<<<<<
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:
 */
  /*else*/ {
    __pyx_v_r = xsltSaveResultTo(__pyx_v_c_buffer, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);

    /* "src/lxml/xslt.pxi":742
 *         else:
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
 */
    __pyx_v_rclose = xmlOutputBufferClose(__pyx_v_c_buffer);
  }
  __pyx_L8:;

  /* "src/lxml/xslt.pxi":743
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":744
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *         if r < 0 or rclose == -1:
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 */
    __pyx_t_5 = ((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_5 == ((int)-1))) __PYX_ERR(5, 744, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":743
 *             r = xslt.xsltSaveResultTo(c_buffer, doc._c_doc, self._xslt._c_style)
 *             rclose = tree.xmlOutputBufferClose(c_buffer)
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
 */
  }

  /* "src/lxml/xslt.pxi":745
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:             # <<<<<<<<<<<<<<
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 */
  __pyx_t_7 = (__pyx_v_r < 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_rclose == -1L);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":746
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError             # <<<<<<<<<<<<<<
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):
 */
    __pyx_t_2 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":745
 *         if writer is not None:
 *             writer._exc_context._raise_if_stored()
 *         if r < 0 or rclose == -1:             # <<<<<<<<<<<<<<
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 */
  }

  /* "src/lxml/xslt.pxi":711
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.write_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":748
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 *     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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_saveToStringAndSize", 1);

  /* "src/lxml/xslt.pxi":751
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":752
 *         cdef int r
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":751
 *         cdef _Document doc
 *         cdef int r
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xslt.pxi":754
 *             doc = self._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_doc = ((struct LxmlDocument *)Py_None);
  }
  __pyx_L3:;

  /* "src/lxml/xslt.pxi":755
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":756
 *             doc = None
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 s[0] = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "src/lxml/xslt.pxi":757
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":758
 *             doc = self._doc
 *             if doc is None:
 *                 s[0] = NULL             # <<<<<<<<<<<<<<
 *                 return
 *         with nogil:
 */
      (__pyx_v_s[0]) = NULL;

      /* "src/lxml/xslt.pxi":759
 *             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;

      /* "src/lxml/xslt.pxi":757
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
 */
    }

    /* "src/lxml/xslt.pxi":755
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  }

  /* "src/lxml/xslt.pxi":760
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/xslt.pxi":761
 *                 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);
      }

      /* "src/lxml/xslt.pxi":760
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "src/lxml/xslt.pxi":763
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_1 = (__pyx_v_r == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":764
 *                                             self._xslt._c_style)
 *         if r == -1:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    PyErr_NoMemory(); __PYX_ERR(5, 764, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":763
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "src/lxml/xslt.pxi":748
 *             python.PyErr_SetFromErrno(IOError)  # raises IOError
 * 
 *     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_2);
  __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;
}

/* "src/lxml/xslt.pxi":766
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_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("__str__", 1);

  /* "src/lxml/xslt.pxi":768
 *     def __str__(self):
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 */
  __pyx_v_s = NULL;

  /* "src/lxml/xslt.pxi":769
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 */
  __pyx_v_l = 0;

  /* "src/lxml/xslt.pxi":770
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return ''
 */
  __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_ERR(5, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/xslt.pxi":771
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         encoding = self._xslt._c_style.encoding
 */
  __pyx_t_2 = (__pyx_v_s == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":772
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return ''             # <<<<<<<<<<<<<<
 *         encoding = self._xslt._c_style.encoding
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_r = __pyx_kp_u__12;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":771
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         encoding = self._xslt._c_style.encoding
 */
  }

  /* "src/lxml/xslt.pxi":773
 *         if s is NULL:
 *             return ''
 *         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;

  /* "src/lxml/xslt.pxi":774
 *             return ''
 *         encoding = self._xslt._c_style.encoding
 *         try:             # <<<<<<<<<<<<<<
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')
 */
  /*try:*/ {

    /* "src/lxml/xslt.pxi":775
 *         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);
    if (__pyx_t_2) {

      /* "src/lxml/xslt.pxi":776
 *         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 const *)__pyx_v_s), 0, __pyx_v_l, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 776, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "src/lxml/xslt.pxi":775
 *         encoding = self._xslt._c_style.encoding
 *         try:
 *             if encoding is NULL:             # <<<<<<<<<<<<<<
 *                 result = s[:l].decode('UTF-8')
 *             else:
 */
      goto __pyx_L7;
    }

    /* "src/lxml/xslt.pxi":778
 *                 result = s[:l].decode('UTF-8')
 *             else:
 *                 result = s[:l].decode(encoding)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_decode_c_string(((char const *)__pyx_v_s), 0, __pyx_v_l, ((char const *)__pyx_v_encoding), NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 778, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L7:;
  }

  /* "src/lxml/xslt.pxi":780
 *                 result = s[:l].decode(encoding)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return _stripEncodingDeclaration(result)
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_s);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:;
  }

  /* "src/lxml/xslt.pxi":781
 *         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_ERR(5, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/xslt.pxi":766
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 */

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

/* "src/lxml/xslt.pxi":783
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if buffer is NULL:
 */

/* Python wrapper */
CYTHON_UNUSED static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__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_4__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;
  xmlChar *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_buffer == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_buffer->obj);

  /* "src/lxml/xslt.pxi":784
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */
  __pyx_v_l = 0;

  /* "src/lxml/xslt.pxi":785
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":786
 *         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;

    /* "src/lxml/xslt.pxi":785
 *     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:
 */
  }

  /* "src/lxml/xslt.pxi":787
 *         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_2 = (__pyx_v_self->_buffer == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":788
 *             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_ERR(5, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":789
 *         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;

    /* "src/lxml/xslt.pxi":790
 *             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);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (!((__pyx_v_flags & PyBUF_WRITABLE) != 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":791
 *             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);

      /* "src/lxml/xslt.pxi":792
 *             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;

      /* "src/lxml/xslt.pxi":793
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.buf = self._buffer
 */
      __pyx_v_self->_buffer_refcnt = 1;

      /* "src/lxml/xslt.pxi":790
 *             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
 */
    }

    /* "src/lxml/xslt.pxi":787
 *         if buffer is NULL:
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
 */
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":795
 *                 self._buffer_refcnt = 1
 *         else:
 *             buffer.buf = self._buffer             # <<<<<<<<<<<<<<
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_self->_buffer;
    __pyx_v_buffer->buf = __pyx_t_4;

    /* "src/lxml/xslt.pxi":796
 *         else:
 *             buffer.buf = self._buffer
 *             buffer.len = self._buffer_len             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 */
    __pyx_t_5 = __pyx_v_self->_buffer_len;
    __pyx_v_buffer->len = __pyx_t_5;

    /* "src/lxml/xslt.pxi":797
 *             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:;

  /* "src/lxml/xslt.pxi":798
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":799
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.readonly = 1
 */
    __pyx_v_buffer->readonly = 0;

    /* "src/lxml/xslt.pxi":798
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
 */
    goto __pyx_L10;
  }

  /* "src/lxml/xslt.pxi":801
 *             buffer.readonly = 0
 *         else:
 *             buffer.readonly = 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"
 */
  /*else*/ {
    __pyx_v_buffer->readonly = 1;
  }
  __pyx_L10:;

  /* "src/lxml/xslt.pxi":802
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":803
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.format = NULL
 */
    __pyx_v_buffer->format = ((char *)"B");

    /* "src/lxml/xslt.pxi":802
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
 */
    goto __pyx_L11;
  }

  /* "src/lxml/xslt.pxi":805
 *             buffer.format = "B"
 *         else:
 *             buffer.format = NULL             # <<<<<<<<<<<<<<
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 */
  /*else*/ {
    __pyx_v_buffer->format = NULL;
  }
  __pyx_L11:;

  /* "src/lxml/xslt.pxi":806
 *         else:
 *             buffer.format = NULL
 *         buffer.ndim = 0             # <<<<<<<<<<<<<<
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 */
  __pyx_v_buffer->ndim = 0;

  /* "src/lxml/xslt.pxi":807
 *             buffer.format = NULL
 *         buffer.ndim = 0
 *         buffer.shape = NULL             # <<<<<<<<<<<<<<
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 */
  __pyx_v_buffer->shape = NULL;

  /* "src/lxml/xslt.pxi":808
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 *         buffer.strides = NULL             # <<<<<<<<<<<<<<
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 */
  __pyx_v_buffer->strides = NULL;

  /* "src/lxml/xslt.pxi":809
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 */
  __pyx_v_buffer->suboffsets = NULL;

  /* "src/lxml/xslt.pxi":810
 *         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;

  /* "src/lxml/xslt.pxi":811
 *         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;

  /* "src/lxml/xslt.pxi":812
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?             # <<<<<<<<<<<<<<
 *             buffer.obj = self
 * 
 */
  __pyx_t_1 = (__pyx_v_buffer->obj != ((PyObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":813
 *         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);

    /* "src/lxml/xslt.pxi":812
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?             # <<<<<<<<<<<<<<
 *             buffer.obj = self
 * 
 */
  }

  /* "src/lxml/xslt.pxi":783
 *         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->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_buffer->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xslt.pxi":815
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */

/* Python wrapper */
CYTHON_UNUSED static void __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/
CYTHON_UNUSED static void __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__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_6__releasebuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  int __pyx_t_1;

  /* "src/lxml/xslt.pxi":816
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":817
 *     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;

    /* "src/lxml/xslt.pxi":816
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
 */
  }

  /* "src/lxml/xslt.pxi":818
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":819
 *             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);

    /* "src/lxml/xslt.pxi":820
 *         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);
    if (__pyx_t_1) {

      /* "src/lxml/xslt.pxi":821
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)             # <<<<<<<<<<<<<<
 *                 self._buffer = NULL
 *         else:
 */
      xmlFree(((char *)__pyx_v_self->_buffer));

      /* "src/lxml/xslt.pxi":822
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 */
      __pyx_v_self->_buffer = NULL;

      /* "src/lxml/xslt.pxi":820
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL
 */
    }

    /* "src/lxml/xslt.pxi":818
 *         if buffer is NULL:
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":824
 *                 self._buffer = NULL
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)             # <<<<<<<<<<<<<<
 *         buffer.buf = NULL
 * 
 */
  /*else*/ {
    xmlFree(((char *)__pyx_v_buffer->buf));
  }
  __pyx_L4:;

  /* "src/lxml/xslt.pxi":825
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 *         buffer.buf = NULL             # <<<<<<<<<<<<<<
 * 
 *     property xslt_profile:
 */
  __pyx_v_buffer->buf = NULL;

  /* "src/lxml/xslt.pxi":815
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/xslt.pxi":830
 *         """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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  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("__get__", 1);

  /* "src/lxml/xslt.pxi":832
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":833
 *             cdef object root
 *             if self._profile is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             root = self._profile.getroot()
 *             if root is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":832
 *         def __get__(self):
 *             cdef object root
 *             if self._profile is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             root = self._profile.getroot()
 */
  }

  /* "src/lxml/xslt.pxi":834
 *             if self._profile is None:
 *                 return None
 *             root = self._profile.getroot()             # <<<<<<<<<<<<<<
 *             if root is None:
 *                 return None
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->_profile); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/xslt.pxi":835
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
 */
  __pyx_t_1 = (__pyx_v_root == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":836
 *             root = self._profile.getroot()
 *             if root is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             return ElementTree(root)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":835
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
 */
  }

  /* "src/lxml/xslt.pxi":837
 *             if root is None:
 *                 return None
 *             return ElementTree(root)             # <<<<<<<<<<<<<<
 * 
 *         def __del__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_root};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 837, __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;

  /* "src/lxml/xslt.pxi":830
 *         """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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xslt.pxi":839
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/xslt.pxi":840
 * 
 *         def __del__(self):
 *             self._profile = None             # <<<<<<<<<<<<<<
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_profile);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_profile);
  __pyx_v_self->_profile = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/xslt.pxi":839
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
 */

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

/* "src/lxml/xslt.pxi":842
 *             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", 1);

  /* "src/lxml/xslt.pxi":844
 * 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 *)__pyx_ptype_4lxml_5etree__XSLTResultTree))); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 844, __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;

  /* "src/lxml/xslt.pxi":845
 *     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((PyObject *)__pyx_v_result->_xslt);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_xslt);
  __pyx_v_result->_xslt = __pyx_v_xslt;

  /* "src/lxml/xslt.pxi":846
 *     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((PyObject *)__pyx_v_result->_profile);
  __Pyx_DECREF((PyObject *)__pyx_v_result->_profile);
  __pyx_v_result->_profile = __pyx_v_profile;

  /* "src/lxml/xslt.pxi":847
 *     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;

  /* "src/lxml/xslt.pxi":842
 *             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;
}

/* "src/lxml/xslt.pxi":865
 * 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;
  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("_findStylesheetByID", 1);

  /* "src/lxml/xslt.pxi":867
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":870
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})             # <<<<<<<<<<<<<<
 *     return __findStylesheetByID(doc, id=id)
 * 
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_xsl, __pyx_kp_u_http_www_w3_org_1999_XSL_Transfo) < 0) __PYX_ERR(5, 870, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, __pyx_t_3) < 0) __PYX_ERR(5, 870, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":868
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPath), __pyx_tuple__98, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":867
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             "//xsl:stylesheet[@xml:id = $id]",
 */
  }

  /* "src/lxml/xslt.pxi":871
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})
 *     return __findStylesheetByID(doc, id=id)             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __Pyx_GIVEREF((PyObject *)__pyx_v_doc);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_doc))) __PYX_ERR(5, 871, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_id, __pyx_v_id) < 0) __PYX_ERR(5, 871, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID), __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 871, __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;

  /* "src/lxml/xslt.pxi":865
 * 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "src/lxml/xslt.pxi":874
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL = {"parseXSL", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL};
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_parser = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parser);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 874, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parseXSL") < 0)) __PYX_ERR(5, 874, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parser = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseXSL", 0, 0, 1, __pyx_nargs); __PYX_ERR(5, 874, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  unsigned char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  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("parseXSL", 1);

  /* "src/lxml/xslt.pxi":890
 *         cdef const_xmlChar* c_href
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(5, 890, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":891
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<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);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xslt.pxi":892
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"             # <<<<<<<<<<<<<<
 *         hrefs = _FIND_PI_HREF(' ' + (<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_ERR(5, 892, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":891
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 */
  }

  /* "src/lxml/xslt.pxi":893
 *         if self._c_node.content is NULL:
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))             # <<<<<<<<<<<<<<
 *         if len(hrefs) != 1:
 *             raise ValueError, "malformed PI attributes"
 */
  __pyx_t_4 = ((unsigned char *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content);
  __pyx_t_5 = __Pyx_ssize_strlen(((char const *)__pyx_t_4)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 893, __pyx_L1_error)
  __pyx_t_6 = __Pyx_decode_c_string(((char const *)__pyx_t_4), 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u__11, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __pyx_t_6 = __pyx_v_4lxml_5etree__FIND_PI_HREF; __pyx_t_8 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_v_hrefs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":894
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_hrefs); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 894, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_5 != 1);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/xslt.pxi":895
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:
 *             raise ValueError, "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_ERR(5, 895, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":894
 *             raise ValueError, "PI lacks content"
 *         hrefs = _FIND_PI_HREF(' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
 */
  }

  /* "src/lxml/xslt.pxi":896
 *         if len(hrefs) != 1:
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]             # <<<<<<<<<<<<<<
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 *         c_href = _xcstr(href_utf)
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_hrefs, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":897
 *             raise ValueError, "malformed PI attributes"
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])             # <<<<<<<<<<<<<<
 *         c_href = _xcstr(href_utf)
 * 
 */
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(5, 897, __pyx_L1_error)
  if (!__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_hrefs, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = __pyx_t_6;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_L5_bool_binop_done:;
  __pyx_t_6 = utf8(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_href_utf = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "src/lxml/xslt.pxi":898
 *         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);

  /* "src/lxml/xslt.pxi":900
 *         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]) != '#');
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":902
 *         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));

    /* "src/lxml/xslt.pxi":905
 *                 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);
    if (__pyx_t_2) {

      /* "src/lxml/xslt.pxi":906
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:
 *                 try:             # <<<<<<<<<<<<<<
 *                     href_utf = <unsigned char*>c_href
 *                 finally:
 */
      /*try:*/ {

        /* "src/lxml/xslt.pxi":907
 *             if c_href is not NULL:
 *                 try:
 *                     href_utf = <unsigned char*>c_href             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)
 */
        __pyx_t_6 = __Pyx_PyBytes_FromCString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 907, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_6));
        __pyx_t_6 = 0;
      }

      /* "src/lxml/xslt.pxi":909
 *                     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_L11;
        }
        __pyx_L10_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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_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;
          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_1 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
            xmlFree(((char *)__pyx_v_c_href));
          }
          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_1; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L1_error;
        }
        __pyx_L11:;
      }

      /* "src/lxml/xslt.pxi":905
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:             # <<<<<<<<<<<<<<
 *                 try:
 *                     href_utf = <unsigned char*>c_href
 */
    }

    /* "src/lxml/xslt.pxi":910
 *                 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_ERR(5, 910, __pyx_L1_error)
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_v_href_utf, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser))); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "src/lxml/xslt.pxi":911
 *                     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_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":900
 *         c_href = _xcstr(href_utf)
 * 
 *         if c_href[0] != c'#':             # <<<<<<<<<<<<<<
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(
 */
  }

  /* "src/lxml/xslt.pxi":915
 *         # 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_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_6)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(5, 915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "src/lxml/xslt.pxi":916
 *         # 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);

  /* "src/lxml/xslt.pxi":917
 *         _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);

  /* "src/lxml/xslt.pxi":918
 *         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_17 = (__pyx_v_c_attr != NULL);
  if (__pyx_t_17) {
  } else {
    __pyx_t_2 = __pyx_t_17;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_17 = (__pyx_v_c_attr->doc == __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc);
  __pyx_t_2 = __pyx_t_17;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_2) {

    /* "src/lxml/xslt.pxi":919
 *         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_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":920
 *         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_3 = ((PyObject *)__pyx_v_result_node->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_result_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "src/lxml/xslt.pxi":918
 *         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)
 */
  }

  /* "src/lxml/xslt.pxi":923
 * 
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))             # <<<<<<<<<<<<<<
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 */
  __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __pyx_f_4lxml_5etree__findStylesheetByID(((struct LxmlDocument *)__pyx_t_6), __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_root = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "src/lxml/xslt.pxi":924
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_root); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(5, 924, __pyx_L1_error)
  __pyx_t_17 = (!__pyx_t_2);
  if (unlikely(__pyx_t_17)) {

    /* "src/lxml/xslt.pxi":925
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"             # <<<<<<<<<<<<<<
 *         elif len(root) > 1:
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_reference_to_non_existing_embedd, 0, 0);
    __PYX_ERR(5, 925, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":924
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 */
  }

  /* "src/lxml/xslt.pxi":926
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_root); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 926, __pyx_L1_error)
  __pyx_t_17 = (__pyx_t_5 > 1);
  if (unlikely(__pyx_t_17)) {

    /* "src/lxml/xslt.pxi":927
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 *             raise ValueError, "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_ERR(5, 927, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":926
 *         if not root:
 *             raise ValueError, "reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 */
  }

  /* "src/lxml/xslt.pxi":928
 *         elif len(root) > 1:
 *             raise ValueError, "ambiguous reference to embedded stylesheet"
 *         result_node = root[0]             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 */
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_root, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 928, __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_ERR(5, 928, __pyx_L1_error)
  __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "src/lxml/xslt.pxi":929
 *             raise ValueError, "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_7 = ((PyObject *)__pyx_v_result_node->_doc);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_7), __pyx_v_result_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 929, __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;

  /* "src/lxml/xslt.pxi":874
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "src/lxml/xslt.pxi":931
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_3set = {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set};
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 931, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 931, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); __PYX_ERR(5, 931, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set") < 0)) __PYX_ERR(5, 931, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, __pyx_nargs); __PYX_ERR(5, 931, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  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("set", 1);

  /* "src/lxml/xslt.pxi":937
 *         the processing instruction.
 *         """
 *         if key != "href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 "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_ERR(5, 937, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":938
 *         """
 *         if key != "href":
 *             raise AttributeError, \             # <<<<<<<<<<<<<<
 *                 "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_ERR(5, 938, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":937
 *         the processing instruction.
 *         """
 *         if key != "href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 */
  }

  /* "src/lxml/xslt.pxi":940
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = ""
 *         elif '"' in value or '>' in value:
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":941
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 *             attrib = ""             # <<<<<<<<<<<<<<
 *         elif '"' in value or '>' in value:
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 */
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_v_attrib = __pyx_kp_u__12;

    /* "src/lxml/xslt.pxi":940
 *             raise AttributeError, \
 *                 "only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = ""
 *         elif '"' in value or '>' in value:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/xslt.pxi":942
 *         if value is None:
 *             attrib = ""
 *         elif '"' in value or '>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__26, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(5, 942, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__29, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(5, 942, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xslt.pxi":943
 *             attrib = ""
 *         elif '"' in value or '>' in value:
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = f' href="{value}"'
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Invalid_URL_must_not_contain_or, 0, 0);
    __PYX_ERR(5, 943, __pyx_L1_error)

    /* "src/lxml/xslt.pxi":942
 *         if value is None:
 *             attrib = ""
 *         elif '"' in value or '>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
 */
  }

  /* "src/lxml/xslt.pxi":945
 *             raise ValueError, "Invalid URL, must not contain '\"' or '>'"
 *         else:
 *             attrib = f' href="{value}"'             # <<<<<<<<<<<<<<
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):
 */
  /*else*/ {
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 127;
    __Pyx_INCREF(__pyx_kp_u_href_2);
    __pyx_t_4 += 7;
    __Pyx_GIVEREF(__pyx_kp_u_href_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_href_2);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
    __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_kp_u__26);
    __pyx_t_4 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__26);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__26);
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_attrib = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
  }
  __pyx_L4:;

  /* "src/lxml/xslt.pxi":946
 *         else:
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text             # <<<<<<<<<<<<<<
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyNumber_Add(__pyx_kp_u__11, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_text = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/xslt.pxi":947
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 */
  __Pyx_INCREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __pyx_t_6 = __pyx_v_4lxml_5etree__FIND_PI_HREF; __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_text};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(5, 947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/xslt.pxi":948
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)             # <<<<<<<<<<<<<<
 *         else:
 *             self.text = text + attrib
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
    __pyx_t_6 = __pyx_v_4lxml_5etree__REPLACE_PI_HREF; __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_attrib, __pyx_v_text};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text, __pyx_t_3) < 0) __PYX_ERR(5, 948, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/xslt.pxi":947
 *             attrib = f' href="{value}"'
 *         text = ' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 */
    goto __pyx_L7;
  }

  /* "src/lxml/xslt.pxi":950
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 *             self.text = text + attrib             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_3 = PyNumber_Add(__pyx_v_text, __pyx_v_attrib); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text, __pyx_t_3) < 0) __PYX_ERR(5, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L7:;

  /* "src/lxml/xslt.pxi":931
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """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_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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;
}

/* "src/lxml/xsltext.pxi":6
 *     """Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_1execute = {"execute", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_1execute, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_execute};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_1execute(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_self_node,&__pyx_n_s_input_node,&__pyx_n_s_output_parent,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 6, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 6, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 1); __PYX_ERR(19, 6, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_input_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 6, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 2); __PYX_ERR(19, 6, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_parent)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 6, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 3); __PYX_ERR(19, 6, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "execute") < 0)) __PYX_ERR(19, 6, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, __pyx_nargs); __PYX_ERR(19, 6, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

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

/* "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):
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_3apply_templates = {"apply_templates", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    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};
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 22, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_node)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 22, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, 1); __PYX_ERR(19, 22, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_parent);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 22, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 3; index < 5 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 22, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "apply_templates") < 0)) __PYX_ERR(19, 22, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, __pyx_nargs); __PYX_ERR(19, 22, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(19, 22, __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);

  /* "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):
 *         """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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  xmlNode *__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", 1);

  /* "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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_context->_xsltCtxt != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XSLT_context_not_initialised, 0, 0);
      __PYX_ERR(19, 47, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 47, __pyx_L1_error)
  #endif

  /* "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_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_node); if (unlikely(__pyx_t_2 == ((xmlNode *)NULL))) __PYX_ERR(19, 48, __pyx_L1_error)
  __pyx_v_c_context_node = __pyx_t_2;

  /* "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_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":53
 * 
 *         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 == ((xmlNode *)NULL))) __PYX_ERR(19, 53, __pyx_L1_error)
    __pyx_v_c_parent = __pyx_t_2;

    /* "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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xsltext.pxi":55
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 */
  /*else*/ {

    /* "src/lxml/xsltext.pxi":56
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_node = context._xsltCtxt.insert
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)((char const *)"fake-parent"))), NULL);
  }
  __pyx_L3:;

  /* "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_2 = __pyx_v_context->_xsltCtxt->insert;
  __pyx_v_c_node = __pyx_t_2;

  /* "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;

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

  /* "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;

  /* "src/lxml/xsltext.pxi":64
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xsltext.pxi":65
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":64
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "src/lxml/xsltext.pxi":67
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
 */
  /*try:*/ {

    /* "src/lxml/xsltext.pxi":68
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "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_1 = __Pyx_PyObject_IsTrue(__pyx_v_elements_only); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(19, 69, __pyx_L6_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(19, 69, __pyx_L6_error)

    /* "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_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 68, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5_return;
  }

  /* "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:*/ {
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
    }
  }

  /* "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):
 *         """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;
}

/* "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):
 *         """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_13XSLTExtension_5process_children = {"process_children", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_4process_children};
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_output_parent,&__pyx_n_s_elements_only,&__pyx_n_s_remove_blank_text,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 74, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_parent);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 74, __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 = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 74, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "process_children") < 0)) __PYX_ERR(19, 74, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("process_children", 0, 1, 2, __pyx_nargs); __PYX_ERR(19, 74, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_ERR(19, 74, __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);

  /* "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):
 *         """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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);

  /* "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;

  /* "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;

  /* "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(__pyx_assertions_enabled())) {
    __pyx_t_3 = (__pyx_v_context->_xsltCtxt != NULL);
    if (unlikely(!__pyx_t_3)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XSLT_context_not_initialised, 0, 0);
      __PYX_ERR(19, 99, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(19, 99, __pyx_L1_error)
  #endif

  /* "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);
  if (__pyx_t_3) {

    /* "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 == ((xmlNode *)NULL))) __PYX_ERR(19, 106, __pyx_L1_error)
    __pyx_v_c_parent = __pyx_t_2;

    /* "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:
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xsltext.pxi":108
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 */
  /*else*/ {

    /* "src/lxml/xsltext.pxi":109
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_ctxt.insert = c_parent
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)((char const *)"fake-parent"))), NULL);
  }
  __pyx_L3:;

  /* "src/lxml/xsltext.pxi":111
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 *         c_ctxt.insert = c_parent             # <<<<<<<<<<<<<<
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 */
  __pyx_v_c_ctxt->insert = __pyx_v_c_parent;

  /* "src/lxml/xsltext.pxi":112
 * 
 *         c_ctxt.insert = c_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);

  /* "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;

  /* "src/lxml/xsltext.pxi":116
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_3 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/xsltext.pxi":117
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/xsltext.pxi":116
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "src/lxml/xsltext.pxi":119
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
 */
  /*try:*/ {

    /* "src/lxml/xsltext.pxi":120
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "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_ERR(19, 121, __pyx_L6_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(19, 121, __pyx_L6_error)

    /* "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_ERR(19, 120, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5_return;
  }

  /* "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:*/ {
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
    }
  }

  /* "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):
 *         """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;
}

/* "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;
  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("_collectXSLTResultContent", 1);

  /* "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_ERR(19, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "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;

  /* "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);
    if (!__pyx_t_3) break;

    /* "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;

    /* "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)
 */
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:

      /* "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);
      if (__pyx_t_3) {

        /* "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_ERR(19, 137, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_s, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "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_4 = (!__pyx_v_remove_blank_text);
        if (!__pyx_t_4) {
        } else {
          __pyx_t_3 = __pyx_t_4;
          goto __pyx_L7_bool_binop_done;
        }
        __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyUnicode_Type_strip, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(19, 138, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = __pyx_t_4;
        __pyx_L7_bool_binop_done:;
        if (__pyx_t_3) {

          /* "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_5 = __Pyx_PyList_Append(__pyx_v_results, __pyx_v_s); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(19, 139, __pyx_L1_error)

          /* "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
 */
        }

        /* "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, ((PyObject*)Py_None));

        /* "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():
 */
      }

      /* "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)
 */
      break;
      case XML_ELEMENT_NODE:

      /* "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_1 = ((PyObject *)__pyx_v_context->_extension_element_proxy);
      __Pyx_INCREF(__pyx_t_1);

      /* "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_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_proxy, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "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_5 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_proxy)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(19, 144, __pyx_L1_error)

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

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

      /* "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)
 */
      break;
      default:

      /* "src/lxml/xsltext.pxi":150
 *             else:
 *                 raise TypeError, \
 *                     f"unsupported XSLT result type: {c_node.type}"             # <<<<<<<<<<<<<<
 *             c_node = c_next
 *         return results
 */
      __pyx_t_6 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_unsupported_XSLT_result_type, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(19, 149, __pyx_L1_error)
      break;
    }

    /* "src/lxml/xsltext.pxi":151
 *                 raise TypeError, \
 *                     f"unsupported XSLT result type: {c_node.type}"
 *             c_node = c_next             # <<<<<<<<<<<<<<
 *         return results
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "src/lxml/xsltext.pxi":152
 *                     f"unsupported XSLT result type: {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;

  /* "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_6);
  __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;
}

/* "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", 1);

  /* "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 (likely(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_ERR(19, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(19, 157, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(19, 157, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(19, 157, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(19, 157, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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_ERR(19, 157, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(19, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #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(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(19, 157, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(19, 157, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      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_ERR(19, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 157, __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_ERR(19, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      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_ERR(19, 157, __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_ERR(19, 157, __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;

    /* "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)
 */
    (void)(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)));

    /* "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),
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "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;
}

/* "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;
  Py_ssize_t __pyx_t_12;
  Py_UCS4 __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  char const *__pyx_t_16;
  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;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  char *__pyx_t_28;
  char const *__pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_callExtensionElement", 0);

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

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

  /* "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);
  if (__pyx_t_1) {

    /* "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;

    /* "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
 */
  }

  /* "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);
  if (__pyx_t_1) {

    /* "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;

    /* "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
 */
  }

  /* "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;

  /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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:*/ {

        /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 */
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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:*/ {

            /* "src/lxml/xsltext.pxi":183
 *         try:
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))             # <<<<<<<<<<<<<<
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 */
            __pyx_t_2 = __pyx_v_context->_extension_elements;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_9 = __Pyx_PyBytes_FromCString(__pyx_v_c_uri); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = __Pyx_PyBytes_FromCString(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(19, 183, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GIVEREF(__pyx_t_9);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9)) __PYX_ERR(19, 183, __pyx_L14_error);
            __Pyx_GIVEREF(__pyx_t_10);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10)) __PYX_ERR(19, 183, __pyx_L14_error);
            __pyx_t_9 = 0;
            __pyx_t_10 = 0;

            /* "src/lxml/xsltext.pxi":182
 *     try:
 *         try:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 context._extension_elements, (c_uri, 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;

            /* "src/lxml/xsltext.pxi":184
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             extension = <object>dict_result
 */
            __pyx_t_1 = (__pyx_v_dict_result == NULL);
            if (unlikely(__pyx_t_1)) {

              /* "src/lxml/xsltext.pxi":185
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"             # <<<<<<<<<<<<<<
 *             extension = <object>dict_result
 * 
 */
              __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(19, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = 0;
              __pyx_t_13 = 127;
              __Pyx_INCREF(__pyx_kp_u_extension_element);
              __pyx_t_12 += 18;
              __Pyx_GIVEREF(__pyx_kp_u_extension_element);
              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_u_extension_element);
              __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(19, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_10 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_13;
              __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_10);
              PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
              __pyx_t_10 = 0;
              __Pyx_INCREF(__pyx_kp_u_not_found_2);
              __pyx_t_12 += 10;
              __Pyx_GIVEREF(__pyx_kp_u_not_found_2);
              PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_u_not_found_2);
              __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 185, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_Raise(__pyx_builtin_KeyError, __pyx_t_10, 0, 0);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __PYX_ERR(19, 185, __pyx_L14_error)

              /* "src/lxml/xsltext.pxi":184
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             extension = <object>dict_result
 */
            }

            /* "src/lxml/xsltext.pxi":186
 *             if dict_result is NULL:
 *                 raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
 *             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_ERR(19, 186, __pyx_L14_error)
            __pyx_t_10 = ((PyObject *)__pyx_v_dict_result);
            __Pyx_INCREF(__pyx_t_10);
            __pyx_v_extension = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_t_10);
            __pyx_t_10 = 0;

            /* "src/lxml/xsltext.pxi":188
 *             extension = <object>dict_result
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 */
            /*try:*/ {

              /* "src/lxml/xsltext.pxi":190
 *             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_10 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_inst_node)); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 190, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF_SET(__pyx_v_self_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_10));
              __pyx_t_10 = 0;

              /* "src/lxml/xsltext.pxi":191
 *                 # 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);
              if (__pyx_t_1) {

                /* "src/lxml/xsltext.pxi":192
 *                 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_10 = ((PyObject *)__pyx_f_4lxml_5etree__newAppendOnlyProxy(__pyx_v_self_node, __pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 192, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __pyx_v_output_parent = __pyx_t_10;
                __pyx_t_10 = 0;

                /* "src/lxml/xsltext.pxi":191
 *                 # 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:
 */
                goto __pyx_L24;
              }

              /* "src/lxml/xsltext.pxi":195
 *                 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):
 */
              /*else*/ {
                __pyx_t_10 = ((PyObject *)__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(__pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 195, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __pyx_v_output_parent = __pyx_t_10;
                __pyx_t_10 = 0;
              }
              __pyx_L24:;

              /* "src/lxml/xsltext.pxi":196
 *                     # 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)
 */
              switch (__pyx_v_c_context_node->type) {
                case XML_DOCUMENT_NODE:
                case XML_HTML_DOCUMENT_NODE:

                /* "src/lxml/xsltext.pxi":198
 *                 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));

                /* "src/lxml/xsltext.pxi":199
 *                                            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);
                if (__pyx_t_1) {

                  /* "src/lxml/xsltext.pxi":200
 *                     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_10 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_node)); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 200, __pyx_L22_error)
                  __Pyx_GOTREF(__pyx_t_10);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_10));
                  __pyx_t_10 = 0;

                  /* "src/lxml/xsltext.pxi":199
 *                                            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:
 */
                  goto __pyx_L25;
                }

                /* "src/lxml/xsltext.pxi":202
 *                         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,
 */
                /*else*/ {
                  __Pyx_INCREF(Py_None);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None));
                }
                __pyx_L25:;

                /* "src/lxml/xsltext.pxi":196
 *                     # 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)
 */
                break;
                case XML_ATTRIBUTE_NODE:

                /* "src/lxml/xsltext.pxi":203
 *                     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_TEXT_NODE:

                /* "src/lxml/xsltext.pxi":204
 *                         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_CDATA_SECTION_NODE:

                /* "src/lxml/xsltext.pxi":209
 *                     # nodes, as the smart-string factory must
 *                     # instantiate the parent proxy somehow...
 *                     raise TypeError(f"Unsupported element type: {c_context_node.type}")             # <<<<<<<<<<<<<<
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)
 */
                __pyx_t_10 = __Pyx_PyUnicode_From_xmlElementType(__pyx_v_c_context_node->type, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 209, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unsupported_element_type, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(19, 209, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 209, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_Raise(__pyx_t_10, 0, 0, 0);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                __PYX_ERR(19, 209, __pyx_L22_error)

                /* "src/lxml/xsltext.pxi":203
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
 */
                break;
                default:

                /* "src/lxml/xsltext.pxi":211
 *                     raise TypeError(f"Unsupported element type: {c_context_node.type}")
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)             # <<<<<<<<<<<<<<
 * 
 *                 # run the XSLT extension
 */
                __pyx_t_10 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_context_node)); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 211, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_10));
                __pyx_t_10 = 0;
                break;
              }

              /* "src/lxml/xsltext.pxi":214
 * 
 *                 # 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_ERR(19, 214, __pyx_L22_error)
              __pyx_t_10 = ((PyObject *)__pyx_v_self_node);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_10);
              __Pyx_GOTREF((PyObject *)__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_10);
              __pyx_t_10 = 0;

              /* "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:
 *                 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_ERR(19, 215, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = NULL;
              __pyx_t_14 = 0;
              #if CYTHON_UNPACK_METHODS
              if (likely(PyMethod_Check(__pyx_t_11))) {
                __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_11);
                if (likely(__pyx_t_2)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                  __Pyx_INCREF(__pyx_t_2);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_11, function);
                  __pyx_t_14 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[5] = {__pyx_t_2, ((PyObject *)__pyx_v_context), ((PyObject *)__pyx_v_self_node), ((PyObject *)__pyx_v_context_node), __pyx_v_output_parent};
                __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_14, 4+__pyx_t_14);
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 215, __pyx_L22_error)
                __Pyx_GOTREF(__pyx_t_10);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              }
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }

            /* "src/lxml/xsltext.pxi":217
 *                 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((PyObject *)__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);

                /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 */
                __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None);
                if (__pyx_t_1) {

                  /* "src/lxml/xsltext.pxi":219
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             try:
 */
                  __pyx_t_10 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 219, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_10);
                  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

                  /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 */
                }
                goto __pyx_L23;
              }
              __pyx_L22_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_20, &__pyx_t_21, &__pyx_t_22);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
                __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_XGOTREF(__pyx_t_22);
                __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
                {

                  /* "src/lxml/xsltext.pxi":217
 *                 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((PyObject *)__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);

                  /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 */
                  __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None);
                  if (__pyx_t_1) {

                    /* "src/lxml/xsltext.pxi":219
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             try:
 */
                    __pyx_t_10 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 219, __pyx_L28_error)
                    __Pyx_GOTREF(__pyx_t_10);
                    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

                    /* "src/lxml/xsltext.pxi":218
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 */
                  }
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_20);
                  __Pyx_XGIVEREF(__pyx_t_21);
                  __Pyx_XGIVEREF(__pyx_t_22);
                  __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                }
                __Pyx_XGIVEREF(__pyx_t_17);
                __Pyx_XGIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
                __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
                goto __pyx_L14_error;
                __pyx_L28_error:;
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_20);
                  __Pyx_XGIVEREF(__pyx_t_21);
                  __Pyx_XGIVEREF(__pyx_t_22);
                  __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                }
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
                __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                goto __pyx_L14_error;
              }
              __pyx_L23:;
            }

            /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 */
          }
          __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_L19_try_end;
          __pyx_L14_error:;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "src/lxml/xsltext.pxi":220
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode("UTF-8")
 */
          __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
          if (__pyx_t_15) {
            __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_2) < 0) __PYX_ERR(19, 220, __pyx_L16_except_error)
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_11);
            __pyx_v_e = __pyx_t_11;
            /*try:*/ {

              /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
 */
              {
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __Pyx_ExceptionSave(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_20);
                /*try:*/ {

                  /* "src/lxml/xsltext.pxi":222
 *         except Exception as e:
 *             try:
 *                 e = unicode(e).encode("UTF-8")             # <<<<<<<<<<<<<<
 *             except:
 *                 e = repr(e).encode("UTF-8")
 */
                  __pyx_t_9 = __Pyx_PyObject_Unicode(__pyx_v_e); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 222, __pyx_L37_error)
                  __Pyx_GOTREF(__pyx_t_9);
                  __pyx_t_23 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_9)); if (unlikely(!__pyx_t_23)) __PYX_ERR(19, 222, __pyx_L37_error)
                  __Pyx_GOTREF(__pyx_t_23);
                  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                  __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_23);
                  __pyx_t_23 = 0;

                  /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
 */
                }
                __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
                __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
                goto __pyx_L44_try_end;
                __pyx_L37_error:;
                __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

                /* "src/lxml/xsltext.pxi":223
 *             try:
 *                 e = unicode(e).encode("UTF-8")
 *             except:             # <<<<<<<<<<<<<<
 *                 e = repr(e).encode("UTF-8")
 *             message = python.PyBytes_FromFormat(
 */
                /*except:*/ {
                  __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
                  if (__Pyx_GetException(&__pyx_t_23, &__pyx_t_9, &__pyx_t_24) < 0) __PYX_ERR(19, 223, __pyx_L39_except_error)
                  __Pyx_XGOTREF(__pyx_t_23);
                  __Pyx_XGOTREF(__pyx_t_9);
                  __Pyx_XGOTREF(__pyx_t_24);

                  /* "src/lxml/xsltext.pxi":224
 *                 e = unicode(e).encode("UTF-8")
 *             except:
 *                 e = repr(e).encode("UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 */
                  __pyx_t_26 = PyObject_Repr(__pyx_v_e); if (unlikely(!__pyx_t_26)) __PYX_ERR(19, 224, __pyx_L39_except_error)
                  __Pyx_GOTREF(__pyx_t_26);
                  __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_26, __pyx_n_s_encode); if (unlikely(!__pyx_t_27)) __PYX_ERR(19, 224, __pyx_L39_except_error)
                  __Pyx_GOTREF(__pyx_t_27);
                  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
                  __pyx_t_26 = NULL;
                  __pyx_t_15 = 0;
                  #if CYTHON_UNPACK_METHODS
                  if (likely(PyMethod_Check(__pyx_t_27))) {
                    __pyx_t_26 = PyMethod_GET_SELF(__pyx_t_27);
                    if (likely(__pyx_t_26)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
                      __Pyx_INCREF(__pyx_t_26);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_27, function);
                      __pyx_t_15 = 1;
                    }
                  }
                  #endif
                  {
                    PyObject *__pyx_callargs[2] = {__pyx_t_26, __pyx_kp_u_UTF_8};
                    __pyx_t_25 = __Pyx_PyObject_FastCall(__pyx_t_27, __pyx_callargs+1-__pyx_t_15, 1+__pyx_t_15);
                    __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
                    if (unlikely(!__pyx_t_25)) __PYX_ERR(19, 224, __pyx_L39_except_error)
                    __Pyx_GOTREF(__pyx_t_25);
                    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
                  }
                  __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_25);
                  __pyx_t_25 = 0;
                  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                  goto __pyx_L38_exception_handled;
                }

                /* "src/lxml/xsltext.pxi":221
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode("UTF-8")
 *             except:
 */
                __pyx_L39_except_error:;
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
                goto __pyx_L35_error;
                __pyx_L38_exception_handled:;
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
                __pyx_L44_try_end:;
              }

              /* "src/lxml/xsltext.pxi":225
 *             except:
 *                 e = repr(e).encode("UTF-8")
 *             message = python.PyBytes_FromFormat(             # <<<<<<<<<<<<<<
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 */
              __pyx_t_24 = PyBytes_FromFormat(((char *)"Error executing extension element '%s': %s"), __pyx_v_c_inst_node->name, PyBytes_AS_STRING(__pyx_v_e)); if (unlikely(!__pyx_t_24)) __PYX_ERR(19, 225, __pyx_L35_error)
              __Pyx_GOTREF(__pyx_t_24);
              __pyx_v_message = ((PyObject*)__pyx_t_24);
              __pyx_t_24 = 0;

              /* "src/lxml/xsltext.pxi":228
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *         except:
 */
              if (unlikely(__pyx_v_message == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
                __PYX_ERR(19, 228, __pyx_L35_error)
              }
              __pyx_t_28 = __Pyx_PyBytes_AsWritableString(__pyx_v_message); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(19, 228, __pyx_L35_error)
              xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, ((char *)"%s"), __pyx_t_28);

              /* "src/lxml/xsltext.pxi":229
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", 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);
            }

            /* "src/lxml/xsltext.pxi":220
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode("UTF-8")
 */
            /*finally:*/ {
              /*normal exit:*/{
                __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                goto __pyx_L36;
              }
              __pyx_L35_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
                __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
                __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_18);
                __Pyx_XGOTREF(__pyx_t_17);
                __pyx_t_15 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_29 = __pyx_filename;
                {
                  __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_19);
                  __Pyx_XGIVEREF(__pyx_t_18);
                  __Pyx_XGIVEREF(__pyx_t_17);
                  __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_18, __pyx_t_17);
                }
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0;
                __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_29;
                goto __pyx_L16_except_error;
              }
              __pyx_L36:;
            }
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            goto __pyx_L15_exception_handled;
          }

          /* "src/lxml/xsltext.pxi":230
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", 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_2, &__pyx_t_11, &__pyx_t_10) < 0) __PYX_ERR(19, 230, __pyx_L16_except_error)
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_10);

            /* "src/lxml/xsltext.pxi":232
 *         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, "%s", message)
 */
            __pyx_t_24 = PyBytes_FromFormat(((char *)"Error executing extension element '%s'"), __pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_24)) __PYX_ERR(19, 232, __pyx_L16_except_error)
            __Pyx_GOTREF(__pyx_t_24);
            __pyx_v_message = ((PyObject*)__pyx_t_24);
            __pyx_t_24 = 0;

            /* "src/lxml/xsltext.pxi":234
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *     except:
 */
            if (unlikely(__pyx_v_message == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
              __PYX_ERR(19, 234, __pyx_L16_except_error)
            }
            __pyx_t_28 = __Pyx_PyBytes_AsWritableString(__pyx_v_message); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(19, 234, __pyx_L16_except_error)
            xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, ((char *)"%s"), __pyx_t_28);

            /* "src/lxml/xsltext.pxi":235
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", 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_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L15_exception_handled;
          }

          /* "src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 */
          __pyx_L16_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_L15_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_L19_try_end:;
        }

        /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
 */
      }
      __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_L8_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "src/lxml/xsltext.pxi":236
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", 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_11, &__pyx_t_2) < 0) __PYX_ERR(19, 236, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_2);

        /* "src/lxml/xsltext.pxi":238
 *     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, ((char *)"Error during XSLT extension element evaluation"));

        /* "src/lxml/xsltext.pxi":240
 *         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_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L9_exception_handled;
      }

      /* "src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
 */
      __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_L13_try_end:;
    }
  }

  /* "src/lxml/xsltext.pxi":242
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
      __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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_L55_return;
      }
      __pyx_L55_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;
    }
  }

  /* "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
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "lxml/etree.pyx":3674
 *     "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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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__", 1);

  /* "lxml/etree.pyx":3675
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def validate(self, etree):
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__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;

  /* "lxml/etree.pyx":3674
 *     "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;
}

/* "lxml/etree.pyx":3677
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_3validate = {"validate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_3validate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_2validate};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("validate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3677, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "validate") < 0)) __PYX_ERR(0, 3677, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("validate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3677, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Validator.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_2validate(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("validate", 1);

  /* "lxml/etree.pyx":3684
 *         Returns true if document is valid, false if not.
 *         """
 *         return self(etree)             # <<<<<<<<<<<<<<
 * 
 *     def assertValid(self, etree):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3684, __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;

  /* "lxml/etree.pyx":3677
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
 */

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

/* "lxml/etree.pyx":3686
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_5assertValid = {"assertValid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_5assertValid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_4assertValid};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assertValid (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3686, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "assertValid") < 0)) __PYX_ERR(0, 3686, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assertValid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3686, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Validator.assertValid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_4assertValid(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("assertValid", 1);

  /* "lxml/etree.pyx":3691
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
 */
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (unlikely(__pyx_t_6)) {

    /* "lxml/etree.pyx":3692
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document does not comply with schema"),
 *                                   self._error_log)
 */
    __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_ERR(0, 3692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "lxml/etree.pyx":3694
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
 *                                   self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def assert_(self, etree):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 3692, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->_error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->_error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log))) __PYX_ERR(0, 3692, __pyx_L1_error);
    __pyx_t_1 = 0;

    /* "lxml/etree.pyx":3692
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document does not comply with schema"),
 *                                   self._error_log)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_DocumentInvalid), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3692, __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_ERR(0, 3692, __pyx_L1_error)

    /* "lxml/etree.pyx":3691
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     "Document does not comply with schema"),
 */
  }

  /* "lxml/etree.pyx":3686
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """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_3);
  __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;
}

/* "lxml/etree.pyx":3696
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_7assert_ = {"assert_", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_7assert_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_6assert_};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_etree = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assert_ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3696, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "assert_") < 0)) __PYX_ERR(0, 3696, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assert_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3696, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree._Validator.assert_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_6assert_(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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("assert_", 1);

  /* "lxml/etree.pyx":3701
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 "Document does not comply with schema")
 */
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_etree};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (unlikely(__pyx_t_6)) {

    /* "lxml/etree.pyx":3702
 *         """
 *         if not self(etree):
 *             raise AssertionError, self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 "Document does not comply with schema")
 * 
 */
    __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_ERR(0, 3702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3702, __pyx_L1_error)

    /* "lxml/etree.pyx":3701
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 "Document does not comply with schema")
 */
  }

  /* "lxml/etree.pyx":3696
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """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_XDECREF(__pyx_t_3);
  __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;
}

/* "lxml/etree.pyx":3705
 *                 "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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_append_log_message", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append_log_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_10_Validator_9_append_log_message)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_level); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1; __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_9 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[7] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_v_message, __pyx_v_filename};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 6+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3705, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "lxml/etree.pyx":3707
 *     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_t_9 = __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); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 3707, __pyx_L1_error)

  /* "lxml/etree.pyx":3705
 *                 "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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_9_append_log_message = {"_append_log_message", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  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;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domain,&__pyx_n_s_type,&__pyx_n_s_level,&__pyx_n_s_line_2,&__pyx_n_s_message,&__pyx_n_s_filename,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_domain)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 1); __PYX_ERR(0, 3705, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_level)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 2); __PYX_ERR(0, 3705, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_line_2)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 3); __PYX_ERR(0, 3705, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 4); __PYX_ERR(0, 3705, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 5); __PYX_ERR(0, 3705, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_append_log_message") < 0)) __PYX_ERR(0, 3705, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
      values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
    }
    __pyx_v_domain = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
    __pyx_v_type = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
    __pyx_v_level = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
    __pyx_v_line = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_line == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3705, __pyx_L3_error)
    __pyx_v_message = values[4];
    __pyx_v_filename = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 3705, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_Validator__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_ERR(0, 3705, __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;
}

/* "lxml/etree.pyx":3710
 *                                         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*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;
  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("_clear_error_log", 1);
  /* 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_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear_error_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3710, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "lxml/etree.pyx":3711
 * 
 *     cpdef _clear_error_log(self):
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __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_ERR(0, 3711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "lxml/etree.pyx":3710
 *                                         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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10_Validator_11_clear_error_log = {"_clear_error_log", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_clear_error_log (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("_clear_error_log", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "_clear_error_log", 0))) return NULL;
  __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", 1);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_Validator__clear_error_log(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3710, __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;
}

/* "lxml/etree.pyx":3713
 *         self._error_log.clear()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "lxml/etree.pyx":3716
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_XPath_evaluator_not_initialised, 0, 0);
      __PYX_ERR(0, 3716, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 3716, __pyx_L1_error)
  #endif

  /* "lxml/etree.pyx":3717
 *         """The log of validation errors and warnings."""
 *         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_ERR(0, 3717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "lxml/etree.pyx":3713
 *         self._error_log.clear()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def error_log(self):
 *         """The log of validation errors and warnings."""
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":17
 * 
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, "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
  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("_assertValidDTDNode", 1);

  /* "src/lxml/dtd.pxi":18
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:
 *     assert c_node is not NULL, "invalid DTD proxy at %s" % id(node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_DTD_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(20, 18, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(20, 18, __pyx_L1_error)
  #endif

  /* "src/lxml/dtd.pxi":17
 * 
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, "invalid DTD proxy at %s" % id(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._assertValidDTDNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":28
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "src/lxml/dtd.pxi":29
 * 
 *     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
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(13); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__71);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__71);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__71);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_module_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__4);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_object_name);
  __pyx_t_2 += 13;
  __Pyx_GIVEREF(__pyx_kp_u_object_name);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_object_name);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_type_3);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_type_3);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_type_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_occur);
  __pyx_t_2 += 7;
  __Pyx_GIVEREF(__pyx_kp_u_occur);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_occur);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_occur_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_kp_u_at_0x);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_kp_u__29);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 13, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 29, __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;

  /* "src/lxml/dtd.pxi":28
 *     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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/dtd.pxi":31
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":33
 *     @property
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 33, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":34
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":31
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":36
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":38
 *     @property
 *     def type(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 == ((int)-1))) __PYX_ERR(20, 38, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":39
 *     def type(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;

  /* "src/lxml/dtd.pxi":40
 *        _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:
 */
  switch (__pyx_v_type) {
    case XML_ELEMENT_CONTENT_PCDATA:

    /* "src/lxml/dtd.pxi":41
 *        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_u_pcdata);
    __pyx_r = __pyx_n_u_pcdata;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":40
 *        _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:
 */
    break;
    case XML_ELEMENT_CONTENT_ELEMENT:

    /* "src/lxml/dtd.pxi":43
 *            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_u_element);
    __pyx_r = __pyx_n_u_element;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":42
 *        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:
 */
    break;
    case XML_ELEMENT_CONTENT_SEQ:

    /* "src/lxml/dtd.pxi":45
 *            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_u_seq);
    __pyx_r = __pyx_n_u_seq;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":44
 *        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:
 */
    break;
    case XML_ELEMENT_CONTENT_OR:

    /* "src/lxml/dtd.pxi":47
 *            return "seq"
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:
 *            return "or"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_u_or);
    __pyx_r = __pyx_n_u_or;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":46
 *        elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *            return "seq"
 *        elif type == tree.XML_ELEMENT_CONTENT_OR:             # <<<<<<<<<<<<<<
 *            return "or"
 *        else:
 */
    break;
    default:

    /* "src/lxml/dtd.pxi":49
 *            return "or"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":36
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":51
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":53
 *     @property
 *     def occur(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 == ((int)-1))) __PYX_ERR(20, 53, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":54
 *     def occur(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;

  /* "src/lxml/dtd.pxi":55
 *        _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:
 */
  switch (__pyx_v_occur) {
    case XML_ELEMENT_CONTENT_ONCE:

    /* "src/lxml/dtd.pxi":56
 *        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_u_once);
    __pyx_r = __pyx_n_u_once;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":55
 *        _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:
 */
    break;
    case XML_ELEMENT_CONTENT_OPT:

    /* "src/lxml/dtd.pxi":58
 *            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_u_opt);
    __pyx_r = __pyx_n_u_opt;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":57
 *        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:
 */
    break;
    case XML_ELEMENT_CONTENT_MULT:

    /* "src/lxml/dtd.pxi":60
 *            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_u_mult);
    __pyx_r = __pyx_n_u_mult;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":59
 *        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:
 */
    break;
    case XML_ELEMENT_CONTENT_PLUS:

    /* "src/lxml/dtd.pxi":62
 *            return "mult"
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 *            return "plus"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_u_plus);
    __pyx_r = __pyx_n_u_plus;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":61
 *        elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *            return "mult"
 *        elif occur == tree.XML_ELEMENT_CONTENT_PLUS:             # <<<<<<<<<<<<<<
 *            return "plus"
 *        else:
 */
    break;
    default:

    /* "src/lxml/dtd.pxi":64
 *            return "plus"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":51
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def occur(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":66
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":68
 *     @property
 *     def left(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 == ((int)-1))) __PYX_ERR(20, 68, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":69
 *     def left(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;

  /* "src/lxml/dtd.pxi":70
 *        _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) {

    /* "src/lxml/dtd.pxi":71
 *        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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 71, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":72
 *        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((PyObject *)__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;

    /* "src/lxml/dtd.pxi":73
 *            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);

    /* "src/lxml/dtd.pxi":74
 *            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;

    /* "src/lxml/dtd.pxi":70
 *        _assertValidDTDNode(self, self._c_node)
 *        c1 = self._c_node.c1
 *        if c1:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 */
  }

  /* "src/lxml/dtd.pxi":76
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":66
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def left(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":78
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":80
 *     @property
 *     def right(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 == ((int)-1))) __PYX_ERR(20, 80, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":81
 *     def right(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;

  /* "src/lxml/dtd.pxi":82
 *        _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) {

    /* "src/lxml/dtd.pxi":83
 *        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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 83, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":84
 *        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((PyObject *)__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;

    /* "src/lxml/dtd.pxi":85
 *            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);

    /* "src/lxml/dtd.pxi":86
 *            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;

    /* "src/lxml/dtd.pxi":82
 *        _assertValidDTDNode(self, self._c_node)
 *        c2 = self._c_node.c2
 *        if c2:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 */
  }

  /* "src/lxml/dtd.pxi":88
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":78
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def right(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":98
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "src/lxml/dtd.pxi":99
 * 
 *     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
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(19); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__71);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__71);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__71);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_module_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__4);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_object_name);
  __pyx_t_2 += 13;
  __Pyx_GIVEREF(__pyx_kp_u_object_name);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_object_name);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_elemname);
  __pyx_t_2 += 10;
  __Pyx_GIVEREF(__pyx_kp_u_elemname);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_elemname);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_elemname_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_prefix_2);
  __pyx_t_2 += 8;
  __Pyx_GIVEREF(__pyx_kp_u_prefix_2);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_prefix_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_type_3);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_type_3);
  PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_kp_u_type_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_default_2);
  __pyx_t_2 += 9;
  __Pyx_GIVEREF(__pyx_kp_u_default_2);
  PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_kp_u_default_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 13, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_default_value);
  __pyx_t_2 += 15;
  __Pyx_GIVEREF(__pyx_kp_u_default_value);
  PyTuple_SET_ITEM(__pyx_t_1, 14, __pyx_kp_u_default_value);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default_value_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 15, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 16, __pyx_kp_u_at_0x);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 17, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_1, 18, __pyx_kp_u__29);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 19, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":98
 *     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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/dtd.pxi":101
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":103
 *     @property
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 103, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":104
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":101
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":106
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":108
 *     @property
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.elem)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 108, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":109
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.elem)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->elem); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":106
 *        return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def elemname(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":111
 *        return funicodeOrNone(self._c_node.elem)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":113
 *     @property
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 113, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":114
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.prefix)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":111
 *        return funicodeOrNone(self._c_node.elem)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":116
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":118
 *     @property
 *     def type(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 == ((int)-1))) __PYX_ERR(20, 118, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":119
 *     def type(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;

  /* "src/lxml/dtd.pxi":120
 *        _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:
 */
  switch (__pyx_v_type) {
    case XML_ATTRIBUTE_CDATA:

    /* "src/lxml/dtd.pxi":121
 *        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_u_cdata);
    __pyx_r = __pyx_n_u_cdata;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":120
 *        _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:
 */
    break;
    case XML_ATTRIBUTE_ID:

    /* "src/lxml/dtd.pxi":123
 *            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_u_id);
    __pyx_r = __pyx_n_u_id;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":122
 *        if type == tree.XML_ATTRIBUTE_CDATA:
 *            return "cdata"
 *        elif type == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *            return "id"
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
 */
    break;
    case XML_ATTRIBUTE_IDREF:

    /* "src/lxml/dtd.pxi":125
 *            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_u_idref);
    __pyx_r = __pyx_n_u_idref;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":124
 *        elif type == tree.XML_ATTRIBUTE_ID:
 *            return "id"
 *        elif type == tree.XML_ATTRIBUTE_IDREF:             # <<<<<<<<<<<<<<
 *            return "idref"
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
 */
    break;
    case XML_ATTRIBUTE_IDREFS:

    /* "src/lxml/dtd.pxi":127
 *            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_u_idrefs);
    __pyx_r = __pyx_n_u_idrefs;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":126
 *        elif type == tree.XML_ATTRIBUTE_IDREF:
 *            return "idref"
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:             # <<<<<<<<<<<<<<
 *            return "idrefs"
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
 */
    break;
    case XML_ATTRIBUTE_ENTITY:

    /* "src/lxml/dtd.pxi":129
 *            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_u_entity);
    __pyx_r = __pyx_n_u_entity;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":128
 *        elif type == tree.XML_ATTRIBUTE_IDREFS:
 *            return "idrefs"
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:             # <<<<<<<<<<<<<<
 *            return "entity"
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
 */
    break;
    case XML_ATTRIBUTE_ENTITIES:

    /* "src/lxml/dtd.pxi":131
 *            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_u_entities);
    __pyx_r = __pyx_n_u_entities;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":130
 *        elif type == tree.XML_ATTRIBUTE_ENTITY:
 *            return "entity"
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:             # <<<<<<<<<<<<<<
 *            return "entities"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 */
    break;
    case XML_ATTRIBUTE_NMTOKEN:

    /* "src/lxml/dtd.pxi":133
 *            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_u_nmtoken);
    __pyx_r = __pyx_n_u_nmtoken;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":132
 *        elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *            return "entities"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:             # <<<<<<<<<<<<<<
 *            return "nmtoken"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 */
    break;
    case XML_ATTRIBUTE_NMTOKENS:

    /* "src/lxml/dtd.pxi":135
 *            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_u_nmtokens);
    __pyx_r = __pyx_n_u_nmtokens;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":134
 *        elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *            return "nmtoken"
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:             # <<<<<<<<<<<<<<
 *            return "nmtokens"
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 */
    break;
    case XML_ATTRIBUTE_ENUMERATION:

    /* "src/lxml/dtd.pxi":137
 *            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_u_enumeration);
    __pyx_r = __pyx_n_u_enumeration;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":136
 *        elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *            return "nmtokens"
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:             # <<<<<<<<<<<<<<
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:
 */
    break;
    case XML_ATTRIBUTE_NOTATION:

    /* "src/lxml/dtd.pxi":139
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:
 *            return "notation"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_u_notation);
    __pyx_r = __pyx_n_u_notation;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":138
 *        elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *            return "enumeration"
 *        elif type == tree.XML_ATTRIBUTE_NOTATION:             # <<<<<<<<<<<<<<
 *            return "notation"
 *        else:
 */
    break;
    default:

    /* "src/lxml/dtd.pxi":141
 *            return "notation"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":116
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":143
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":145
 *     @property
 *     def default(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 == ((int)-1))) __PYX_ERR(20, 145, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":146
 *     def default(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;

  /* "src/lxml/dtd.pxi":147
 *        _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:
 */
  switch (__pyx_v_default) {
    case XML_ATTRIBUTE_NONE:

    /* "src/lxml/dtd.pxi":148
 *        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_u_none);
    __pyx_r = __pyx_n_u_none;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":147
 *        _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:
 */
    break;
    case XML_ATTRIBUTE_REQUIRED:

    /* "src/lxml/dtd.pxi":150
 *            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_u_required);
    __pyx_r = __pyx_n_u_required;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":149
 *        if default == tree.XML_ATTRIBUTE_NONE:
 *            return "none"
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:             # <<<<<<<<<<<<<<
 *            return "required"
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
 */
    break;
    case XML_ATTRIBUTE_IMPLIED:

    /* "src/lxml/dtd.pxi":152
 *            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_u_implied);
    __pyx_r = __pyx_n_u_implied;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":151
 *        elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *            return "required"
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:             # <<<<<<<<<<<<<<
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:
 */
    break;
    case XML_ATTRIBUTE_FIXED:

    /* "src/lxml/dtd.pxi":154
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:
 *            return "fixed"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_u_fixed);
    __pyx_r = __pyx_n_u_fixed;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":153
 *        elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *            return "implied"
 *        elif default == tree.XML_ATTRIBUTE_FIXED:             # <<<<<<<<<<<<<<
 *            return "fixed"
 *        else:
 */
    break;
    default:

    /* "src/lxml/dtd.pxi":156
 *            return "fixed"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":143
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":158
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":160
 *     @property
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 160, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":161
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.defaultValue)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->defaultValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":158
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def default_value(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_4generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_3itervalues = {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("itervalues", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) return NULL;
  __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_13_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_13_itervalues *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(20, 163, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator13, __pyx_codeobj__99, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_DTDAttributeDecl_itervalues, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(20, 163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_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("itervalues", 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_ERR(20, 163, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":164
 * 
 *     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 == ((int)-1))) __PYX_ERR(20, 164, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":165
 *     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;

  /* "src/lxml/dtd.pxi":166
 *         _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);
    if (!__pyx_t_3) break;

    /* "src/lxml/dtd.pxi":167
 *         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_ERR(20, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(20, 167, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":168
 *         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;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     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_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":170
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_6values = {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) return NULL;
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 1);

  /* "src/lxml/dtd.pxi":171
 * 
 *     def values(self):
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 171, __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;

  /* "src/lxml/dtd.pxi":170
 *             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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/dtd.pxi":181
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "src/lxml/dtd.pxi":182
 * 
 *     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
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(13); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__71);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__71);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__71);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_module_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__4);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_object_name);
  __pyx_t_2 += 13;
  __Pyx_GIVEREF(__pyx_kp_u_object_name);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_object_name);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_prefix_2);
  __pyx_t_2 += 8;
  __Pyx_GIVEREF(__pyx_kp_u_prefix_2);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_prefix_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_type_3);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_type_3);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_type_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_kp_u_at_0x);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_kp_u__29);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 13, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 182, __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;

  /* "src/lxml/dtd.pxi":181
 *     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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/dtd.pxi":184
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":186
 *     @property
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 186, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":187
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":184
 *         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             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":189
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":191
 *     @property
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 191, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":192
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 *        return funicodeOrNone(self._c_node.prefix)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":189
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def prefix(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":194
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":196
 *     @property
 *     def type(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 == ((int)-1))) __PYX_ERR(20, 196, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":197
 *     def type(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;

  /* "src/lxml/dtd.pxi":198
 *        _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:
 */
  switch (__pyx_v_type) {
    case XML_ELEMENT_TYPE_UNDEFINED:

    /* "src/lxml/dtd.pxi":199
 *        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_u_undefined);
    __pyx_r = __pyx_n_u_undefined;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":198
 *        _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:
 */
    break;
    case XML_ELEMENT_TYPE_EMPTY:

    /* "src/lxml/dtd.pxi":201
 *            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_u_empty);
    __pyx_r = __pyx_n_u_empty;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":200
 *        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:
 */
    break;
    case XML_ELEMENT_TYPE_ANY:

    /* "src/lxml/dtd.pxi":203
 *            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_u_any);
    __pyx_r = __pyx_n_u_any;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":202
 *        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:
 */
    break;
    case XML_ELEMENT_TYPE_MIXED:

    /* "src/lxml/dtd.pxi":205
 *            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_u_mixed);
    __pyx_r = __pyx_n_u_mixed;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":204
 *        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:
 */
    break;
    case XML_ELEMENT_TYPE_ELEMENT:

    /* "src/lxml/dtd.pxi":207
 *            return "mixed"
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 *            return "element"             # <<<<<<<<<<<<<<
 *        else:
 *            return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_u_element);
    __pyx_r = __pyx_n_u_element;
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":206
 *        elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *            return "mixed"
 *        elif type == tree.XML_ELEMENT_TYPE_ELEMENT:             # <<<<<<<<<<<<<<
 *            return "element"
 *        else:
 */
    break;
    default:

    /* "src/lxml/dtd.pxi":209
 *            return "element"
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "src/lxml/dtd.pxi":194
 *        return funicodeOrNone(self._c_node.prefix)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":211
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":213
 *     @property
 *     def content(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 == ((int)-1))) __PYX_ERR(20, 213, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":214
 *     def content(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;

  /* "src/lxml/dtd.pxi":215
 *        _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) {

    /* "src/lxml/dtd.pxi":216
 *        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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)__pyx_ptype_4lxml_5etree__DTDElementContentDecl), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 216, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "src/lxml/dtd.pxi":217
 *        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((PyObject *)__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;

    /* "src/lxml/dtd.pxi":218
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 *            node._c_node = content             # <<<<<<<<<<<<<<
 *            return node
 *        else:
 */
    __pyx_v_node->_c_node = __pyx_v_content;

    /* "src/lxml/dtd.pxi":219
 *            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;

    /* "src/lxml/dtd.pxi":215
 *        _assertValidDTDNode(self, self._c_node)
 *        cdef tree.xmlElementContent *content = self._c_node.content
 *        if content:             # <<<<<<<<<<<<<<
 *            node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *            node._dtd = self._dtd
 */
  }

  /* "src/lxml/dtd.pxi":221
 *            return node
 *        else:
 *            return None             # <<<<<<<<<<<<<<
 * 
 *     def iterattributes(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "src/lxml/dtd.pxi":211
 *            return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *        _assertValidDTDNode(self, self._c_node)
 */

  /* 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_4generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":223
 *            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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DTDElementDecl_3iterattributes = {"iterattributes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterattributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iterattributes", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterattributes", 0))) return NULL;
  __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_14_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_14_iterattributes *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(20, 223, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator14, __pyx_codeobj__100, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterattributes, __pyx_n_s_DTDElementDecl_iterattributes, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(20, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_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("iterattributes", 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_ERR(20, 223, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":224
 * 
 *     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 == ((int)-1))) __PYX_ERR(20, 224, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":225
 *     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;

  /* "src/lxml/dtd.pxi":226
 *         _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;

    /* "src/lxml/dtd.pxi":227
 *         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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(((PyTypeObject *)__pyx_ptype_4lxml_5etree__DTDAttributeDecl), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 227, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF((PyObject *)__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;

    /* "src/lxml/dtd.pxi":228
 *         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((PyObject *)__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;

    /* "src/lxml/dtd.pxi":229
 *             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;

    /* "src/lxml/dtd.pxi":230
 *             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();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(20, 230, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":231
 *             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;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":223
 *            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_Generator_Replace_StopIteration(0);
  __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_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":233
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_15_DTDElementDecl_6attributes = {"attributes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("attributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("attributes", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "attributes", 0))) return NULL;
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributes", 1);

  /* "src/lxml/dtd.pxi":234
 * 
 *     def attributes(self):
 *         return list(self.iterattributes())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterattributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 234, __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;

  /* "src/lxml/dtd.pxi":233
 *             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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/dtd.pxi":243
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 1);

  /* "src/lxml/dtd.pxi":244
 *     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
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__71);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__71);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__71);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_module_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__4);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_object_name);
  __pyx_t_2 += 13;
  __Pyx_GIVEREF(__pyx_kp_u_object_name);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_object_name);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_at_0x);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__29);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__29);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u__29);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 244, __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;

  /* "src/lxml/dtd.pxi":243
 *     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_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;
}

/* "src/lxml/dtd.pxi":246
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":248
 *     @property
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 248, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":249
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":246
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":251
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":253
 *     @property
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.orig)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 253, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":254
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.orig)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->orig); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":251
 *         return funicodeOrNone(self._c_node.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def orig(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":256
 *         return funicodeOrNone(self._c_node.orig)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":258
 *     @property
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.content)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 258, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":259
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":256
 *         return funicodeOrNone(self._c_node.orig)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def content(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/dtd.pxi":261
 *         return funicodeOrNone(self._c_node.content)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_10system_url___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_10system_url___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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);

  /* "src/lxml/dtd.pxi":263
 *     @property
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         return funicodeOrNone(self._c_node.SystemID)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(20, 263, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":264
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         return funicodeOrNone(self._c_node.SystemID)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_node->SystemID); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":261
 *         return funicodeOrNone(self._c_node.content)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *         _assertValidDTDNode(self, self._c_node)
 */

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

/* "src/lxml/dtd.pxi":279
 *     """
 *     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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_external_id,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(20, 279, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(20, 279, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(20, 279, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_file = values[0];
    __pyx_v_external_id = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(20, 279, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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) {
  xmlExternalEntityLoader __pyx_v_orig_loader;
  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;
  xmlDtd *__pyx_t_10;
  const xmlChar *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_file);

  /* "src/lxml/dtd.pxi":280
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__Validator), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 280, __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;

  /* "src/lxml/dtd.pxi":281
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 */
  __pyx_t_5 = (__pyx_v_file != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/dtd.pxi":282
 *         _Validator.__init__(self)
 *         if file is not None:
 *             file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/dtd.pxi":283
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 */
    __pyx_t_5 = _isString(__pyx_v_file);
    if (__pyx_t_5) {

      /* "src/lxml/dtd.pxi":284
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 *                 file = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/dtd.pxi":285
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 */
      /*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_ERR(20, 285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(20, 285, __pyx_L5_error)
        /*try:*/ {
          {
            (void)__pyx_t_7; (void)__pyx_t_8; (void)__pyx_t_9; /* mark used */
            /*try:*/ {

              /* "src/lxml/dtd.pxi":286
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
 */
              __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

              /* "src/lxml/dtd.pxi":287
 *                 with self._error_log:
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))             # <<<<<<<<<<<<<<
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):
 */
              __pyx_v_self->_c_dtd = xmlParseDTD(NULL, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_file));

              /* "src/lxml/dtd.pxi":288
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()
 */
              __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

              /* "src/lxml/dtd.pxi":285
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     orig_loader = _register_document_loader()
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 */
            }
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 285, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            }
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
        goto __pyx_L15;
        __pyx_L5_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L15:;
      }

      /* "src/lxml/dtd.pxi":283
 *         if file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 */
      goto __pyx_L4;
    }

    /* "src/lxml/dtd.pxi":289
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 */
    __pyx_t_5 = __Pyx_HasAttr(__pyx_v_file, __pyx_n_u_read); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(20, 289, __pyx_L1_error)
    if (likely(__pyx_t_5)) {

      /* "src/lxml/dtd.pxi":290
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *                 _reset_document_loader(orig_loader)
 */
      __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

      /* "src/lxml/dtd.pxi":291
 *             elif hasattr(file, 'read'):
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *             else:
 */
      __pyx_t_10 = __pyx_f_4lxml_5etree__parseDtdFromFilelike(__pyx_v_file); if (unlikely(__pyx_t_10 == ((xmlDtd *)NULL))) __PYX_ERR(20, 291, __pyx_L1_error)
      __pyx_v_self->_c_dtd = __pyx_t_10;

      /* "src/lxml/dtd.pxi":292
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 */
      __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

      /* "src/lxml/dtd.pxi":289
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *                     _reset_document_loader(orig_loader)
 *             elif hasattr(file, 'read'):             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 */
      goto __pyx_L4;
    }

    /* "src/lxml/dtd.pxi":294
 *                 _reset_document_loader(orig_loader)
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"             # <<<<<<<<<<<<<<
 *         elif external_id is not None:
 *             with self._error_log:
 */
    /*else*/ {
      __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_kp_u_file_must_be_a_filename_file_lik, 0, 0);
      __PYX_ERR(20, 294, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "src/lxml/dtd.pxi":281
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/dtd.pxi":295
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 */
  __pyx_t_5 = (__pyx_v_external_id != Py_None);
  if (likely(__pyx_t_5)) {

    /* "src/lxml/dtd.pxi":296
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 */
    /*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_ERR(20, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(20, 296, __pyx_L16_error)
      /*try:*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_7);
          /*try:*/ {

            /* "src/lxml/dtd.pxi":297
 *         elif external_id is not None:
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *                 _reset_document_loader(orig_loader)
 */
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/dtd.pxi":298
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         else:
 */
            __pyx_t_11 = __Pyx_PyObject_AsUString(__pyx_v_external_id); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(20, 298, __pyx_L20_error)
            __pyx_v_self->_c_dtd = xmlParseDTD(((const xmlChar *)__pyx_t_11), NULL);

            /* "src/lxml/dtd.pxi":299
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         else:
 *             raise DTDParseError, "either filename or external ID required"
 */
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/dtd.pxi":296
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 */
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L25_try_end;
          __pyx_L20_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;
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(20, 296, __pyx_L22_except_error)
            __Pyx_XGOTREF(__pyx_t_1);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_3);
            __pyx_t_12 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(20, 296, __pyx_L22_except_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_13)) __PYX_ERR(20, 296, __pyx_L22_except_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (__pyx_t_5 < 0) __PYX_ERR(20, 296, __pyx_L22_except_error)
            __pyx_t_14 = (!__pyx_t_5);
            if (unlikely(__pyx_t_14)) {
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_XGIVEREF(__pyx_t_3);
              __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
              __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
              __PYX_ERR(20, 296, __pyx_L22_except_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;
            goto __pyx_L21_exception_handled;
          }
          __pyx_L22_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
          goto __pyx_L1_error;
          __pyx_L21_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
          __pyx_L25_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_6) {
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__38, NULL);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 296, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          goto __pyx_L19;
        }
        __pyx_L19:;
      }
      goto __pyx_L29;
      __pyx_L16_error:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L1_error;
      __pyx_L29:;
    }

    /* "src/lxml/dtd.pxi":295
 *             else:
 *                 raise DTDParseError, "file must be a filename, file-like or path-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 */
    goto __pyx_L3;
  }

  /* "src/lxml/dtd.pxi":301
 *                 _reset_document_loader(orig_loader)
 *         else:
 *             raise DTDParseError, "either filename or external ID required"             # <<<<<<<<<<<<<<
 * 
 *         if self._c_dtd is NULL:
 */
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_kp_u_either_filename_or_external_ID_r, 0, 0);
    __PYX_ERR(20, 301, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/dtd.pxi":303
 *             raise DTDParseError, "either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
 */
  __pyx_t_14 = (__pyx_v_self->_c_dtd == NULL);
  if (unlikely(__pyx_t_14)) {

    /* "src/lxml/dtd.pxi":305
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),             # <<<<<<<<<<<<<<
 *                 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_error_parsing_DTD); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/dtd.pxi":304
 * 
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
 *                 self._error_log)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(20, 304, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(20, 304, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 304, __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_ERR(20, 304, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":303
 *             raise DTDParseError, "either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage("error parsing DTD"),
 */
  }

  /* "src/lxml/dtd.pxi":279
 *     """
 *     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_12);
  __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;
}

/* "src/lxml/dtd.pxi":308
 *                 self._error_log)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        if self._c_dtd is NULL:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":310
 *     @property
 *     def name(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)
 */
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":311
 *     def name(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.name)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":310
 *     @property
 *     def name(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)
 */
  }

  /* "src/lxml/dtd.pxi":312
 *        if self._c_dtd is NULL:
 *            return None
 *        return funicodeOrNone(self._c_dtd.name)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->name); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":308
 *                 self._error_log)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *        if self._c_dtd is NULL:
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":314
 *        return funicodeOrNone(self._c_dtd.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def external_id(self):
 *        if self._c_dtd is NULL:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":316
 *     @property
 *     def external_id(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 */
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":317
 *     def external_id(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":316
 *     @property
 *     def external_id(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 */
  }

  /* "src/lxml/dtd.pxi":318
 *        if self._c_dtd is NULL:
 *            return None
 *        return funicodeOrNone(self._c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->ExternalID); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":314
 *        return funicodeOrNone(self._c_dtd.name)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def external_id(self):
 *        if self._c_dtd is NULL:
 */

  /* 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;
}

/* "src/lxml/dtd.pxi":320
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *        if self._c_dtd is NULL:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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__", 1);

  /* "src/lxml/dtd.pxi":322
 *     @property
 *     def system_url(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.SystemID)
 */
  __pyx_t_1 = (__pyx_v_self->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":323
 *     def system_url(self):
 *        if self._c_dtd is NULL:
 *            return None             # <<<<<<<<<<<<<<
 *        return funicodeOrNone(self._c_dtd.SystemID)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":322
 *     @property
 *     def system_url(self):
 *        if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *            return None
 *        return funicodeOrNone(self._c_dtd.SystemID)
 */
  }

  /* "src/lxml/dtd.pxi":324
 *        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_ERR(20, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":320
 *        return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def system_url(self):
 *        if self._c_dtd is NULL:
 */

  /* 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_4generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":326
 *        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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_3iterelements = {"iterelements", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_3iterelements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_3iterelements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterelements (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iterelements", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterelements", 0))) return NULL;
  __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_15_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_15_iterelements *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(20, 326, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_3DTD_4generator15, __pyx_codeobj__101, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterelements, __pyx_n_s_DTD_iterelements, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(20, 326, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_4generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_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("iterelements", 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_ERR(20, 326, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":327
 * 
 *     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:
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL);
  if (__pyx_t_2) {
    __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;

  /* "src/lxml/dtd.pxi":328
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/dtd.pxi":329
 *         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);
    if (__pyx_t_2) {

      /* "src/lxml/dtd.pxi":330
 *         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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__DTDElementDecl)); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 330, __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;

      /* "src/lxml/dtd.pxi":331
 *             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((PyObject *)__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;

      /* "src/lxml/dtd.pxi":332
 *                 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);

      /* "src/lxml/dtd.pxi":333
 *                 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();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(20, 333, __pyx_L1_error)

      /* "src/lxml/dtd.pxi":329
 *         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
 */
    }

    /* "src/lxml/dtd.pxi":334
 *                 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;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":326
 *        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_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":336
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_6elements = {"elements", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_6elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_6elements(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elements (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("elements", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "elements", 0))) return NULL;
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elements", 1);

  /* "src/lxml/dtd.pxi":337
 * 
 *     def elements(self):
 *         return list(self.iterelements())             # <<<<<<<<<<<<<<
 * 
 *     def iterentities(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterelements); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 337, __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;

  /* "src/lxml/dtd.pxi":336
 *             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_XDECREF(__pyx_t_3);
  __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_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "src/lxml/dtd.pxi":339
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_8iterentities = {"iterentities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_8iterentities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_8iterentities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterentities (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("iterentities", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterentities", 0))) return NULL;
  __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_16_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_16_iterentities *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(20, 339, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_5etree_3DTD_9generator16, __pyx_codeobj__102, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterentities, __pyx_n_s_DTD_iterentities, __pyx_n_s_lxml_etree); if (unlikely(!gen)) __PYX_ERR(20, 339, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_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("iterentities", 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_ERR(20, 339, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":340
 * 
 *     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:
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL);
  if (__pyx_t_2) {
    __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;

  /* "src/lxml/dtd.pxi":341
 *     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);
    if (!__pyx_t_2) break;

    /* "src/lxml/dtd.pxi":342
 *         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);
    if (__pyx_t_2) {

      /* "src/lxml/dtd.pxi":343
 *         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_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__DTDEntityDecl)); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 343, __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;

      /* "src/lxml/dtd.pxi":344
 *             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((PyObject *)__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;

      /* "src/lxml/dtd.pxi":345
 *                 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);

      /* "src/lxml/dtd.pxi":346
 *                 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();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(20, 346, __pyx_L1_error)

      /* "src/lxml/dtd.pxi":342
 *         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
 */
    }

    /* "src/lxml/dtd.pxi":347
 *                 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;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "src/lxml/dtd.pxi":339
 *         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_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":349
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_3DTD_11entities = {"entities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_11entities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11entities(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("entities (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("entities", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "entities", 0))) return NULL;
  __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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("entities", 1);

  /* "src/lxml/dtd.pxi":350
 * 
 *     def entities(self):
 *         return list(self.iterentities())             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterentities); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 350, __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;

  /* "src/lxml/dtd.pxi":349
 *             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_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/dtd.pxi":352
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "src/lxml/dtd.pxi":353
 * 
 *     def __dealloc__(self):
 *         tree.xmlFreeDtd(self._c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlFreeDtd(__pyx_v_self->_c_dtd);

  /* "src/lxml/dtd.pxi":352
 *         return list(self.iterentities())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 */

  /* function exit code */
}

/* "src/lxml/dtd.pxi":355
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(20, 355, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(20, 355, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(20, 355, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlDoc *__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_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__", 1);

  /* "src/lxml/dtd.pxi":366
 *         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;

  /* "src/lxml/dtd.pxi":368
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_dtd != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_DTD_not_initialised, 0, 0);
      __PYX_ERR(20, 368, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(20, 368, __pyx_L1_error)
  #endif

  /* "src/lxml/dtd.pxi":369
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":370
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":372
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise DTDError("Failed to create validation context")
 */
  __pyx_v_valid_ctxt = xmlNewValidCtxt();

  /* "src/lxml/dtd.pxi":373
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDError("Failed to create validation context")
 * 
 */
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/dtd.pxi":374
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             raise DTDError("Failed to create validation context")             # <<<<<<<<<<<<<<
 * 
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_DTDError), __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 374, __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_ERR(20, 374, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":373
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDError("Failed to create validation context")
 * 
 */
  }

  /* "src/lxml/dtd.pxi":378
 *         # 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);

  /* "src/lxml/dtd.pxi":379
 *         # 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;

  /* "src/lxml/dtd.pxi":381
 *         valid_ctxt.userData = NULL
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
  /*try:*/ {

    /* "src/lxml/dtd.pxi":382
 * 
 *         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_3 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 382, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(20, 382, __pyx_L7_error)
      /*try:*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __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:*/ {

            /* "src/lxml/dtd.pxi":383
 *         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_8 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_8 == ((xmlDoc *)NULL))) __PYX_ERR(20, 383, __pyx_L11_error)
            __pyx_v_c_doc = __pyx_t_8;

            /* "src/lxml/dtd.pxi":384
 *             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);

            /* "src/lxml/dtd.pxi":385
 *                 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);

            /* "src/lxml/dtd.pxi":382
 * 
 *         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_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_L16_try_end;
          __pyx_L11_error:;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(20, 382, __pyx_L13_except_error)
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            __pyx_t_11 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(20, 382, __pyx_L13_except_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(20, 382, __pyx_L13_except_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (__pyx_t_1 < 0) __PYX_ERR(20, 382, __pyx_L13_except_error)
            __pyx_t_13 = (!__pyx_t_1);
            if (unlikely(__pyx_t_13)) {
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_9);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_9, __pyx_t_10);
              __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; 
              __PYX_ERR(20, 382, __pyx_L13_except_error)
            }
            __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;
            goto __pyx_L12_exception_handled;
          }
          __pyx_L13_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_L5_error;
          __pyx_L12_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_L16_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_3) {
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__38, NULL);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 382, __pyx_L5_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      goto __pyx_L20;
      __pyx_L7_error:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5_error;
      __pyx_L20:;
    }
  }

  /* "src/lxml/dtd.pxi":387
 *                 _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;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_12 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_5, &__pyx_t_12, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_7, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_4 = __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_5);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_12, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_7, __pyx_t_6);
      __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_12 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "src/lxml/dtd.pxi":389
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
 */
  __pyx_t_13 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_13)) {

    /* "src/lxml/dtd.pxi":390
 * 
 *         if ret == -1:
 *             raise DTDValidateError("Internal error in DTD validation",             # <<<<<<<<<<<<<<
 *                                    self._error_log)
 *         return ret == 1
 */
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(20, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_DTD_validation);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_DTD_validation);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u_Internal_error_in_DTD_validation)) __PYX_ERR(20, 390, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(20, 390, __pyx_L1_error);
    __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_DTDValidateError), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(20, 390, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":389
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
 */
  }

  /* "src/lxml/dtd.pxi":392
 *             raise DTDValidateError("Internal error in DTD validation",
 *                                    self._error_log)
 *         return ret == 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __Pyx_PyBool_FromLong((__pyx_v_ret == 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":355
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __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;
}

/* "src/lxml/dtd.pxi":395
 * 
 * 
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDtdFromFilelike", 1);

  /* "src/lxml/dtd.pxi":399
 *     cdef _FileReaderContext dtd_parser
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd = NULL             # <<<<<<<<<<<<<<
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 */
  __pyx_v_c_dtd = NULL;

  /* "src/lxml/dtd.pxi":400
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd = NULL
 *     exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ExceptionContext)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 400, __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;

  /* "src/lxml/dtd.pxi":401
 *     cdef tree.xmlDtd* c_dtd = NULL
 *     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_ERR(20, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_file);
  __Pyx_GIVEREF(__pyx_v_file);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file)) __PYX_ERR(20, 401, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_exc_context);
  __Pyx_GIVEREF((PyObject *)__pyx_v_exc_context);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_exc_context))) __PYX_ERR(20, 401, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(20, 401, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__FileReaderContext), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 401, __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;

  /* "src/lxml/dtd.pxi":402
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     with error_log:
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog)); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 402, __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;

  /* "src/lxml/dtd.pxi":404
 *     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_ERR(20, 404, __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 == ((int)-1))) __PYX_ERR(20, 404, __pyx_L3_error)
    /*try:*/ {
      {
        (void)__pyx_t_5; (void)__pyx_t_6; (void)__pyx_t_7; /* mark used */
        /*try:*/ {

          /* "src/lxml/dtd.pxi":405
 * 
 *     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);

          /* "src/lxml/dtd.pxi":404
 *     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__38, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 404, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L13;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L1_error;
    __pyx_L13:;
  }

  /* "src/lxml/dtd.pxi":407
 *         c_dtd = dtd_parser._readDtd()
 * 
 *     exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if c_dtd is NULL:
 *         raise DTDParseError("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 == ((int)-1))) __PYX_ERR(20, 407, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":408
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd
 */
  __pyx_t_8 = (__pyx_v_c_dtd == NULL);
  if (unlikely(__pyx_t_8)) {

    /* "src/lxml/dtd.pxi":409
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:
 *         raise DTDParseError("error parsing DTD", error_log)             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_u_error_parsing_DTD);
    __Pyx_GIVEREF(__pyx_kp_u_error_parsing_DTD);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_error_parsing_DTD)) __PYX_ERR(20, 409, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_error_log))) __PYX_ERR(20, 409, __pyx_L1_error);
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_DTDParseError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 409, __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_ERR(20, 409, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":408
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd
 */
  }

  /* "src/lxml/dtd.pxi":410
 *     if c_dtd is NULL:
 *         raise DTDParseError("error parsing DTD", error_log)
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):
 */
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":395
 * 
 * 
 * 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_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;
}

/* "src/lxml/dtd.pxi":412
 *     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_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_dtdFactory", 1);

  /* "src/lxml/dtd.pxi":415
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":416
 *     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_r = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/dtd.pxi":415
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     dtd = DTD.__new__(DTD)
 */
  }

  /* "src/lxml/dtd.pxi":417
 *     if c_dtd is NULL:
 *         return None
 *     dtd = DTD.__new__(DTD)             # <<<<<<<<<<<<<<
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)
 */
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_4lxml_5etree_DTD(((PyTypeObject *)__pyx_ptype_4lxml_5etree_DTD), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 417, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":418
 *         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 == ((xmlDtd *)NULL))) __PYX_ERR(20, 418, __pyx_L1_error)
  __pyx_v_dtd->_c_dtd = __pyx_t_3;

  /* "src/lxml/dtd.pxi":419
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)             # <<<<<<<<<<<<<<
 *     return dtd
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__Validator), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_dtd)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/dtd.pxi":420
 *     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;

  /* "src/lxml/dtd.pxi":412
 *     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;
}

/* "src/lxml/dtd.pxi":423
 * 
 * 
 * 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;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/dtd.pxi":428
 *     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);

  /* "src/lxml/dtd.pxi":429
 *     """
 *     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));
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/dtd.pxi":430
 *     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_ERR(20, 430, __pyx_L1_error)

    /* "src/lxml/dtd.pxi":429
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:             # <<<<<<<<<<<<<<
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
 */
  }

  /* "src/lxml/dtd.pxi":431
 *     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;

  /* "src/lxml/dtd.pxi":432
 *         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;

    /* "src/lxml/dtd.pxi":433
 *     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);
    if (__pyx_t_1) {

      /* "src/lxml/dtd.pxi":434
 *     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));

      /* "src/lxml/dtd.pxi":433
 *     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
 */
    }

    /* "src/lxml/dtd.pxi":435
 *         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;
  }

  /* "src/lxml/dtd.pxi":436
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":423
 * 
 * 
 * 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:;
  return __pyx_r;
}

/* "src/lxml/dtd.pxi":439
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     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;
  int __pyx_t_1;
  xmlAttribute *__pyx_t_2;
  int __pyx_t_3;

  /* "src/lxml/dtd.pxi":444
 *     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);

  /* "src/lxml/dtd.pxi":445
 *     """
 *     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));
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":447
 *     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;

    /* "src/lxml/dtd.pxi":445
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)
 *     if not c_elem:             # <<<<<<<<<<<<<<
 *         # no such element? something is wrong with the DTD ...
 *         return
 */
  }

  /* "src/lxml/dtd.pxi":448
 *         # 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;

  /* "src/lxml/dtd.pxi":449
 *         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));
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":450
 *     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;

    /* "src/lxml/dtd.pxi":451
 *     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;

    /* "src/lxml/dtd.pxi":452
 *         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;

    /* "src/lxml/dtd.pxi":449
 *         return
 *     c_pos = c_elem.attributes
 *     if not c_pos:             # <<<<<<<<<<<<<<
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
 */
  }

  /* "src/lxml/dtd.pxi":455
 *     # 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);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":456
 *     # 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));
    if (__pyx_t_1) {

      /* "src/lxml/dtd.pxi":457
 *     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;

      /* "src/lxml/dtd.pxi":458
 *         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;

      /* "src/lxml/dtd.pxi":459
 *             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;

      /* "src/lxml/dtd.pxi":456
 *     # 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
 */
    }

    /* "src/lxml/dtd.pxi":460
 *             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_3 = (__pyx_v_c_pos != __pyx_v_c_attr);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_pos->nexth != 0);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_3 = __pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_pos->nexth);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L9_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/dtd.pxi":461
 *             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;
    }

    /* "src/lxml/dtd.pxi":455
 *     # 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
 */
    goto __pyx_L5;
  }

  /* "src/lxml/dtd.pxi":464
 *     else:
 *         # append at end
 *         while c_pos != c_attr and c_pos.nexth:             # <<<<<<<<<<<<<<
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:
 */
  /*else*/ {
    while (1) {
      __pyx_t_3 = (__pyx_v_c_pos != __pyx_v_c_attr);
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_3 = (__pyx_v_c_pos->nexth != 0);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L14_bool_binop_done:;
      if (!__pyx_t_1) break;

      /* "src/lxml/dtd.pxi":465
 *         # 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:;

  /* "src/lxml/dtd.pxi":466
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":467
 *             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;

    /* "src/lxml/dtd.pxi":466
 *         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
 */
  }

  /* "src/lxml/dtd.pxi":468
 *     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;

  /* "src/lxml/dtd.pxi":469
 *         return
 *     c_attr.nexth = c_pos.nexth
 *     c_pos.nexth = c_attr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_c_pos->nexth = __pyx_v_c_attr;

  /* "src/lxml/dtd.pxi":439
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Create the link to the DTD attribute declaration from the corresponding
 */

  /* function exit code */
  __pyx_L0:;
}

/* "src/lxml/dtd.pxi":472
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "src/lxml/dtd.pxi":473
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     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), ((char const *)"xmlns")) == 0);
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":474
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     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;

    /* "src/lxml/dtd.pxi":473
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     if (c_attr.prefix is not NULL and
 */
  }

  /* "src/lxml/dtd.pxi":475
 *     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_2 = (__pyx_v_c_attr->prefix != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }

  /* "src/lxml/dtd.pxi":476
 *         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), ((char const *)"xmlns")) == 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;

  /* "src/lxml/dtd.pxi":475
 *     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
 */
  if (__pyx_t_1) {

    /* "src/lxml/dtd.pxi":477
 *     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;

    /* "src/lxml/dtd.pxi":475
 *     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
 */
  }

  /* "src/lxml/dtd.pxi":478
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/dtd.pxi":472
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr) noexcept:             # <<<<<<<<<<<<<<
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":11
 * 
 * 
 * cdef int _require_rnc2rng() except -1:             # <<<<<<<<<<<<<<
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(
 */

static int __pyx_f_4lxml_5etree__require_rnc2rng(void) {
  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("_require_rnc2rng", 1);

  /* "src/lxml/relaxng.pxi":12
 * 
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:             # <<<<<<<<<<<<<<
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__rnc2rng == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":13
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *             'compact syntax not supported (please install rnc2rng)')
 *     return 0
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGParseError), __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 13, __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_ERR(21, 13, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":12
 * 
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:             # <<<<<<<<<<<<<<
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
 */
  }

  /* "src/lxml/relaxng.pxi":15
 *         raise RelaxNGParseError(
 *             'compact syntax not supported (please install rnc2rng)')
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "src/lxml/relaxng.pxi":11
 * 
 * 
 * cdef int _require_rnc2rng() except -1:             # <<<<<<<<<<<<<<
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(
 */

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

/* "src/lxml/relaxng.pxi":42
 *     """
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/relaxng.pxi":43
 *     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;

  /* "src/lxml/relaxng.pxi":42
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":45
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 45, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 45, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(21, 45, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(21, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  xmlDoc *__pyx_v_fake_c_doc;
  xmlRelaxNGParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_rng_data_utf8 = NULL;
  PyObject *__pyx_v_filename = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  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;
  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;
  struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/relaxng.pxi":48
 *         cdef _Document doc
 *         cdef _Element root_node
 *         cdef xmlDoc* fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 */
  __pyx_v_fake_c_doc = NULL;

  /* "src/lxml/relaxng.pxi":49
 *         cdef _Element root_node
 *         cdef xmlDoc* fake_c_doc = NULL
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if etree is not None:
 */
  __pyx_v_parser_ctxt = NULL;

  /* "src/lxml/relaxng.pxi":50
 *         cdef xmlDoc* fake_c_doc = NULL
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__Validator), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 50, __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;

  /* "src/lxml/relaxng.pxi":51
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_5 = (__pyx_v_etree != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/relaxng.pxi":52
 *         _Validator.__init__(self)
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/relaxng.pxi":53
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/relaxng.pxi":54
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             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_6 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_6 == ((xmlDoc *)NULL))) __PYX_ERR(21, 54, __pyx_L1_error)
    __pyx_v_fake_c_doc = __pyx_t_6;

    /* "src/lxml/relaxng.pxi":55
 *             root_node = _rootNodeOrRaise(etree)
 *             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);

    /* "src/lxml/relaxng.pxi":51
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/relaxng.pxi":56
 *             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):
 *                 if file[-4:].lower() == '.rnc':
 */
  __pyx_t_5 = (__pyx_v_file != Py_None);
  if (likely(__pyx_t_5)) {

    /* "src/lxml/relaxng.pxi":57
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
 */
    __pyx_t_5 = _isString(__pyx_v_file);
    if (__pyx_t_5) {

      /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 */
      __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_file, -4L, 0, NULL, NULL, &__pyx_slice__105, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 58, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_rnc, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(21, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {

        /* "src/lxml/relaxng.pxi":59
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()             # <<<<<<<<<<<<<<
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(21, 59, __pyx_L1_error)

        /* "src/lxml/relaxng.pxi":60
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))             # <<<<<<<<<<<<<<
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_load); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        __pyx_t_4 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_4 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_file};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 60, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_t_7 = NULL;
        __pyx_t_4 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_4 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 60, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_rng_data_utf8 = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/relaxng.pxi":61
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)             # <<<<<<<<<<<<<<
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *                 else:
 */
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_data_utf8, __pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 61, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "src/lxml/relaxng.pxi":62
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                     doc = _parseMemoryDocument(rng_data_utf8, parser=None, url=file)
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *                 else:
 *                     doc = None
 */
        __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);

        /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 */
        goto __pyx_L5;
      }

      /* "src/lxml/relaxng.pxi":64
 *                     parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *                 else:
 *                     doc = None             # <<<<<<<<<<<<<<
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:
 */
      /*else*/ {
        __Pyx_INCREF(Py_None);
        __pyx_v_doc = ((struct LxmlDocument *)Py_None);

        /* "src/lxml/relaxng.pxi":65
 *                 else:
 *                     doc = None
 *                     filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_filename = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "src/lxml/relaxng.pxi":66
 *                     doc = None
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:             # <<<<<<<<<<<<<<
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 */
        /*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_ERR(21, 66, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(21, 66, __pyx_L6_error)
          /*try:*/ {
            {
              (void)__pyx_t_10; (void)__pyx_t_11; (void)__pyx_t_12; /* mark used */
              /*try:*/ {

                /* "src/lxml/relaxng.pxi":67
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
 */
                __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

                /* "src/lxml/relaxng.pxi":68
 *                     with self._error_log:
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 */
                __pyx_v_parser_ctxt = xmlRelaxNGNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

                /* "src/lxml/relaxng.pxi":69
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()
 */
                __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

                /* "src/lxml/relaxng.pxi":66
 *                     doc = None
 *                     filename = _encodeFilename(file)
 *                     with self._error_log:             # <<<<<<<<<<<<<<
 *                         orig_loader = _register_document_loader()
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 */
              }
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_9) {
                __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__38, NULL);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (unlikely(!__pyx_t_12)) __PYX_ERR(21, 66, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              }
              goto __pyx_L9;
            }
            __pyx_L9:;
          }
          goto __pyx_L16;
          __pyx_L6_error:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L1_error;
          __pyx_L16:;
        }
      }
      __pyx_L5:;

      /* "src/lxml/relaxng.pxi":57
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 if file[-4:].lower() == '.rnc':
 *                     _require_rnc2rng()
 */
      goto __pyx_L4;
    }

    /* "src/lxml/relaxng.pxi":70
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(21, 70, __pyx_L1_error)
    if (!__pyx_t_5) {
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L17_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_t_1 = __pyx_kp_u__12;
    __pyx_L17_bool_binop_done:;
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, -4L, 0, NULL, NULL, &__pyx_slice__105, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 70, __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_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_rnc, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(21, 70, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "src/lxml/relaxng.pxi":71
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()             # <<<<<<<<<<<<<<
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(21, 71, __pyx_L1_error)

      /* "src/lxml/relaxng.pxi":72
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))             # <<<<<<<<<<<<<<
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_dumps); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_load); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_file};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_t_7 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_rng_data_utf8 = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":74
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "src/lxml/relaxng.pxi":73
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(             # <<<<<<<<<<<<<<
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 */
      __pyx_t_3 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_3);

      /* "src/lxml/relaxng.pxi":74
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_data_utf8, __pyx_t_3, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 73, __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;

      /* "src/lxml/relaxng.pxi":73
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 *                 doc = _parseMemoryDocument(             # <<<<<<<<<<<<<<
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 */
      __pyx_t_1 = ((PyObject *)__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":75
 *                 doc = _parseMemoryDocument(
 *                     rng_data_utf8, parser=None, url=_getFilenameForFile(file))
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)
 */
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);

      /* "src/lxml/relaxng.pxi":70
 *                         parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *                         _reset_document_loader(orig_loader)
 *             elif (_getFilenameForFile(file) or '')[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                 _require_rnc2rng()
 *                 rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 */
      goto __pyx_L4;
    }

    /* "src/lxml/relaxng.pxi":77
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 */
    /*else*/ {
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/relaxng.pxi":78
 *             else:
 *                 doc = _parseDocument(file, parser=None, base_url=None)
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise RelaxNGParseError, "No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L4:;

    /* "src/lxml/relaxng.pxi":56
 *             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):
 *                 if file[-4:].lower() == '.rnc':
 */
    goto __pyx_L3;
  }

  /* "src/lxml/relaxng.pxi":80
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise RelaxNGParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGParseError), __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(21, 80, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/relaxng.pxi":82
 *             raise RelaxNGParseError, "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);
  if (__pyx_t_5) {

    /* "src/lxml/relaxng.pxi":83
 * 
 *         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);
    if (__pyx_t_5) {

      /* "src/lxml/relaxng.pxi":84
 *         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);

      /* "src/lxml/relaxng.pxi":83
 * 
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
    }

    /* "src/lxml/relaxng.pxi":86
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document is not parsable as 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_parsable_as_Rela); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "src/lxml/relaxng.pxi":85
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not parsable as Relax NG"),
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(21, 85, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(21, 85, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGParseError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 85, __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_ERR(21, 85, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":82
 *             raise RelaxNGParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
  }

  /* "src/lxml/relaxng.pxi":91
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
 */
  xmlRelaxNGSetParserStructuredErrors(__pyx_v_parser_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

  /* "src/lxml/relaxng.pxi":93
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)             # <<<<<<<<<<<<<<
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         _connectGenericErrorLog(None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base._error_log);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_13.__pyx_n = 1;
  __pyx_t_13.c_domain = XML_FROM_RELAXNGP;
  __pyx_f_4lxml_5etree__connectGenericErrorLog(__pyx_t_1, &__pyx_t_13); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/relaxng.pxi":94
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *         _connectGenericErrorLog(None)
 * 
 */
  __pyx_v_self->_c_schema = xmlRelaxNGParse(__pyx_v_parser_ctxt);

  /* "src/lxml/relaxng.pxi":95
 *         _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGP)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 */
  __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

  /* "src/lxml/relaxng.pxi":97
 *         _connectGenericErrorLog(None)
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 */
  xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);

  /* "src/lxml/relaxng.pxi":98
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
  __pyx_t_5 = (__pyx_v_self->_c_schema == NULL);
  if (__pyx_t_5) {

    /* "src/lxml/relaxng.pxi":99
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema 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);
    if (__pyx_t_5) {

      /* "src/lxml/relaxng.pxi":100
 *         if self._c_schema 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);

      /* "src/lxml/relaxng.pxi":99
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
    }

    /* "src/lxml/relaxng.pxi":102
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "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_ERR(21, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "src/lxml/relaxng.pxi":101
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid Relax NG"),
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(21, 101, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(21, 101, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGParseError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 101, __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_ERR(21, 101, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":98
 * 
 *         relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
  }

  /* "src/lxml/relaxng.pxi":105
 *                     "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);
  if (__pyx_t_5) {

    /* "src/lxml/relaxng.pxi":106
 *                 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);

    /* "src/lxml/relaxng.pxi":105
 *                     "Document is not valid Relax NG"),
 *                 self._error_log)
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 */
  }

  /* "src/lxml/relaxng.pxi":45
 *         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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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_rng_data_utf8);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/relaxng.pxi":108
 *             _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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "src/lxml/relaxng.pxi":109
 * 
 *     def __dealloc__(self):
 *         relaxng.xmlRelaxNGFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlRelaxNGFree(__pyx_v_self->_c_schema);

  /* "src/lxml/relaxng.pxi":108
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 */

  /* function exit code */
}

/* "src/lxml/relaxng.pxi":111
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 111, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(21, 111, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(21, 111, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__connectGenericErrorLog __pyx_t_3;
  xmlDoc *__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;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/relaxng.pxi":123
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_RelaxNG_instance_not_initialised, 0, 0);
      __PYX_ERR(21, 123, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(21, 123, __pyx_L1_error)
  #endif

  /* "src/lxml/relaxng.pxi":124
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/relaxng.pxi":125
 *         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_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/relaxng.pxi":127
 *         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);

  /* "src/lxml/relaxng.pxi":128
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":129
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); __PYX_ERR(21, 129, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":128
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "src/lxml/relaxng.pxi":131
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
  /*try:*/ {

    /* "src/lxml/relaxng.pxi":132
 * 
 *         try:
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 */
    __pyx_t_2 = ((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_2)) __PYX_ERR(21, 132, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/relaxng.pxi":134
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 */
    xmlRelaxNGSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/relaxng.pxi":136
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.c_domain = XML_FROM_RELAXNGV;
    __pyx_f_4lxml_5etree__connectGenericErrorLog(__pyx_t_2, &__pyx_t_3); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/relaxng.pxi":137
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_4 == ((xmlDoc *)NULL))) __PYX_ERR(21, 137, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_4;

    /* "src/lxml/relaxng.pxi":138
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/relaxng.pxi":139
 *             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);
        }

        /* "src/lxml/relaxng.pxi":138
 *             _connectGenericErrorLog(self._error_log, xmlerror.XML_FROM_RELAXNGV)
 *             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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/relaxng.pxi":140
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             _connectGenericErrorLog(None)
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "src/lxml/relaxng.pxi":142
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

      /* "src/lxml/relaxng.pxi":143
 *         finally:
 *             _connectGenericErrorLog(None)
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
      xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_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;
      {

        /* "src/lxml/relaxng.pxi":142
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             _connectGenericErrorLog(None)             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 */
        __pyx_f_4lxml_5etree__connectGenericErrorLog(Py_None, NULL);

        /* "src/lxml/relaxng.pxi":143
 *         finally:
 *             _connectGenericErrorLog(None)
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
        xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      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_L6:;
  }

  /* "src/lxml/relaxng.pxi":145
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 "Internal error in Relax NG validation",
 */
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/relaxng.pxi":146
 * 
 *         if ret == -1:
 *             raise RelaxNGValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_Relax_NG_valid);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_Relax_NG_valid);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Internal_error_in_Relax_NG_valid)) __PYX_ERR(21, 146, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(21, 146, __pyx_L1_error);
    __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGValidateError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(21, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_14, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __PYX_ERR(21, 146, __pyx_L1_error)

    /* "src/lxml/relaxng.pxi":145
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 "Internal error in Relax NG validation",
 */
  }

  /* "src/lxml/relaxng.pxi":149
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/relaxng.pxi":150
 *                 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;

    /* "src/lxml/relaxng.pxi":149
 *                 "Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "src/lxml/relaxng.pxi":152
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/relaxng.pxi":111
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string, "Parse a RelaxNG schema in compact syntax from a text string\n\n        Requires the rnc2rng package to be installed.\n\n        Passing the source URL or file path of the source as 'base_url'\n        will enable resolving resource references relative to the source.\n        ");
static PyMethodDef __pyx_mdef_4lxml_5etree_7RelaxNG_9from_rnc_string = {"from_rnc_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string};
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_src = 0;
  PyObject *__pyx_v_base_url = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_rnc_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_base_url,0};

    /* "src/lxml/relaxng.pxi":155
 * 
 *     @classmethod
 *     def from_rnc_string(cls, src, base_url=None):             # <<<<<<<<<<<<<<
 *         """Parse a RelaxNG schema in compact syntax from a text string
 * 
 */
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_src)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 154, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_base_url);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 154, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "from_rnc_string") < 0)) __PYX_ERR(21, 154, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_src = values[0];
    __pyx_v_base_url = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_rnc_string", 0, 1, 2, __pyx_nargs); __PYX_ERR(21, 154, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("lxml.etree.RelaxNG.from_rnc_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(((PyTypeObject*)__pyx_v_cls), __pyx_v_src, __pyx_v_base_url);

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
 */

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_8from_rnc_string(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_src, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_v_rng_str = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_rnc_string", 1);

  /* "src/lxml/relaxng.pxi":163
 *         will enable resolving resource references relative to the source.
 *         """
 *         _require_rnc2rng()             # <<<<<<<<<<<<<<
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__require_rnc2rng(); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(21, 163, __pyx_L1_error)

  /* "src/lxml/relaxng.pxi":164
 *         """
 *         _require_rnc2rng()
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))             # <<<<<<<<<<<<<<
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__rnc2rng, __pyx_n_s_loads); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_src};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = NULL;
  __pyx_t_1 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_1, 1+__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = utf8(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rng_str = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/relaxng.pxi":165
 *         _require_rnc2rng()
 *         rng_str = utf8(_rnc2rng.dumps(_rnc2rng.loads(src)))
 *         return cls(_parseMemoryDocument(rng_str, parser=None, url=base_url))             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_rng_str, __pyx_v_base_url, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 165, __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;

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.from_rnc_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rng_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":41
 *     cdef bint _add_attribute_defaults
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False
 */

/* 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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/xmlschema.pxi":42
 * 
 *     def __cinit__(self):
 *         self._has_default_attributes = True # play it safe             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = False
 * 
 */
  __pyx_v_self->_has_default_attributes = 1;

  /* "src/lxml/xmlschema.pxi":43
 *     def __cinit__(self):
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):
 */
  __pyx_v_self->_add_attribute_defaults = 0;

  /* "src/lxml/xmlschema.pxi":41
 *     cdef bint _add_attribute_defaults
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play it safe
 *         self._add_attribute_defaults = False
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":45
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 *         cdef xmlDoc* c_doc
 */

/* 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;
  int __pyx_v_attribute_defaults;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,&__pyx_n_s_attribute_defaults,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(22, 45, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
          if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(22, 45, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(22, 45, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
    if (values[2]) {
      __pyx_v_attribute_defaults = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_attribute_defaults == (int)-1) && PyErr_Occurred())) __PYX_ERR(22, 45, __pyx_L3_error)
    } else {
      __pyx_v_attribute_defaults = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(22, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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, int __pyx_v_attribute_defaults) {
  xmlSchemaParserCtxt *__pyx_v_parser_ctxt;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_root_node = NULL;
  PyObject *__pyx_v_filename = NULL;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_file);

  /* "src/lxml/xmlschema.pxi":49
 *         cdef xmlDoc* c_doc
 * 
 *         self._add_attribute_defaults = attribute_defaults             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         c_doc = NULL
 */
  __pyx_v_self->_add_attribute_defaults = __pyx_v_attribute_defaults;

  /* "src/lxml/xmlschema.pxi":50
 * 
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         c_doc = NULL
 *         if etree is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__Validator), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 50, __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;

  /* "src/lxml/xmlschema.pxi":51
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)
 *         c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_v_c_doc = NULL;

  /* "src/lxml/xmlschema.pxi":52
 *         _Validator.__init__(self)
 *         c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_5 = (__pyx_v_etree != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/xmlschema.pxi":53
 *         c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlschema.pxi":54
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/xmlschema.pxi":55
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_6 == ((xmlDoc *)NULL))) __PYX_ERR(22, 55, __pyx_L1_error)
    __pyx_v_c_doc = __pyx_t_6;

    /* "src/lxml/xmlschema.pxi":56
 *             root_node = _rootNodeOrRaise(etree)
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)             # <<<<<<<<<<<<<<
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_doc->_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_ERR(22, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
    __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
    __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":57
 *             c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
 */
    __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_c_doc);

    /* "src/lxml/xmlschema.pxi":52
 *         _Validator.__init__(self)
 *         c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlschema.pxi":58
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 */
  __pyx_t_5 = (__pyx_v_file != Py_None);
  if (likely(__pyx_t_5)) {

    /* "src/lxml/xmlschema.pxi":59
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__getFSPathOrObject(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":60
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 */
    __pyx_t_5 = _isString(__pyx_v_file);
    if (__pyx_t_5) {

      /* "src/lxml/xmlschema.pxi":61
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_filename = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "src/lxml/xmlschema.pxi":62
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc = _parseDocument(file, None, None)
 */
      __pyx_v_parser_ctxt = xmlSchemaNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

      /* "src/lxml/xmlschema.pxi":60
 *         elif file is not None:
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 */
      goto __pyx_L4;
    }

    /* "src/lxml/xmlschema.pxi":64
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 *                 self._doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
 *         else:
 */
    /*else*/ {
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_doc);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_doc);
      __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/xmlschema.pxi":65
 *             else:
 *                 self._doc = _parseDocument(file, None, None)
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise XMLSchemaParseError, "No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_self->_doc->_c_doc);
    }
    __pyx_L4:;

    /* "src/lxml/xmlschema.pxi":58
 *             self._doc = _documentFactory(c_doc, doc._parser)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             file = _getFSPathOrObject(file)
 *             if _isString(file):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/xmlschema.pxi":67
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
 *         else:
 *             raise XMLSchemaParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_XMLSchemaParseError), __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(22, 67, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "src/lxml/xmlschema.pxi":69
 *             raise XMLSchemaParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_5 = (__pyx_v_parser_ctxt == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xmlschema.pxi":70
 * 
 *         if parser_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
    PyErr_NoMemory(); __PYX_ERR(22, 70, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":69
 *             raise XMLSchemaParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "src/lxml/xmlschema.pxi":73
 * 
 *         # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *         xmlschema.xmlSchemaSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:
 */
  xmlSchemaSetParserStructuredErrors(__pyx_v_parser_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

  /* "src/lxml/xmlschema.pxi":75
 *         xmlschema.xmlSchemaSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             # calling xmlSchemaParse on a schema with imports or
 *             # includes will cause libxml2 to create an internal
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/xmlschema.pxi":80
 *             # context for parsing, so push an implied context to route
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             orig_loader = _register_document_loader()
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
    __Pyx_INCREF(__pyx_t_2);
    __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_2)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(22, 80, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":75
 *         xmlschema.xmlSchemaSetParserStructuredErrors(
 *             parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             # calling xmlSchemaParse on a schema with imports or
 *             # includes will cause libxml2 to create an internal
 */
  }

  /* "src/lxml/xmlschema.pxi":81
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "src/lxml/xmlschema.pxi":82
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:
 *             orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
 */
        __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

        /* "src/lxml/xmlschema.pxi":83
 *         with nogil:
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:
 */
        __pyx_v_self->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);

        /* "src/lxml/xmlschema.pxi":84
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 */
        __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);
      }

      /* "src/lxml/xmlschema.pxi":81
 *             # resolve requests to the document's parser
 *             __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             orig_loader = _register_document_loader()
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "src/lxml/xmlschema.pxi":85
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/xmlschema.pxi":86
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(22, 86, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":85
 *             self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             _reset_document_loader(orig_loader)
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 */
  }

  /* "src/lxml/xmlschema.pxi":87
 *         if self._doc is not None:
 *             __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
 */
  xmlSchemaFreeParserCtxt(__pyx_v_parser_ctxt);

  /* "src/lxml/xmlschema.pxi":89
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_5 = (__pyx_v_self->_c_schema == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/xmlschema.pxi":91
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     "Document is not valid XML Schema"),
 *                 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_valid_XML_Schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "src/lxml/xmlschema.pxi":90
 * 
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     "Document is not valid XML Schema"),
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(22, 90, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(22, 90, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XMLSchemaParseError), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 90, __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_ERR(22, 90, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":89
 *         xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
 */
  }

  /* "src/lxml/xmlschema.pxi":95
 *                 self._error_log)
 * 
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/xmlschema.pxi":96
 * 
 *         if self._doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 * 
 */
    __Pyx_INCREF((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes);
    __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes); __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self->_doc)};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(22, 96, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->_has_default_attributes = __pyx_t_5;

    /* "src/lxml/xmlschema.pxi":95
 *                 self._error_log)
 * 
 *         if self._doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 */
  }

  /* "src/lxml/xmlschema.pxi":97
 *         if self._doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(self._doc)
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  if (__pyx_v_attribute_defaults) {
  } else {
    __pyx_t_5 = __pyx_v_attribute_defaults;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_5 = __pyx_v_self->_has_default_attributes;
  __pyx_L13_bool_binop_done:;
  __pyx_v_self->_add_attribute_defaults = __pyx_t_5;

  /* "src/lxml/xmlschema.pxi":45
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 *         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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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_XDECREF(__pyx_v_file);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":99
 *         self._add_attribute_defaults = attribute_defaults and 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "src/lxml/xmlschema.pxi":100
 * 
 *     def __dealloc__(self):
 *         xmlschema.xmlSchemaFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlSchemaFree(__pyx_v_self->_c_schema);

  /* "src/lxml/xmlschema.pxi":99
 *         self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 */

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":102
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(22, 102, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(22, 102, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(22, 102, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/xmlschema.pxi":115
 *         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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Schema_instance_not_initialised, 0, 0);
      __PYX_ERR(22, 115, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(22, 115, __pyx_L1_error)
  #endif

  /* "src/lxml/xmlschema.pxi":116
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlschema.pxi":117
 *         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_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/xmlschema.pxi":119
 *         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);

  /* "src/lxml/xmlschema.pxi":120
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xmlschema.pxi":121
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); __PYX_ERR(22, 121, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":120
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "src/lxml/xmlschema.pxi":123
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(
 */
  /*try:*/ {

    /* "src/lxml/xmlschema.pxi":124
 * 
 *         try:
 *             if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 */
    if (__pyx_v_self->_add_attribute_defaults) {

      /* "src/lxml/xmlschema.pxi":125
 *         try:
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(             # <<<<<<<<<<<<<<
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 */
      (void)(xmlSchemaSetValidOptions(__pyx_v_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE));

      /* "src/lxml/xmlschema.pxi":124
 * 
 *         try:
 *             if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 */
    }

    /* "src/lxml/xmlschema.pxi":128
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 */
    __pyx_t_2 = ((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_2)) __PYX_ERR(22, 128, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/xmlschema.pxi":130
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 * 
 */
    xmlSchemaSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/xmlschema.pxi":133
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _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 == ((xmlDoc *)NULL))) __PYX_ERR(22, 133, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_3;

    /* "src/lxml/xmlschema.pxi":134
 * 
 *             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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xmlschema.pxi":135
 *             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);
        }

        /* "src/lxml/xmlschema.pxi":134
 * 
 *             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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L10;
          }
          __pyx_L10:;
        }
    }

    /* "src/lxml/xmlschema.pxi":136
 *             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);
  }

  /* "src/lxml/xmlschema.pxi":138
 *             _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;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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:;
  }

  /* "src/lxml/xmlschema.pxi":140
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 "Internal error in XML Schema validation.",
 */
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/xmlschema.pxi":141
 * 
 *         if ret == -1:
 *             raise XMLSchemaValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_XML_Schema_val);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_XML_Schema_val);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Internal_error_in_XML_Schema_val)) __PYX_ERR(22, 141, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(22, 141, __pyx_L1_error);
    __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XMLSchemaValidateError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(22, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_13, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __PYX_ERR(22, 141, __pyx_L1_error)

    /* "src/lxml/xmlschema.pxi":140
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 "Internal error in XML Schema validation.",
 */
  }

  /* "src/lxml/xmlschema.pxi":144
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":145
 *                 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;

    /* "src/lxml/xmlschema.pxi":144
 *                 "Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "src/lxml/xmlschema.pxi":147
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/xmlschema.pxi":102
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_13);
  __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;
}

/* "src/lxml/xmlschema.pxi":149
 *             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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newSaxValidator", 1);

  /* "src/lxml/xmlschema.pxi":152
 *             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 = ((PyObject *)__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(((PyTypeObject *)__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 152, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/xmlschema.pxi":153
 *         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((PyObject *)__pyx_v_context->_schema);
  __Pyx_DECREF((PyObject *)__pyx_v_context->_schema);
  __pyx_v_context->_schema = __pyx_v_self;

  /* "src/lxml/xmlschema.pxi":154
 *         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) {
  } else {
    __pyx_t_2 = __pyx_v_self->_has_default_attributes;
    goto __pyx_L3_bool_binop_done;
  }

  /* "src/lxml/xmlschema.pxi":155
 *         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) {
  } else {
    __pyx_t_2 = __pyx_v_add_default_attributes;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __pyx_v_self->_add_attribute_defaults;
  __pyx_L3_bool_binop_done:;

  /* "src/lxml/xmlschema.pxi":154
 *         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_2;

  /* "src/lxml/xmlschema.pxi":156
 *         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;

  /* "src/lxml/xmlschema.pxi":149
 *             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;
}

/* "src/lxml/xmlschema.pxi":165
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/xmlschema.pxi":166
 *     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;

  /* "src/lxml/xmlschema.pxi":167
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         self._add_default_attributes = False
 * 
 */
  __pyx_v_self->_sax_plug = NULL;

  /* "src/lxml/xmlschema.pxi":168
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_add_default_attributes = 0;

  /* "src/lxml/xmlschema.pxi":165
 *     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;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":170
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":171
 * 
 *     def __dealloc__(self):
 *         self.disconnect()             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 */
  __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self);

  /* "src/lxml/xmlschema.pxi":172
 *     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) {

    /* "src/lxml/xmlschema.pxi":173
 *         self.disconnect()
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 */
    xmlSchemaFreeValidCtxt(__pyx_v_self->_valid_ctxt);

    /* "src/lxml/xmlschema.pxi":172
 *     def __dealloc__(self):
 *         self.disconnect()
 *         if self._valid_ctxt:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 */
  }

  /* "src/lxml/xmlschema.pxi":170
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
 */

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":175
 *             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", 1);

  /* "src/lxml/xmlschema.pxi":176
 * 
 *     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(__pyx_assertions_enabled())) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_ParserSchemaValidationContext_n, 0, 0);
      __PYX_ERR(22, 176, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(22, 176, __pyx_L1_error)
  #endif

  /* "src/lxml/xmlschema.pxi":177
 *     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);

  /* "src/lxml/xmlschema.pxi":178
 *         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) noexcept:
 */
  __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_ERR(22, 177, __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;

  /* "src/lxml/xmlschema.pxi":175
 *             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;
}

/* "src/lxml/xmlschema.pxi":180
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *         # 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) {

  /* "src/lxml/xmlschema.pxi":184
 *         # 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)
 */
  if (__pyx_v_self->_add_default_attributes) {

    /* "src/lxml/xmlschema.pxi":185
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/xmlschema.pxi":186
 *         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:
 */
          (void)(xmlSchemaValidateDoc(__pyx_v_self->_valid_ctxt, __pyx_v_c_doc));
        }

        /* "src/lxml/xmlschema.pxi":185
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "src/lxml/xmlschema.pxi":184
 *         # 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)
 */
  }

  /* "src/lxml/xmlschema.pxi":180
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
 */

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":188
 *                 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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/xmlschema.pxi":189
 * 
 *     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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":190
 *     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);

    /* "src/lxml/xmlschema.pxi":192
 *             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);
    if (unlikely(__pyx_t_1)) {

      /* "src/lxml/xmlschema.pxi":193
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(
 */
      PyErr_NoMemory(); __PYX_ERR(22, 193, __pyx_L1_error)

      /* "src/lxml/xmlschema.pxi":192
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if self._add_default_attributes:
 */
    }

    /* "src/lxml/xmlschema.pxi":194
 *             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)
 */
    if (__pyx_v_self->_add_default_attributes) {

      /* "src/lxml/xmlschema.pxi":195
 *                 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:
 */
      (void)(xmlSchemaSetValidOptions(__pyx_v_self->_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE));

      /* "src/lxml/xmlschema.pxi":194
 *             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)
 */
    }

    /* "src/lxml/xmlschema.pxi":189
 * 
 *     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)
 */
  }

  /* "src/lxml/xmlschema.pxi":197
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_error_log) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":199
 *         if error_log is not None:
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>error_log)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(
 */
    xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_error_log));

    /* "src/lxml/xmlschema.pxi":197
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 */
  }

  /* "src/lxml/xmlschema.pxi":201
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _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));

  /* "src/lxml/xmlschema.pxi":188
 *                 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:;
  return __pyx_r;
}

/* "src/lxml/xmlschema.pxi":204
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self) noexcept:             # <<<<<<<<<<<<<<
 *         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) {
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":205
 * 
 *     cdef void disconnect(self) noexcept:
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":206
 *     cdef void disconnect(self) noexcept:
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)             # <<<<<<<<<<<<<<
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:
 */
    (void)(xmlSchemaSAXUnplug(__pyx_v_self->_sax_plug));

    /* "src/lxml/xmlschema.pxi":207
 *         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;

    /* "src/lxml/xmlschema.pxi":205
 * 
 *     cdef void disconnect(self) noexcept:
 *         if self._sax_plug is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 */
  }

  /* "src/lxml/xmlschema.pxi":208
 *             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);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":209
 *             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);

    /* "src/lxml/xmlschema.pxi":208
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, NULL, NULL)
 */
  }

  /* "src/lxml/xmlschema.pxi":204
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 */

  /* function exit code */
}

/* "src/lxml/xmlschema.pxi":212
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self) noexcept:             # <<<<<<<<<<<<<<
 *         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;
  int __pyx_t_1;

  /* "src/lxml/xmlschema.pxi":213
 * 
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/xmlschema.pxi":214
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid             # <<<<<<<<<<<<<<
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "src/lxml/xmlschema.pxi":213
 * 
 *     cdef bint isvalid(self) noexcept:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
  }

  /* "src/lxml/xmlschema.pxi":215
 *         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;

  /* "src/lxml/xmlschema.pxi":212
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self) noexcept:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/schematron.pxi":72
 *     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) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && 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;

  /* "src/lxml/schematron.pxi":73
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 *         self._c_schema_doc = NULL
 * 
 */
  __pyx_v_self->_c_schema = NULL;

  /* "src/lxml/schematron.pxi":74
 *     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;

  /* "src/lxml/schematron.pxi":72
 *     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;
  return __pyx_r;
}

/* "src/lxml/schematron.pxi":76
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,0};
    values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(23, 76, __pyx_L3_error)
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
        if (value) { values[index] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(23, 76, __pyx_L3_error)
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(23, 76, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(23, 76, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  xmlExternalEntityLoader __pyx_v_orig_loader;
  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;
  PyObject *__pyx_t_8 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);

  /* "src/lxml/schematron.pxi":81
 *         cdef xmlNode* c_node
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
 */
  __pyx_v_parser_ctxt = NULL;

  /* "src/lxml/schematron.pxi":82
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_5etree__Validator), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 82, __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;

  /* "src/lxml/schematron.pxi":83
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
 */
  __pyx_t_5 = (!ENABLE_SCHEMATRON);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/schematron.pxi":84
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \             # <<<<<<<<<<<<<<
 *                 "lxml.etree was compiled without Schematron support."
 *         if etree is not None:
 */
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_SchematronError), __pyx_kp_u_lxml_etree_was_compiled_without, 0, 0);
    __PYX_ERR(23, 84, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":83
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt = NULL
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
 */
  }

  /* "src/lxml/schematron.pxi":86
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_5 = (__pyx_v_etree != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/schematron.pxi":87
 *                 "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_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":88
 *         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_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":89
 *             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 == ((xmlDoc *)NULL))) __PYX_ERR(23, 89, __pyx_L1_error)
    __pyx_v_self->_c_schema_doc = __pyx_t_6;

    /* "src/lxml/schematron.pxi":90
 *             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);

    /* "src/lxml/schematron.pxi":86
 *             raise SchematronError, \
 *                 "lxml.etree was compiled without Schematron support."
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
    goto __pyx_L4;
  }

  /* "src/lxml/schematron.pxi":91
 *             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);
  if (likely(__pyx_t_5)) {

    /* "src/lxml/schematron.pxi":92
 *             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_1 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_filename = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":93
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
 */
    __pyx_t_5 = (__pyx_v_filename == Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/schematron.pxi":95
 *             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);

      /* "src/lxml/schematron.pxi":93
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
 */
    }

    /* "src/lxml/schematron.pxi":96
 *                 # XXX assume a string object
 *                 filename = file
 *             filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "src/lxml/schematron.pxi":97
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 */
    /*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_ERR(23, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(23, 97, __pyx_L6_error)
      /*try:*/ {
        {
          (void)__pyx_t_8; (void)__pyx_t_9; (void)__pyx_t_10; /* mark used */
          /*try:*/ {

            /* "src/lxml/schematron.pxi":98
 *             filename = _encodeFilename(filename)
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *                 _reset_document_loader(orig_loader)
 */
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/schematron.pxi":99
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         else:
 */
            __pyx_v_parser_ctxt = xmlSchematronNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));

            /* "src/lxml/schematron.pxi":100
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         else:
 *             raise SchematronParseError, "No tree or file given"
 */
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/schematron.pxi":97
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 */
          }
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_7) {
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__38, NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(23, 97, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
      goto __pyx_L16;
      __pyx_L6_error:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L1_error;
      __pyx_L16:;
    }

    /* "src/lxml/schematron.pxi":91
 *             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:
 */
    goto __pyx_L4;
  }

  /* "src/lxml/schematron.pxi":102
 *                 _reset_document_loader(orig_loader)
 *         else:
 *             raise SchematronParseError, "No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
  /*else*/ {
    __Pyx_Raise(((PyObject *)__pyx_ptype_4lxml_5etree_SchematronParseError), __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __PYX_ERR(23, 102, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "src/lxml/schematron.pxi":104
 *             raise SchematronParseError, "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);
  if (__pyx_t_5) {

    /* "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
 */
    __pyx_t_5 = (__pyx_v_self->_c_schema_doc != NULL);
    if (__pyx_t_5) {

      /* "src/lxml/schematron.pxi":106
 *         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);

      /* "src/lxml/schematron.pxi":107
 *             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;

      /* "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
 */
    }

    /* "src/lxml/schematron.pxi":108
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); __PYX_ERR(23, 108, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":104
 *             raise SchematronParseError, "No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 */
  }

  /* "src/lxml/schematron.pxi":110
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 */
  /*try:*/ {

    /* "src/lxml/schematron.pxi":111
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 */
    /*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_ERR(23, 111, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(23, 111, __pyx_L22_error)
      /*try:*/ {
        {
          (void)__pyx_t_10; (void)__pyx_t_9; (void)__pyx_t_8; /* mark used */
          /*try:*/ {

            /* "src/lxml/schematron.pxi":112
 *         try:
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()             # <<<<<<<<<<<<<<
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *                 _reset_document_loader(orig_loader)
 */
            __pyx_v_orig_loader = __pyx_f_4lxml_5etree__register_document_loader();

            /* "src/lxml/schematron.pxi":113
 *             with self._error_log:
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 _reset_document_loader(orig_loader)
 *         finally:
 */
            __pyx_v_self->_c_schema = xmlSchematronParse(__pyx_v_parser_ctxt);

            /* "src/lxml/schematron.pxi":114
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *                 _reset_document_loader(orig_loader)             # <<<<<<<<<<<<<<
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 */
            __pyx_f_4lxml_5etree__reset_document_loader(__pyx_v_orig_loader);

            /* "src/lxml/schematron.pxi":111
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 orig_loader = _register_document_loader()
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 */
          }
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_7) {
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__38, NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(23, 111, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          goto __pyx_L25;
        }
        __pyx_L25:;
      }
      goto __pyx_L32;
      __pyx_L22_error:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L20_error;
      __pyx_L32:;
    }
  }

  /* "src/lxml/schematron.pxi":116
 *                 _reset_document_loader(orig_loader)
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      goto __pyx_L21;
    }
    __pyx_L20_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_13 = 0; __pyx_t_14 = 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_10, &__pyx_t_13, &__pyx_t_14);
      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_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_4 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_13, __pyx_t_14);
      }
      __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_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L21:;
  }

  /* "src/lxml/schematron.pxi":118
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 "Document is not a valid Schematron schema",
 */
  __pyx_t_5 = (__pyx_v_self->_c_schema == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "src/lxml/schematron.pxi":119
 * 
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(             # <<<<<<<<<<<<<<
 *                 "Document is not a valid Schematron schema",
 *                 self._error_log)
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_kp_u_Document_is_not_a_valid_Schematr);
    __Pyx_GIVEREF(__pyx_kp_u_Document_is_not_a_valid_Schematr);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Document_is_not_a_valid_Schematr)) __PYX_ERR(23, 119, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(23, 119, __pyx_L1_error);
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_SchematronParseError), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 119, __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_ERR(23, 119, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":118
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 "Document is not a valid Schematron schema",
 */
  }

  /* "src/lxml/schematron.pxi":76
 *         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;
}

/* "src/lxml/schematron.pxi":123
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:
 */

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;

  /* "src/lxml/schematron.pxi":124
 * 
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)             # <<<<<<<<<<<<<<
 *         if self._c_schema_doc is not NULL:
 *             tree.xmlFreeDoc(self._c_schema_doc)
 */
  xmlSchematronFree(__pyx_v_self->_c_schema);

  /* "src/lxml/schematron.pxi":125
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_c_schema_doc != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/schematron.pxi":126
 *         schematron.xmlSchematronFree(self._c_schema)
 *         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);

    /* "src/lxml/schematron.pxi":125
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 */
  }

  /* "src/lxml/schematron.pxi":123
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if self._c_schema_doc is not NULL:
 */

  /* function exit code */
}

/* "src/lxml/schematron.pxi":128
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__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*/
PyDoc_STRVAR(__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_UPDATE_DESCRIPTOR_DOC
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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {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);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_etree)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(23, 128, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(23, 128, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(23, 128, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 1);

  /* "src/lxml/schematron.pxi":140
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_c_schema != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_Schematron_instance_not_initiali, 0, 0);
      __PYX_ERR(23, 140, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(23, 140, __pyx_L1_error)
  #endif

  /* "src/lxml/schematron.pxi":141
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/schematron.pxi":142
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/schematron.pxi":144
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(             # <<<<<<<<<<<<<<
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:
 */
  __pyx_v_valid_ctxt = xmlSchematronNewValidCtxt(__pyx_v_self->_c_schema, XML_SCHEMATRON_OUT_ERROR);

  /* "src/lxml/schematron.pxi":146
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_1 = (__pyx_v_valid_ctxt == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/schematron.pxi":147
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); __PYX_ERR(23, 147, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":146
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, schematron.XML_SCHEMATRON_OUT_ERROR)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  }

  /* "src/lxml/schematron.pxi":149
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 */
  /*try:*/ {

    /* "src/lxml/schematron.pxi":150
 * 
 *         try:
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             schematron.xmlSchematronSetValidStructuredErrors(
 */
    __pyx_t_2 = ((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_2)) __PYX_ERR(23, 150, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/schematron.pxi":152
 *             self._error_log.clear()
 *             # Need a cast here because older libxml2 releases do not use 'const' in the functype.
 *             schematron.xmlSchematronSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    xmlSchematronSetValidStructuredErrors(__pyx_v_valid_ctxt, ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError), ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "src/lxml/schematron.pxi":154
 *             schematron.xmlSchematronSetValidStructuredErrors(
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _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_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == ((xmlDoc *)NULL))) __PYX_ERR(23, 154, __pyx_L5_error)
    __pyx_v_c_doc = __pyx_t_3;

    /* "src/lxml/schematron.pxi":155
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _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;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "src/lxml/schematron.pxi":156
 *             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);
        }

        /* "src/lxml/schematron.pxi":155
 *                 valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _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
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "src/lxml/schematron.pxi":157
 *             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);
  }

  /* "src/lxml/schematron.pxi":159
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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;
      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;
      {
        xmlSchematronFreeValidCtxt(__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:;
  }

  /* "src/lxml/schematron.pxi":161
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 "Internal error in Schematron validation",
 */
  __pyx_t_1 = (__pyx_v_ret == -1L);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/schematron.pxi":162
 * 
 *         if ret == -1:
 *             raise SchematronValidateError(             # <<<<<<<<<<<<<<
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(23, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_Schematron_val);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_Schematron_val);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Internal_error_in_Schematron_val)) __PYX_ERR(23, 162, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self->__pyx_base._error_log);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log))) __PYX_ERR(23, 162, __pyx_L1_error);
    __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_SchematronValidateError), __pyx_t_2, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(23, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_13, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __PYX_ERR(23, 162, __pyx_L1_error)

    /* "src/lxml/schematron.pxi":161
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 "Internal error in Schematron validation",
 */
  }

  /* "src/lxml/schematron.pxi":165
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = (__pyx_v_ret == 0);
  if (__pyx_t_1) {

    /* "src/lxml/schematron.pxi":166
 *                 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;

    /* "src/lxml/schematron.pxi":165
 *                 "Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "src/lxml/schematron.pxi":168
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "src/lxml/schematron.pxi":128
 *             tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         """__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     "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", 1);

  /* "src/lxml/public-api.pxi":6
 *     "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 == ((xmlNode *)NULL))) __PYX_ERR(24, 6, __pyx_L1_error)
  __pyx_v_c_node = __pyx_t_1;

  /* "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_ERR(24, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     "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;
}

/* "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", 1);

  /* "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 == ((int)-1))) __PYX_ERR(24, 10, __pyx_L1_error)

  /* "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 *)__pyx_ptype_4lxml_5etree__ElementTree))); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "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;
}

/* "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;
  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("newElementTree", 1);

  /* "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_2 = (((void *)__pyx_v_context_node) == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "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_ERR(24, 16, __pyx_L1_error)

    /* "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)
 */
  }

  /* "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_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(24, 17, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":18
 *         raise TypeError
 *     _assertValidNode(context_node)
 *     return _newElementTree(context_node._doc, context_node, subclass)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_context_node->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(((struct LxmlDocument *)__pyx_t_4), __pyx_v_context_node, __pyx_v_subclass)); if (unlikely(!__pyx_t_5)) __PYX_ERR(24, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):             # <<<<<<<<<<<<<<
 *     if c_doc is NULL:
 *         raise TypeError
 */

struct LxmlElementTree *adoptExternalDocument(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_parser, int __pyx_v_is_owned) {
  struct LxmlDocument *__pyx_v_doc = NULL;
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_4lxml_5etree__adoptForeignDoc __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("adoptExternalDocument", 1);

  /* "src/lxml/public-api.pxi":21
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 */
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":22
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(24, 22, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":21
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 */
  }

  /* "src/lxml/public-api.pxi":23
 *     if c_doc is NULL:
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)             # <<<<<<<<<<<<<<
 *     return _elementTreeFactory(doc, None)
 * 
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) __PYX_ERR(24, 23, __pyx_L1_error)
  __pyx_t_3.__pyx_n = 2;
  __pyx_t_3.parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser);
  __pyx_t_3.is_owned = __pyx_v_is_owned;
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__adoptForeignDoc(__pyx_v_c_doc, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/public-api.pxi":24
 *         raise TypeError
 *     doc = _adoptForeignDoc(c_doc, parser, is_owned)
 *     return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _ElementTree adoptExternalDocument(xmlDoc* c_doc, parser, bint is_owned):             # <<<<<<<<<<<<<<
 *     if c_doc is NULL:
 *         raise TypeError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.adoptExternalDocument", __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;
}

/* "src/lxml/public-api.pxi":26
 *     return _elementTreeFactory(doc, None)
 * 
 * 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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elementFactory", 1);

  /* "src/lxml/public-api.pxi":27
 * 
 * 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_2 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((PyObject *)__pyx_v_doc) == Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":28
 * 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_ERR(24, 28, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":27
 * 
 * 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)
 */
  }

  /* "src/lxml/public-api.pxi":29
 *     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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(24, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":26
 *     return _elementTreeFactory(doc, None)
 * 
 * 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_3);
  __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;
}

/* "src/lxml/public-api.pxi":31
 *     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", 1);

  /* "src/lxml/public-api.pxi":33
 * 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_ERR(24, 33, __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_ERR(24, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":31
 *     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;
}

/* "src/lxml/public-api.pxi":35
 *     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", 1);

  /* "src/lxml/public-api.pxi":37
 * 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 == ((int)-1))) __PYX_ERR(24, 37, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":38
 *                                         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_ERR(24, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":35
 *     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;
}

/* "src/lxml/public-api.pxi":40
 *     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) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":42
 * 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); if (unlikely(PyErr_Occurred())) __PYX_ERR(24, 42, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":40
 *     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 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setElementClassLookupFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":44
 *     _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", 1);

  /* "src/lxml/public-api.pxi":45
 * 
 * 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_ERR(24, 45, __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_ERR(24, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":44
 *     _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;
}

/* "src/lxml/public-api.pxi":47
 *     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", 1);

  /* "src/lxml/public-api.pxi":48
 * 
 * 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_ERR(24, 48, __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_ERR(24, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":47
 *     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;
}

/* "src/lxml/public-api.pxi":50
 *     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", 1);

  /* "src/lxml/public-api.pxi":52
 * 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_ERR(24, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":50
 *     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;
}

/* "src/lxml/public-api.pxi":54
 *     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;
  int __pyx_t_1;

  /* "src/lxml/public-api.pxi":55
 * 
 * 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);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":56
 * 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;

    /* "src/lxml/public-api.pxi":55
 * 
 * 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)
 */
  }

  /* "src/lxml/public-api.pxi":57
 *     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;

  /* "src/lxml/public-api.pxi":54
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":59
 *     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", 1);

  /* "src/lxml/public-api.pxi":60
 * 
 * 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_ERR(24, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":59
 *     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;
}

/* "src/lxml/public-api.pxi":62
 *     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", 1);

  /* "src/lxml/public-api.pxi":63
 * 
 * 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_ERR(24, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":62
 *     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;
}

/* "src/lxml/public-api.pxi":65
 *     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;

  /* "src/lxml/public-api.pxi":66
 * 
 * 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;

  /* "src/lxml/public-api.pxi":65
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":68
 *     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;

  /* "src/lxml/public-api.pxi":69
 * 
 * cdef public api bint hasTail(xmlNode* c_node):
 *     return _hasTail(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasTail(__pyx_v_c_node);
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":68
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":71
 *     return _hasTail(c_node)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":72
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":73
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.children)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/public-api.pxi":72
 * 
 * cdef public api unicode textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
 */
  }

  /* "src/lxml/public-api.pxi":74
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.children)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode 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_ERR(24, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":71
 *     return _hasTail(c_node)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":76
 *     return _collectText(c_node.children)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":77
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/public-api.pxi":78
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.next)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "src/lxml/public-api.pxi":77
 * 
 * cdef public api unicode tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
 */
  }

  /* "src/lxml/public-api.pxi":79
 *     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_ERR(24, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":76
 *     return _collectText(c_node.children)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":81
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":82
 * 
 * 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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":83
 * 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_ERR(24, 83, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":82
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setNodeText(c_node, text)
 */
  }

  /* "src/lxml/public-api.pxi":84
 *     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 == ((int)-1))) __PYX_ERR(24, 84, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":81
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":86
 *     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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":87
 * 
 * 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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":88
 * 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_ERR(24, 88, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":87
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setTailText(c_node, text)
 */
  }

  /* "src/lxml/public-api.pxi":89
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setTailText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode 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 == ((int)-1))) __PYX_ERR(24, 89, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":86
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":91
 *     return _setTailText(c_node, text)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":92
 * 
 * cdef public api unicode attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     return _attributeValue(c_element, c_attrib_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode 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_ERR(24, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":91
 *     return _setTailText(c_node, text)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":94
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":96
 * cdef public api unicode 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_ERR(24, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":94
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":98
 *     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", 1);

  /* "src/lxml/public-api.pxi":99
 * 
 * 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 == ((int)-1))) __PYX_ERR(24, 99, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":100
 * 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_ERR(24, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":98
 *     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;
}

/* "src/lxml/public-api.pxi":102
 *     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", 1);

  /* "src/lxml/public-api.pxi":103
 * 
 * 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 == ((int)-1))) __PYX_ERR(24, 103, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":104
 * 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_ERR(24, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":102
 *     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;
}

/* "src/lxml/public-api.pxi":106
 *     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", 1);

  /* "src/lxml/public-api.pxi":107
 * 
 * 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_ERR(24, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":106
 *     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;
}

/* "src/lxml/public-api.pxi":109
 *     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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":110
 * 
 * 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 == ((int)-1))) __PYX_ERR(24, 110, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":111
 * 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 == ((int)-1))) __PYX_ERR(24, 111, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":109
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":113
 *     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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":114
 * 
 * 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 == ((int)-1))) __PYX_ERR(24, 114, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":115
 * 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 == ((int)-1))) __PYX_ERR(24, 115, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":113
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":117
 *     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;

  /* "src/lxml/public-api.pxi":119
 * 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;

  /* "src/lxml/public-api.pxi":117
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":121
 *     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;

  /* "src/lxml/public-api.pxi":122
 * 
 * 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;

  /* "src/lxml/public-api.pxi":121
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":124
 *     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;

  /* "src/lxml/public-api.pxi":125
 * 
 * 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;

  /* "src/lxml/public-api.pxi":124
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":127
 *     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;

  /* "src/lxml/public-api.pxi":128
 * 
 * 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;

  /* "src/lxml/public-api.pxi":127
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":130
 *     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;

  /* "src/lxml/public-api.pxi":131
 * 
 * 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;

  /* "src/lxml/public-api.pxi":130
 *     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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":133
 *     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;

  /* "src/lxml/public-api.pxi":134
 * 
 * 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;

  /* "src/lxml/public-api.pxi":133
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":136
 *     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;

  /* "src/lxml/public-api.pxi":137
 * 
 * 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;

  /* "src/lxml/public-api.pxi":136
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":139
 *     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) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":141
 * 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 == ((int)-1))) __PYX_ERR(24, 141, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":139
 *     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_AddTraceback("lxml.etree.appendChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":143
 *     _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;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":144
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:
 *     return _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(24, 144, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":143
 *     _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:;
  return __pyx_r;
}

/* "src/lxml/public-api.pxi":146
 *     return _appendChild(parent, child)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":147
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
 */
  __pyx_t_1 = (__pyx_v_s == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":148
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return funicode(s)
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(24, 148, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":147
 * 
 * cdef public api unicode pyunicode(const_xmlChar* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
 */
  }

  /* "src/lxml/public-api.pxi":149
 *     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_ERR(24, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":146
 *     return _appendChild(parent, child)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":151
 *     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", 1);

  /* "src/lxml/public-api.pxi":152
 * 
 * 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_ERR(24, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":151
 *     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;
}

/* "src/lxml/public-api.pxi":154
 *     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", 1);

  /* "src/lxml/public-api.pxi":155
 * 
 * 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_ERR(24, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":154
 *     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;
}

/* "src/lxml/public-api.pxi":157
 *     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", 1);

  /* "src/lxml/public-api.pxi":158
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 *     return _getNsTagWithEmptyNs(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode 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_ERR(24, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":157
 *     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;
}

/* "src/lxml/public-api.pxi":160
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":161
 * 
 * cdef public api unicode namespacedName(xmlNode* c_node):
 *     return _namespacedName(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api unicode 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_ERR(24, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":160
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":163
 *     return _namespacedName(c_node)
 * 
 * cdef public api unicode 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", 1);

  /* "src/lxml/public-api.pxi":164
 * 
 * cdef public api unicode 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_ERR(24, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":163
 *     return _namespacedName(c_node)
 * 
 * cdef public api unicode 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;
}

/* "src/lxml/public-api.pxi":166
 *     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) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":168
 * 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); if (unlikely(PyErr_Occurred())) __PYX_ERR(24, 168, __pyx_L1_error)

  /* "src/lxml/public-api.pxi":166
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     iterator._storeNext(node)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.iteratorStoreNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "src/lxml/public-api.pxi":170
 *     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", 1);

  /* "src/lxml/public-api.pxi":172
 * 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_ERR(24, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/public-api.pxi":170
 *     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_AddTraceback("lxml.etree.initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/public-api.pxi":174
 *     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;
  int __pyx_t_1;
  xmlNs *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "src/lxml/public-api.pxi":176
 * 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);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/public-api.pxi":177
 *         _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_ERR(24, 177, __pyx_L1_error)

    /* "src/lxml/public-api.pxi":176
 * 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)
 */
  }

  /* "src/lxml/public-api.pxi":178
 *     if doc is None:
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = __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_2 == ((xmlNs *)NULL))) __PYX_ERR(24, 178, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "src/lxml/public-api.pxi":174
 *     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:;
  return __pyx_r;
}

/* "src/lxml/debug.pxi":6
 *     """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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_1bytes_used = {"bytes_used", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_bytes_used};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bytes_used (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("bytes_used", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "bytes_used", 0))) return NULL;
  __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", 1);

  /* "src/lxml/debug.pxi":13
 *         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_ERR(25, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":6
 *     """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;
}

/* "src/lxml/debug.pxi":15
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_3blocks_used = {"blocks_used", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blocks_used (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("blocks_used", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "blocks_used", 0))) return NULL;
  __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", 1);

  /* "src/lxml/debug.pxi":22
 *         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_ERR(25, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":15
 *         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;
}

/* "src/lxml/debug.pxi":24
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_5dict_size = {"dict_size", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_4dict_size};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dict_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("dict_size", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "dict_size", 0))) return NULL;
  __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
  xmlDict *__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("dict_size", 1);

  /* "src/lxml/debug.pxi":30
 *         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_t_1 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 30, __pyx_L1_error)
  __pyx_v_c_dict = __pyx_t_1;

  /* "src/lxml/debug.pxi":31
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)
 */
  __pyx_t_2 = (__pyx_v_c_dict == NULL);
  if (unlikely(__pyx_t_2)) {

    /* "src/lxml/debug.pxi":32
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return tree.xmlDictSize(c_dict)
 * 
 */
    PyErr_NoMemory(); __PYX_ERR(25, 32, __pyx_L1_error)

    /* "src/lxml/debug.pxi":31
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)
 */
  }

  /* "src/lxml/debug.pxi":33
 *         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_3 = __Pyx_PyInt_FromSize_t(xmlDictSize(__pyx_v_c_dict)); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* "src/lxml/debug.pxi":35
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_7dump = {"dump", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_7dump, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_6dump};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_7dump(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_byte_count = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_byte_count,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_file);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 35, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_byte_count);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 35, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dump") < 0)) __PYX_ERR(25, 35, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_output_file = values[0];
    __pyx_v_byte_count = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 2, __pyx_nargs); __PYX_ERR(25, 35, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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;
  char const *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump", 0);
  __Pyx_INCREF(__pyx_v_output_file);

  /* "src/lxml/debug.pxi":48
 *         """
 *         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);
  if (__pyx_t_1) {

    /* "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):
 *             output_file.encode(sys.getfilesystemencoding())
 */
    __Pyx_INCREF(__pyx_kp_b_memorylist);
    __Pyx_DECREF_SET(__pyx_v_output_file, __pyx_kp_b_memorylist);

    /* "src/lxml/debug.pxi":48
 *         """
 *         cdef Py_ssize_t c_count
 *         if output_file is None:             # <<<<<<<<<<<<<<
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/debug.pxi":50
 *         if output_file is None:
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_output_file); 
  if (__pyx_t_1) {

    /* "src/lxml/debug.pxi":51
 *             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_ERR(25, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/debug.pxi":50
 *         if output_file is None:
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  }
  __pyx_L3:;

  /* "src/lxml/debug.pxi":53
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 *         f = stdio.fopen(output_file, "w")             # <<<<<<<<<<<<<<
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 */
  __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_output_file); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(25, 53, __pyx_L1_error)
  __pyx_v_f = fopen(__pyx_t_8, ((char const *)"w"));

  /* "src/lxml/debug.pxi":54
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 */
  __pyx_t_1 = (__pyx_v_f == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/debug.pxi":55
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")             # <<<<<<<<<<<<<<
 *         try:
 *             if byte_count is None:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Failed_to_create_file, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 55, __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_ERR(25, 55, __pyx_L1_error)

    /* "src/lxml/debug.pxi":54
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 */
  }

  /* "src/lxml/debug.pxi":56
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:             # <<<<<<<<<<<<<<
 *             if byte_count is None:
 *                 tree.xmlMemDisplay(f)
 */
  /*try:*/ {

    /* "src/lxml/debug.pxi":57
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 *             if byte_count is None:             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplay(f)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_byte_count == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/debug.pxi":58
 *         try:
 *             if byte_count is None:
 *                 tree.xmlMemDisplay(f)             # <<<<<<<<<<<<<<
 *             else:
 *                 c_count = byte_count
 */
      xmlMemDisplay(__pyx_v_f);

      /* "src/lxml/debug.pxi":57
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 *             if byte_count is None:             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplay(f)
 *             else:
 */
      goto __pyx_L8;
    }

    /* "src/lxml/debug.pxi":60
 *                 tree.xmlMemDisplay(f)
 *             else:
 *                 c_count = byte_count             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplayLast(f, c_count)
 *         finally:
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_byte_count); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(25, 60, __pyx_L6_error)
      __pyx_v_c_count = __pyx_t_9;

      /* "src/lxml/debug.pxi":61
 *             else:
 *                 c_count = byte_count
 *                 tree.xmlMemDisplayLast(f, c_count)             # <<<<<<<<<<<<<<
 *         finally:
 *             stdio.fclose(f)
 */
      xmlMemDisplayLast(__pyx_v_f, __pyx_v_c_count);
    }
    __pyx_L8:;
  }

  /* "src/lxml/debug.pxi":63
 *                 tree.xmlMemDisplayLast(f, c_count)
 *         finally:
 *             stdio.fclose(f)             # <<<<<<<<<<<<<<
 * 
 *     def show(self, output_file=None, block_count=None):
 */
  /*finally:*/ {
    /*normal exit:*/{
      (void)(fclose(__pyx_v_f));
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 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;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __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_XGOTREF(__pyx_t_17);
      __pyx_t_7 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        (void)(fclose(__pyx_v_f));
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "src/lxml/debug.pxi":35
 *         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_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._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;
}

/* "src/lxml/debug.pxi":65
 *             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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__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 PyMethodDef __pyx_mdef_4lxml_5etree_9_MemDebug_9show = {"show", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_9show, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_8show};
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_9show(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_block_count = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,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);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_block_count,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_file);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 65, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_block_count);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 65, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "show") < 0)) __PYX_ERR(25, 65, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_output_file = values[0];
    __pyx_v_block_count = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("show", 0, 0, 2, __pyx_nargs); __PYX_ERR(25, 65, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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;
  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;
  char const *__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("show", 0);
  __Pyx_INCREF(__pyx_v_output_file);

  /* "src/lxml/debug.pxi":77
 *         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);
  if (__pyx_t_1) {

    /* "src/lxml/debug.pxi":78
 *         """
 *         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);

    /* "src/lxml/debug.pxi":77
 *         in the dump.
 *         """
 *         if output_file is None:             # <<<<<<<<<<<<<<
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):
 */
    goto __pyx_L3;
  }

  /* "src/lxml/debug.pxi":79
 *         if output_file is None:
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_output_file); 
  if (__pyx_t_1) {

    /* "src/lxml/debug.pxi":80
 *             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_ERR(25, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/debug.pxi":79
 *         if output_file is None:
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  }
  __pyx_L3:;

  /* "src/lxml/debug.pxi":82
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 *         f = stdio.fopen(output_file, "w")             # <<<<<<<<<<<<<<
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 */
  __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_output_file); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(25, 82, __pyx_L1_error)
  __pyx_v_f = fopen(__pyx_t_8, ((char const *)"w"));

  /* "src/lxml/debug.pxi":83
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 */
  __pyx_t_1 = (__pyx_v_f == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "src/lxml/debug.pxi":84
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")             # <<<<<<<<<<<<<<
 *         try:
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Failed_to_create_file, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 84, __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_ERR(25, 84, __pyx_L1_error)

    /* "src/lxml/debug.pxi":83
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:
 */
  }

  /* "src/lxml/debug.pxi":85
 *         if f is NULL:
 *             raise IOError(f"Failed to create file {output_file.decode(sys.getfilesystemencoding())}")
 *         try:             # <<<<<<<<<<<<<<
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 *         finally:
 */
  /*try:*/ {

    /* "src/lxml/debug.pxi":86
 *             raise IOError(f"Failed to create file {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) {
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_block_count); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(25, 86, __pyx_L6_error)
      __pyx_t_7 = __pyx_t_9;
    } else {
      __pyx_t_7 = xmlMemBlocks();
    }
    xmlMemShow(__pyx_v_f, __pyx_t_7);
  }

  /* "src/lxml/debug.pxi":88
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 *         finally:
 *             stdio.fclose(f)             # <<<<<<<<<<<<<<
 * 
 * memory_debugger = _MemDebug()
 */
  /*finally:*/ {
    /*normal exit:*/{
      (void)(fclose(__pyx_v_f));
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __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_2); __pyx_t_2 = 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;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 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_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        (void)(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_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "src/lxml/debug.pxi":65
 *             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_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._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 int __pyx_tp_traverse_4lxml_5etree_Error(PyObject *o, visitproc v, void *a) {
  int e;
  if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse); else { e = (&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse(o,v,a); if (e) return e; }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_Error(PyObject *o) {
  if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_clear); else (&((PyTypeObject*)PyExc_Exception)[0])->tp_clear(o);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Error_slots[] = {
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Error_spec = {
  "lxml.etree.Error",
  sizeof(struct __pyx_obj_4lxml_5etree_Error),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_Error_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Error = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""Error", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Error), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_LxmlError[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_LxmlError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_LxmlError},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9LxmlError_1__init__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_LxmlError_spec = {
  "lxml.etree.LxmlError",
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_LxmlError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_LxmlError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""LxmlError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_LxmlError, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_C14NError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error during C14N serialisation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_C14NError_spec = {
  "lxml.etree.C14NError",
  sizeof(struct __pyx_obj_4lxml_5etree_C14NError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_C14NError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_C14NError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""C14NError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_C14NError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error during C14N serialisation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__TempStore_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__TempStore},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__TempStore},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__TempStore},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__TempStore},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10_TempStore_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__TempStore},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__TempStore_spec = {
  "lxml.etree._TempStore",
  sizeof(struct __pyx_obj_4lxml_5etree__TempStore),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__TempStore_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__TempStore = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ExceptionContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_exc_info);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ExceptionContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ExceptionContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ExceptionContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ExceptionContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ExceptionContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ExceptionContext_spec = {
  "lxml.etree._ExceptionContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ExceptionContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ExceptionContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ExceptionContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry __pyx_vtable_4lxml_5etree__LogEntry;

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_freelist_4lxml_5etree__LogEntry[16];
static int __pyx_freecount_4lxml_5etree__LogEntry = 0;
#endif

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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__LogEntry > 0) & (int)(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);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__LogEntry;
  p->_message = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_filename = ((PyObject*)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 *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_message);
  Py_CLEAR(p->_filename);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__LogEntry < 16) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4path_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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__LogEntry[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_9_LogEntry_3__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__LogEntry[] = {
  {(char *)"domain_name", __pyx_getprop_4lxml_5etree_9_LogEntry_domain_name, 0, (char *)PyDoc_STR("The name of the error domain.  See lxml.etree.ErrorDomains\n        "), 0},
  {(char *)"type_name", __pyx_getprop_4lxml_5etree_9_LogEntry_type_name, 0, (char *)PyDoc_STR("The name of the error type.  See lxml.etree.ErrorTypes\n        "), 0},
  {(char *)"level_name", __pyx_getprop_4lxml_5etree_9_LogEntry_level_name, 0, (char *)PyDoc_STR("The name of the error level.  See lxml.etree.ErrorLevels\n        "), 0},
  {(char *)"message", __pyx_getprop_4lxml_5etree_9_LogEntry_message, 0, (char *)PyDoc_STR("The log message string.\n        "), 0},
  {(char *)"filename", __pyx_getprop_4lxml_5etree_9_LogEntry_filename, 0, (char *)PyDoc_STR("The file path where the report originated, if any.\n        "), 0},
  {(char *)"path", __pyx_getprop_4lxml_5etree_9_LogEntry_path, 0, (char *)PyDoc_STR("The XPath for the node where the error was detected.\n        "), 0},
  {(char *)"domain", __pyx_getprop_4lxml_5etree_9_LogEntry_domain, 0, (char *)0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_9_LogEntry_type, 0, (char *)0, 0},
  {(char *)"level", __pyx_getprop_4lxml_5etree_9_LogEntry_level, 0, (char *)0, 0},
  {(char *)"line", __pyx_getprop_4lxml_5etree_9_LogEntry_line, 0, (char *)0, 0},
  {(char *)"column", __pyx_getprop_4lxml_5etree_9_LogEntry_column, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__LogEntry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__LogEntry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__},
  {Py_tp_doc, (void *)PyDoc_STR("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    - path: the location in which the error was found (if available)\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__LogEntry},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__LogEntry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__LogEntry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__LogEntry_spec = {
  "lxml.etree._LogEntry",
  sizeof(struct __pyx_obj_4lxml_5etree__LogEntry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__LogEntry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__LogEntry = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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, /*tp_flags*/
  PyDoc_STR("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    - path: the location in which the error was found (if available)\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__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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_first_error);
  Py_CLEAR(p->last_error);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseErrorLog[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__, METH_NOARGS|METH_COEXIST, 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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseErrorLog},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseErrorLog},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseErrorLog_spec = {
  "lxml.etree._BaseErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ListErrorLog) {
      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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ListErrorLog[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"filter_domains", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains},
  {"filter_types", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types},
  {"filter_levels", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels},
  {"filter_from_level", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level},
  {"filter_from_fatals", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals},
  {"filter_from_errors", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors},
  {"filter_from_warnings", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ListErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ListErrorLog},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_15__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__ListErrorLog},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("Immutable base version of a list based error log.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ListErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ListErrorLog},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ListErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ListErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ListErrorLog_spec = {
  "lxml.etree._ListErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__ListErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ListErrorLog_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__ListErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLogContext __pyx_vtable_4lxml_5etree__ErrorLogContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLogContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ErrorLogContext;
  p->old_xslt_error_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ErrorLogContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p = (struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->old_xslt_error_log);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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

static int __pyx_tp_clear_4lxml_5etree__ErrorLogContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *p = (struct __pyx_obj_4lxml_5etree__ErrorLogContext *)o;
  Py_CLEAR(p->old_xslt_error_log);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ErrorLogContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLogContext},
  {Py_tp_doc, (void *)PyDoc_STR("\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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLogContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLogContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ErrorLogContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ErrorLogContext_spec = {
  "lxml.etree._ErrorLogContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLogContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ErrorLogContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLogContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("\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*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLogContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLogContext, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ErrorLog) {
      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[] = {
  {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ErrorLog},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9_ErrorLog_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ErrorLog_spec = {
  "lxml.etree._ErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DomainErrorLog_slots[] = {
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DomainErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DomainErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DomainErrorLog_spec = {
  "lxml.etree._DomainErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__DomainErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DomainErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DomainErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__RotatingErrorLog_slots[] = {
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__RotatingErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__RotatingErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__RotatingErrorLog_spec = {
  "lxml.etree._RotatingErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree__RotatingErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__RotatingErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__RotatingErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_PyErrorLog) {
      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[] = {
  {"log", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10PyErrorLog_5log, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10PyErrorLog_4log},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_PyErrorLog[] = {
  {(char *)"level_map", __pyx_getprop_4lxml_5etree_10PyErrorLog_level_map, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PyErrorLog_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_PyErrorLog},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_PyErrorLog},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_PyErrorLog},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PyErrorLog},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_PyErrorLog},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10PyErrorLog_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PyErrorLog},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PyErrorLog_spec = {
  "lxml.etree.PyErrorLog",
  sizeof(struct __pyx_obj_4lxml_5etree_PyErrorLog),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PyErrorLog_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PyErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__Document __pyx_vtable_4lxml_5etree__Document;

#if CYTHON_USE_FREELISTS
static struct LxmlDocument *__pyx_freelist_4lxml_5etree__Document[8];
static int __pyx_freecount_4lxml_5etree__Document = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlDocument *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__Document > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_prefix_tail);
  Py_CLEAR(p->_parser);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__Document < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct LxmlDocument)))) {
    __pyx_freelist_4lxml_5etree__Document[__pyx_freecount_4lxml_5etree__Document++] = ((struct LxmlDocument *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlDocumentType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Document},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Document},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Document},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Document},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Document},
  {0, 0},
};
static PyType_Spec LxmlDocumentType_spec = {
  "lxml.etree._Document",
  sizeof(struct LxmlDocument),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  LxmlDocumentType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlDocumentType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_Document", /*tp_name*/
  sizeof(struct LxmlDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Document, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_DocInfo __pyx_vtable_4lxml_5etree_DocInfo;

static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree_DocInfo *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_DocInfo;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_DocInfo) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 int __pyx_setprop_4lxml_5etree_7DocInfo_public_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_9public_id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

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 int __pyx_setprop_4lxml_5etree_7DocInfo_system_url(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_10system_url_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

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[] = {
  {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7DocInfo_3clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7DocInfo_2clear},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DocInfo[] = {
  {(char *)"root_name", __pyx_getprop_4lxml_5etree_7DocInfo_root_name, 0, (char *)PyDoc_STR("Returns the name of the root node as defined by the DOCTYPE."), 0},
  {(char *)"public_id", __pyx_getprop_4lxml_5etree_7DocInfo_public_id, __pyx_setprop_4lxml_5etree_7DocInfo_public_id, (char *)PyDoc_STR("Public ID of the DOCTYPE.\n\n        Mutable.  May be set to a valid string or None.  If a DTD does not\n        exist, setting this variable (even to None) will create one.\n        "), 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_7DocInfo_system_url, __pyx_setprop_4lxml_5etree_7DocInfo_system_url, (char *)PyDoc_STR("System ID of the DOCTYPE.\n\n        Mutable.  May be set to a valid string or None.  If a DTD does not\n        exist, setting this variable (even to None) will create one.\n        "), 0},
  {(char *)"xml_version", __pyx_getprop_4lxml_5etree_7DocInfo_xml_version, 0, (char *)PyDoc_STR("Returns the XML version as declared by the document."), 0},
  {(char *)"encoding", __pyx_getprop_4lxml_5etree_7DocInfo_encoding, 0, (char *)PyDoc_STR("Returns the encoding name as declared by the document."), 0},
  {(char *)"standalone", __pyx_getprop_4lxml_5etree_7DocInfo_standalone, 0, (char *)PyDoc_STR("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        "), 0},
  {(char *)"URL", __pyx_getprop_4lxml_5etree_7DocInfo_URL, __pyx_setprop_4lxml_5etree_7DocInfo_URL, (char *)PyDoc_STR("The source URL of the document (or None if unknown)."), 0},
  {(char *)"doctype", __pyx_getprop_4lxml_5etree_7DocInfo_doctype, 0, (char *)PyDoc_STR("Returns a DOCTYPE declaration string for the document."), 0},
  {(char *)"internalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_internalDTD, 0, (char *)PyDoc_STR("Returns a DTD validator based on the internal subset of the document."), 0},
  {(char *)"externalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_externalDTD, 0, (char *)PyDoc_STR("Returns a DTD validator based on the external subset of the document."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DocInfo_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_DocInfo},
  {Py_tp_doc, (void *)PyDoc_STR("Document information provided by parser and DTD.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_DocInfo},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_DocInfo},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_DocInfo},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_DocInfo},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_DocInfo},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DocInfo_spec = {
  "lxml.etree.DocInfo",
  sizeof(struct __pyx_obj_4lxml_5etree_DocInfo),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DocInfo_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DocInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__Element) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_tag);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_8_Element_31__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_8_Element_31__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Element[] = {
  {"_init", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_1_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element__init},
  {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_8__deepcopy__},
  {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_11__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_10__copy__},
  {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_13set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_12set},
  {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_15append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_14append},
  {"addnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_17addnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_16addnext},
  {"addprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_19addprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_18addprevious},
  {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_21extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_20extend},
  {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_23clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_22clear},
  {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_25insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_24insert},
  {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_27remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_26remove},
  {"replace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_29replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_28replace},
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_8_Element_31__repr__, METH_NOARGS|METH_COEXIST, __pyx_doc_4lxml_5etree_8_Element_30__repr__},
  {"__reversed__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_43__reversed__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_42__reversed__},
  {"index", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_45index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_44index},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_47get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_46get},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_49keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_48keys},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_51values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_50values},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_53items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_52items},
  {"getchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_55getchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_54getchildren},
  {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_57getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_56getparent},
  {"getnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_59getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_58getnext},
  {"getprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_61getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_60getprevious},
  {"itersiblings", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_63itersiblings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_62itersiblings},
  {"iterancestors", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_65iterancestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_64iterancestors},
  {"iterdescendants", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_67iterdescendants, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_66iterdescendants},
  {"iterchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_69iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_68iterchildren},
  {"getroottree", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_71getroottree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_70getroottree},
  {"getiterator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_73getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_72getiterator},
  {"iter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_75iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_74iter},
  {"itertext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_77itertext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_76itertext},
  {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_79makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_78makeelement},
  {"find", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_81find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_80find},
  {"findtext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_83findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_82findtext},
  {"findall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_85findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_84findall},
  {"iterfind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_87iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_86iterfind},
  {"xpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_89xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_88xpath},
  {"cssselect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8_Element_91cssselect, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8_Element_90cssselect},
  {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, (char *)PyDoc_STR("Element tag\n        "), 0},
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_8_Element_attrib, 0, (char *)PyDoc_STR("Element attribute dictionary. Where possible, use get(), set(),\n        keys(), values() and items() to access element attributes.\n        "), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_8_Element_text, __pyx_setprop_4lxml_5etree_8_Element_text, (char *)PyDoc_STR("Text before the first subelement. This is either a string or\n        the value None, if there was no text.\n        "), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_8_Element_tail, __pyx_setprop_4lxml_5etree_8_Element_tail, (char *)PyDoc_STR("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        "), 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_8_Element_prefix, 0, (char *)PyDoc_STR("Namespace prefix or None.\n        "), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_8_Element_sourceline, __pyx_setprop_4lxml_5etree_8_Element_sourceline, (char *)PyDoc_STR("Original line number as found by the parser or None if unknown.\n        "), 0},
  {(char *)"nsmap", __pyx_getprop_4lxml_5etree_8_Element_nsmap, 0, (char *)PyDoc_STR("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        "), 0},
  {(char *)"base", __pyx_getprop_4lxml_5etree_8_Element_base, __pyx_setprop_4lxml_5etree_8_Element_base, (char *)PyDoc_STR("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        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Element},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_8_Element_31__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_8_Element_37__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_8_Element_35__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__Element},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_8_Element_39__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_8_Element_35__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_8_Element_33__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__Element},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_8_Element_41__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Element},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Element},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Element},
  {0, 0},
};
static PyType_Spec LxmlElementType_spec = {
  "lxml.etree._Element",
  sizeof(struct LxmlElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementType_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__Element = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__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)
  "lxml.etree.""_Element", /*tp_name*/
  sizeof(struct LxmlElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 {
    __Pyx_TypeName o_type_name;
    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);
    o_type_name = __Pyx_PyType_GetName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_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[] = {
  {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set},
  {"append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append},
  {"insert", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text, __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___ContentOnlyElement_slots[] = {
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree___ContentOnlyElement},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree___ContentOnlyElement},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree___ContentOnlyElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___ContentOnlyElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___ContentOnlyElement_spec = {
  "lxml.etree.__ContentOnlyElement",
  sizeof(struct __pyx_obj_4lxml_5etree___ContentOnlyElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree___ContentOnlyElement_slots,
};
#else

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 || 0
  __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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_8_Comment_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_8_Comment_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Comment[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_8_Comment_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Comment[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_8_Comment_tag, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Comment_slots[] = {
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_8_Comment_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Comment},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Comment},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Comment},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Comment_spec = {
  "lxml.etree._Comment",
  sizeof(struct __pyx_obj_4lxml_5etree__Comment),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Comment_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Comment = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ProcessingInstruction[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)0, 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target, __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target, (char *)0, 0},
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_attrib, 0, (char *)PyDoc_STR("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        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ProcessingInstruction_slots[] = {
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ProcessingInstruction},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ProcessingInstruction},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ProcessingInstruction},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ProcessingInstruction_spec = {
  "lxml.etree._ProcessingInstruction",
  sizeof(struct __pyx_obj_4lxml_5etree__ProcessingInstruction),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ProcessingInstruction_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_7_Entity_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_7_Entity_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Entity[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_7_Entity_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Entity[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_7_Entity_tag, 0, (char *)0, 0},
  {(char *)"name", __pyx_getprop_4lxml_5etree_7_Entity_name, __pyx_setprop_4lxml_5etree_7_Entity_name, (char *)0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_7_Entity_text, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Entity_slots[] = {
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_Entity_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Entity},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Entity},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Entity},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Entity_spec = {
  "lxml.etree._Entity",
  sizeof(struct __pyx_obj_4lxml_5etree__Entity),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Entity_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Entity = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_QName) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  Py_CLEAR(p->text);
  Py_CLEAR(p->localname);
  Py_CLEAR(p->namespace);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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, (char *)0, 0},
  {(char *)"localname", __pyx_getprop_4lxml_5etree_5QName_localname, 0, (char *)0, 0},
  {(char *)"namespace", __pyx_getprop_4lxml_5etree_5QName_namespace, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_QName_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_QName},
  {Py_tp_hash, (void *)__pyx_pw_4lxml_5etree_5QName_5__hash__},
  {Py_tp_str, (void *)__pyx_pw_4lxml_5etree_5QName_3__str__},
  {Py_tp_doc, (void *)PyDoc_STR("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.  ``None`` as first argument is ignored in\n    order to allow for generic 2-argument usage.\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 prefix\n    on assignment 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    ")},
  {Py_tp_richcompare, (void *)__pyx_pw_4lxml_5etree_5QName_7__richcmp__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_QName},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_QName},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_5QName_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_QName},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_QName_spec = {
  "lxml.etree.QName",
  sizeof(struct __pyx_obj_4lxml_5etree_QName),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_QName_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_QName = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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.  ``None`` as first argument is ignored in\n    order to allow for generic 2-argument usage.\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 prefix\n    on assignment 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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementTree) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_context_node);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_1parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_parse},
  {"_setroot", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_2_setroot},
  {"getroot", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_5getroot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_4getroot},
  {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_11write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_10write},
  {"getpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_13getpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_12getpath},
  {"getelementpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_14getelementpath},
  {"getiterator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_16getiterator},
  {"iter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_19iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_18iter},
  {"find", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_21find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_20find},
  {"findtext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_23findtext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_22findtext},
  {"findall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_25findall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_24findall},
  {"iterfind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_26iterfind},
  {"xpath", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_29xpath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_28xpath},
  {"xslt", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_31xslt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_30xslt},
  {"relaxng", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_32relaxng},
  {"xmlschema", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_34xmlschema},
  {"xinclude", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_36xinclude},
  {"write_c14n", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_12_ElementTree_38write_c14n},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementTree[] = {
  {(char *)"docinfo", __pyx_getprop_4lxml_5etree_12_ElementTree_docinfo, 0, (char *)PyDoc_STR("Information about the document provided by parser and DTD."), 0},
  {(char *)"parser", __pyx_getprop_4lxml_5etree_12_ElementTree_parser, 0, (char *)PyDoc_STR("The parser that was used to parse the document in this ElementTree.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementTreeType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementTree},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementTree},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementTree},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementTree},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ElementTree},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementTree},
  {0, 0},
};
static PyType_Spec LxmlElementTreeType_spec = {
  "lxml.etree._ElementTree",
  sizeof(struct LxmlElementTree),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementTreeType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementTreeType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementTree", /*tp_name*/
  sizeof(struct LxmlElementTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTree, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__Attrib *__pyx_freelist_4lxml_5etree__Attrib[16];
static int __pyx_freecount_4lxml_5etree__Attrib = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Attrib *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__Attrib > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__Attrib < 16) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_7_Attrib_13__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_7_Attrib_13__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Attrib[] = {
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_7update, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"pop", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_9pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_7_Attrib_13__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_25get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_27keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_33values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_35itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_37items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_39iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"has_key", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_Attrib_41has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Attrib_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Attrib},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_Attrib_13__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_7_Attrib_21__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_7_Attrib_23__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__Attrib},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_7_Attrib_43__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_7_Attrib_23__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__Attrib},
  {Py_tp_doc, (void *)PyDoc_STR("A dict-like proxy for the ``Element.attrib`` property.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Attrib},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Attrib},
  {Py_tp_richcompare, (void *)__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_7_Attrib_29__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Attrib},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Attrib},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Attrib_spec = {
  "lxml.etree._Attrib",
  sizeof(struct __pyx_obj_4lxml_5etree__Attrib),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Attrib_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__Attrib = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AttribIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_15_AttribIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AttribIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AttribIterator},
  {Py_tp_doc, (void *)PyDoc_STR("Attribute iterator - for internal use only!\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AttribIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AttribIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AttribIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AttribIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AttribIterator_spec = {
  "lxml.etree._AttribIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__AttribIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AttribIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AttribIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_pystrings);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementTagMatcherType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Dead but public. :)\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementTagMatcher},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementTagMatcher},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementTagMatcher},
  {0, 0},
};
static PyType_Spec LxmlElementTagMatcherType_spec = {
  "lxml.etree._ElementTagMatcher",
  sizeof(struct LxmlElementTagMatcher),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementTagMatcherType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementTagMatcher", /*tp_name*/
  sizeof(struct LxmlElementTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementIterator) {
      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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_16_ElementIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementIteratorType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementIterator},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Dead but public. :)\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementIterator},
  {0, 0},
};
static PyType_Spec LxmlElementIteratorType_spec = {
  "lxml.etree._ElementIterator",
  sizeof(struct LxmlElementIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementIteratorType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementIteratorType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_ElementIterator", /*tp_name*/
  sizeof(struct LxmlElementIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_py_tags);
  Py_CLEAR(p->_cached_doc);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MultiTagMatcher_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Match an xmlNode against a list of tags.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__MultiTagMatcher},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__MultiTagMatcher},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MultiTagMatcher},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MultiTagMatcher},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MultiTagMatcher_spec = {
  "lxml.etree._MultiTagMatcher",
  sizeof(struct __pyx_obj_4lxml_5etree__MultiTagMatcher),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__MultiTagMatcher_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MultiTagMatcher = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  Py_CLEAR(p->_matcher);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementMatchIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ElementMatchIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementMatchIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementMatchIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ElementMatchIterator_spec = {
  "lxml.etree._ElementMatchIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__ElementMatchIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ElementMatchIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ElementMatchIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementChildIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementChildIterator_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("ElementChildIterator(self, node, tag=None, reversed=False)\n    Iterates over the children of an element.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementChildIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementChildIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementChildIterator_spec = {
  "lxml.etree.ElementChildIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementChildIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementChildIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementChildIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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 || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_SiblingsIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SiblingsIterator_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_SiblingsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_SiblingsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SiblingsIterator_spec = {
  "lxml.etree.SiblingsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_SiblingsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_SiblingsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SiblingsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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 || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AncestorsIterator[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_AncestorsIterator_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("AncestorsIterator(self, node, tag=None)\n    Iterates over the ancestors of an element (from parent to parent).\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementMatchIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementMatchIterator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_AncestorsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_AncestorsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_AncestorsIterator_spec = {
  "lxml.etree.AncestorsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_AncestorsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_AncestorsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_AncestorsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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 || 0
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_next_node);
  Py_CLEAR(p->_top_node);
  Py_CLEAR(p->_matcher);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDepthFirstIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementDepthFirstIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementDepthFirstIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec = {
  "lxml.etree.ElementDepthFirstIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementDepthFirstIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementDepthFirstIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o);
  p->_events = 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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_start_element);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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->_events) {
    e = (*v)(p->_events, 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->_events);
  Py_CLEAR(p->_start_element);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementTextIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementTextIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementTextIterator},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementTextIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementTextIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementTextIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementTextIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementTextIterator_spec = {
  "lxml.etree.ElementTextIterator",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementTextIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementTextIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementTextIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_CDATA) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  Py_CLEAR(p->_utf8_data);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_CDATA[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CDATA_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_CDATA},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CDATA},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CDATA},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CDATA_spec = {
  "lxml.etree.CDATA",
  sizeof(struct __pyx_obj_4lxml_5etree_CDATA),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_CDATA_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CDATA = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_source_proxy);
  Py_CLEAR(p->_dependent_proxies);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyProxy[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__},
  {"iterchildren", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren},
  {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent},
  {"getnext", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext},
  {"getprevious", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)PyDoc_STR("Element tag\n        "), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text, 0, (char *)PyDoc_STR("Text before the first subelement. This is either a string or\n        the value None, if there was no text.\n        "), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail, 0, (char *)PyDoc_STR("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        "), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline, 0, (char *)PyDoc_STR("Original line number as found by the parser or None if unknown.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyProxy_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__},
  {Py_nb_bool, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__bool__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__ReadOnlyProxy},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy class suitable for PIs/Comments (for internal use only!).")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyProxy_spec = {
  "lxml.etree._ReadOnlyProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyProxy_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number__ReadOnlyProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  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*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyPIProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for processing instructions (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyPIProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec = {
  "lxml.etree._ReadOnlyPIProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyPIProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for entity references (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec = {
  "lxml.etree._ReadOnlyEntityProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyEntityProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_nsmap(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5nsmap_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyElementProxy[] = {
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix, 0, (char *)PyDoc_STR("Namespace prefix or None.\n        "), 0},
  {(char *)"nsmap", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_nsmap, 0, (char *)PyDoc_STR("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        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ReadOnlyElementProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("The main read-only Element proxy class (for internal use only!).")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ReadOnlyElementProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ReadOnlyElementProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec = {
  "lxml.etree._ReadOnlyElementProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ReadOnlyElementProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueNodeWrapper[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__OpaqueNodeWrapper_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__OpaqueNodeWrapper},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec = {
  "lxml.etree._OpaqueNodeWrapper",
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree__OpaqueNodeWrapper_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueNodeWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_slots[] = {
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__OpaqueDocumentWrapper},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec = {
  "lxml.etree._OpaqueDocumentWrapper",
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__OpaqueDocumentWrapper_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueDocumentWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy that allows changing the text content.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec = {
  "lxml.etree._ModifyContentOnlyProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy that allows changing the text/target content of a\n    processing instruction.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec = {
  "lxml.etree._ModifyContentOnlyPIProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only proxy for entity references (for internal use only!)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec = {
  "lxml.etree._ModifyContentOnlyEntityProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {"extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)PyDoc_STR("Text before the first subelement. This is either a string or the\n        value None, if there was no text.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AppendOnlyElementProxy_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A read-only element that allows adding children and changing the\n    text content (i.e. everything that adds to the subtree).\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ReadOnlyProxy},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AppendOnlyElementProxy},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__AppendOnlyElementProxy},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec = {
  "lxml.etree._AppendOnlyElementProxy",
  sizeof(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AppendOnlyElementProxy_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AppendOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_ElementBase[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementBaseType_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11ElementBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Element},
  {0, 0},
};
static PyType_Spec LxmlElementBaseType_spec = {
  "lxml.etree.ElementBase",
  sizeof(struct LxmlElementBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlElementBaseType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementBaseType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementBase", /*tp_name*/
  sizeof(struct LxmlElementBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_11ElementBase_1__init__, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CommentBase_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CommentBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11CommentBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CommentBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CommentBase_spec = {
  "lxml.etree.CommentBase",
  sizeof(struct __pyx_obj_4lxml_5etree_CommentBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_CommentBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CommentBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PIBase_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PIBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_6PIBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PIBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PIBase_spec = {
  "lxml.etree.PIBase",
  sizeof(struct __pyx_obj_4lxml_5etree_PIBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PIBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PIBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_EntityBase_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_EntityBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10EntityBase_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_EntityBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_EntityBase_spec = {
  "lxml.etree.EntityBase",
  sizeof(struct __pyx_obj_4lxml_5etree_EntityBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_EntityBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_EntityBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlElementClassLookupType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ElementClassLookup(self)\n    Superclass of Element class lookups.\n    ")},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementClassLookup},
  {0, 0},
};
static PyType_Spec LxmlElementClassLookupType_spec = {
  "lxml.etree.ElementClassLookup",
  sizeof(struct LxmlElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  LxmlElementClassLookupType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ElementClassLookup", /*tp_name*/
  sizeof(struct LxmlElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->fallback);
  __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[] = {
  {"set_fallback", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_METH_FASTCALL|METH_KEYWORDS, __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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot LxmlFallbackElementClassLookupType_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("FallbackElementClassLookup(self, fallback=None)\n\n    Superclass of Element class lookups with additional fallback.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup},
  {0, 0},
};
static PyType_Spec LxmlFallbackElementClassLookupType_spec = {
  "lxml.etree.FallbackElementClassLookup",
  sizeof(struct LxmlFallbackElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  LxmlFallbackElementClassLookupType_slots,
};
#else

DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""FallbackElementClassLookup", /*tp_name*/
  sizeof(struct LxmlFallbackElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup) {
      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);
  __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, (char *)0, 0},
  {(char *)"comment_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class, 0, (char *)0, 0},
  {(char *)"pi_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class, 0, (char *)0, 0},
  {(char *)"entity_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementDefaultClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_ElementDefaultClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec = {
  "lxml.etree.ElementDefaultClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementDefaultClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementDefaultClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup) {
      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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec = {
  "lxml.etree.AttributeBasedElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("ParserBasedElementClassLookup(self, fallback=None)\n    Element class lookup based on the XML parser.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ParserBasedElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec = {
  "lxml.etree.ParserBasedElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ParserBasedElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ParserBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CustomElementClassLookup[] = {
  {"lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_CustomElementClassLookup_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_CustomElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_CustomElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_CustomElementClassLookup_spec = {
  "lxml.etree.CustomElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_CustomElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_CustomElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PythonElementClassLookup[] = {
  {"lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_PythonElementClassLookup_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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 https://lxml.de/element_classes.html\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_PythonElementClassLookup},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_PythonElementClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_PythonElementClassLookup_spec = {
  "lxml.etree.PythonElementClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_PythonElementClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_PythonElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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 https://lxml.de/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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_LxmlRegistryError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class of lxml registry errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_LxmlRegistryError_spec = {
  "lxml.etree.LxmlRegistryError",
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_LxmlRegistryError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_LxmlRegistryError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""LxmlRegistryError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class of lxml registry errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_NamespaceRegistryError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error registering a namespace extension.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_NamespaceRegistryError_spec = {
  "lxml.etree.NamespaceRegistryError",
  sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_NamespaceRegistryError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_NamespaceRegistryError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""NamespaceRegistryError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error registering a namespace extension.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry) {
      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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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) {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
  else {
    return __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__NamespaceRegistry[] = {
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_NamespaceRegistry__deco", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__NamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__NamespaceRegistry},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__call__},
  {Py_tp_doc, (void *)PyDoc_STR("Dictionary-like namespace registry")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__NamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__NamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__NamespaceRegistry_spec = {
  "lxml.etree._NamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__NamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__NamespaceRegistry_slots,
};
#else

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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 {
    __Pyx_TypeName o_type_name;
    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);
    o_type_name = __Pyx_PyType_GetName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ClassNamespaceRegistry[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ClassNamespaceRegistry_slots[] = {
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry},
  {Py_tp_doc, (void *)PyDoc_STR("Dictionary-like registry for namespace implementation classes")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ClassNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec = {
  "lxml.etree._ClassNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ClassNamespaceRegistry_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping__ClassNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__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_HAVE_GC, /*tp_flags*/
  PyDoc_STR("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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup) {
      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[] = {
  {"get_namespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_doc, (void *)PyDoc_STR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n\n    Usage:\n\n    >>> lookup = ElementNamespaceClassLookup()\n    >>> ns_elements = lookup.get_namespace(\"http://schema.org/Movie\")\n\n    >>> @ns_elements\n    ... class movie(ElementBase):\n    ...     \"Element implementation for 'movie' tag (using class name) in schema namespace.\"\n\n    >>> @ns_elements(\"movie\")\n    ... class MovieElement(ElementBase):\n    ...     \"Element implementation for 'movie' tag (explicit tag name) in schema namespace.\"\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ElementNamespaceClassLookup},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec = {
  "lxml.etree.ElementNamespaceClassLookup",
  sizeof(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ElementNamespaceClassLookup_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ElementNamespaceClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n\n    Usage:\n\n    >>> lookup = ElementNamespaceClassLookup()\n    >>> ns_elements = lookup.get_namespace(\"http://schema.org/Movie\")\n\n    >>> @ns_elements\n    ... class movie(ElementBase):\n    ...     \"Element implementation for 'movie' tag (using class name) in schema namespace.\"\n\n    >>> @ns_elements(\"movie\")\n    ... class MovieElement(ElementBase):\n    ...     \"Element implementation for 'movie' tag (explicit tag name) in schema namespace.\"\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 {
    __Pyx_TypeName o_type_name;
    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);
    o_type_name = __Pyx_PyType_GetName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_slots[] = {
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__NamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__NamespaceRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FunctionNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec = {
  "lxml.etree._FunctionNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FunctionNamespaceRegistry_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping__FunctionNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__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*/
  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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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, (char *)PyDoc_STR("Namespace prefix for extension functions."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec = {
  "lxml.etree._XPathFunctionNamespaceRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_17__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_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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__InputDocument_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__InputDocument},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__InputDocument},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__InputDocument},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__InputDocument},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__InputDocument},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__InputDocument_spec = {
  "lxml.etree._InputDocument",
  sizeof(struct __pyx_obj_4lxml_5etree__InputDocument),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__InputDocument_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__InputDocument = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Resolver(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_Resolver) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_Resolver[] = {
  {"resolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_1resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_resolve},
  {"resolve_empty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_2resolve_empty},
  {"resolve_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_5resolve_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_4resolve_string},
  {"resolve_filename", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_6resolve_filename},
  {"resolve_file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8Resolver_9resolve_file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8Resolver_8resolve_file},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Resolver_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Resolver},
  {Py_tp_doc, (void *)PyDoc_STR("This is the base class of all resolvers.")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_Resolver},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Resolver},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Resolver_spec = {
  "lxml.etree.Resolver",
  sizeof(struct __pyx_obj_4lxml_5etree_Resolver),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_Resolver_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Resolver = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ResolverRegistry[] = {
  {"add", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_2add},
  {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove},
  {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy},
  {"resolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve},
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ResolverRegistry_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ResolverRegistry},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ResolverRegistry},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ResolverRegistry},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ResolverRegistry},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ResolverRegistry},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ResolverRegistry_spec = {
  "lxml.etree._ResolverRegistry",
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverRegistry),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ResolverRegistry_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ResolverRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ResolverContext) {
      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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ResolverContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ResolverContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ResolverContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ResolverContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ResolverContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ResolverContext_spec = {
  "lxml.etree._ResolverContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ResolverContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ParserError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Internal lxml parser error.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ParserError_spec = {
  "lxml.etree.ParserError",
  sizeof(struct __pyx_obj_4lxml_5etree_ParserError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_ParserError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ParserError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""ParserError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ParserError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Internal lxml parser error.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_default_parser);
  Py_CLEAR(p->_implied_parser_contexts);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserDictionaryContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserDictionaryContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserDictionaryContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserDictionaryContext_spec = {
  "lxml.etree._ParserDictionaryContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserDictionaryContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserDictionaryContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FileReaderContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FileReaderContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FileReaderContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FileReaderContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FileReaderContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FileReaderContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FileReaderContext_spec = {
  "lxml.etree._FileReaderContext",
  sizeof(struct __pyx_obj_4lxml_5etree__FileReaderContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FileReaderContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FileReaderContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ParserContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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 PyMethodDef __pyx_methods_4lxml_5etree__ParserContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserContext_spec = {
  "lxml.etree._ParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseParser) {
      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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"set_element_class_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup},
  {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_4copy},
  {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11_BaseParser_6makeelement},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseParser[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_11_BaseParser_error_log, 0, (char *)PyDoc_STR("The error log of the last parser run.\n        "), 0},
  {(char *)"resolvers", __pyx_getprop_4lxml_5etree_11_BaseParser_resolvers, 0, (char *)PyDoc_STR("The custom resolver registry of this parser."), 0},
  {(char *)"version", __pyx_getprop_4lxml_5etree_11_BaseParser_version, 0, (char *)PyDoc_STR("The version of the underlying XML parser."), 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_11_BaseParser_target, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseParser_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseParser},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseParser},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11_BaseParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseParser_spec = {
  "lxml.etree._BaseParser",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {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, (char *)PyDoc_STR("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        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FeedParser_slots[] = {
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FeedParser},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__FeedParser},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FeedParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FeedParser_spec = {
  "lxml.etree._FeedParser",
  sizeof(struct __pyx_obj_4lxml_5etree__FeedParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FeedParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FeedParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLParser_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema: XMLSchema =None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, collect_ids=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            - save memory for short text content (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (default: True, always True with DTD validation)\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    - resolve_entities - replace entities by their text value: False for keeping the\n          entity references, True for resolving them, and 'internal' for resolving\n          internal definitions only (no external file/URL access).\n          The default used to be True and was changed to 'internal' in lxml 5.0.\n    - encoding - override the document encoding (note: libiconv encoding name)\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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9XMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLParser_spec = {
  "lxml.etree.XMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema: XMLSchema =None, huge_tree=False, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, collect_ids=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            - save memory for short text content (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (default: True, always True with DTD validation)\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    - resolve_entities - replace entities by their text value: False for keeping the\n          entity references, True for resolving them, and 'internal' for resolving\n          internal definitions only (no external file/URL access).\n          The default used to be True and was changed to 'internal' in lxml 5.0.\n    - encoding - override the document encoding (note: libiconv encoding name)\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {"read_events", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLPullParser_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLPullParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13XMLPullParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLPullParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLPullParser_spec = {
  "lxml.etree.XMLPullParser",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLPullParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLPullParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ETCompatXMLParser_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ETCompatXMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ETCompatXMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ETCompatXMLParser_spec = {
  "lxml.etree.ETCompatXMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ETCompatXMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ETCompatXMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_HTMLParser_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False, strip_cdata=True,                    no_network=True, target=None, schema: XMLSchema =None,                    recover=True, compact=True, collect_ids=True, huge_tree=False)\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            - save memory for short text content (default: True)\n    - default_doctype    - add a default doctype even if it is not found in the HTML (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (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 (note: libiconv encoding name)\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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_HTMLParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10HTMLParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_HTMLParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_HTMLParser_spec = {
  "lxml.etree.HTMLParser",
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_HTMLParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_HTMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False, strip_cdata=True,                    no_network=True, target=None, schema: XMLSchema =None,                    recover=True, compact=True, collect_ids=True, huge_tree=False)\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            - save memory for short text content (default: True)\n    - default_doctype    - add a default doctype even if it is not found in the HTML (default: True)\n    - collect_ids        - use a hash table of XML IDs for fast access (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 (note: libiconv encoding name)\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {"read_events", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_HTMLPullParser_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseParser},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseParser},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_HTMLPullParser},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_HTMLPullParser},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_HTMLPullParser_spec = {
  "lxml.etree.HTMLPullParser",
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLPullParser),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_HTMLPullParser_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_HTMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__SaxParserTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__SaxParserTarget},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__SaxParserTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__SaxParserTarget_spec = {
  "lxml.etree._SaxParserTarget",
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree__SaxParserTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__SaxParserContext) {
      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 PyMethodDef __pyx_methods_4lxml_5etree__SaxParserContext[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__SaxParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__SaxParserContext},
  {Py_tp_doc, (void *)PyDoc_STR("This class maps SAX2 events to parser target events.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__SaxParserContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__SaxParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__SaxParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__SaxParserContext_spec = {
  "lxml.etree._SaxParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__SaxParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("This class maps SAX2 events to parser target events.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__SaxParserContext, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParseEventsIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParseEventsIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator},
  {Py_tp_doc, (void *)PyDoc_STR("A reusable parse events iterator")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParseEventsIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParseEventsIterator},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParseEventsIterator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParseEventsIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParseEventsIterator_spec = {
  "lxml.etree._ParseEventsIterator",
  sizeof(struct __pyx_obj_4lxml_5etree__ParseEventsIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParseEventsIterator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParseEventsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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->_comment_factory = Py_None; Py_INCREF(Py_None);
  p->_pi_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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_TreeBuilder) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_factory);
  Py_CLEAR(p->_comment_factory);
  Py_CLEAR(p->_pi_factory);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_element_stack);
  Py_CLEAR(p->_element_stack_pop);
  Py_CLEAR(p->_last);
  __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->_comment_factory) {
    e = (*v)(p->_comment_factory, a); if (e) return e;
  }
  if (p->_pi_factory) {
    e = (*v)(p->_pi_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->_comment_factory);
  Py_CLEAR(p->_pi_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[] = {
  {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_2close},
  {"data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_5data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_4data},
  {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_7start, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_6start},
  {"end", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_9end, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_8end},
  {"pi", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_11pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_10pi},
  {"comment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_11TreeBuilder_13comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_11TreeBuilder_12comment},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_TreeBuilder_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_TreeBuilder},
  {Py_tp_doc, (void *)PyDoc_STR("TreeBuilder(self, element_factory=None, parser=None,\n                    comment_factory=None, pi_factory=None,\n                    insert_comments=True, insert_pis=True)\n\n    Parser target that builds a tree from parse event callbacks.\n\n    The factory arguments can be used to influence the creation of\n    elements, comments and processing instructions.\n\n    By default, comments and processing instructions are inserted into\n    the tree, but they can be ignored by passing the respective flags.\n\n    The final tree is returned by the ``close()`` method.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_TreeBuilder},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_TreeBuilder},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_TreeBuilder},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_11TreeBuilder_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_TreeBuilder},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_TreeBuilder_spec = {
  "lxml.etree.TreeBuilder",
  sizeof(struct __pyx_obj_4lxml_5etree_TreeBuilder),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_TreeBuilder_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_TreeBuilder = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("TreeBuilder(self, element_factory=None, parser=None,\n                    comment_factory=None, pi_factory=None,\n                    insert_comments=True, insert_pis=True)\n\n    Parser target that builds a tree from parse event callbacks.\n\n    The factory arguments can be used to influence the creation of\n    elements, comments and processing instructions.\n\n    By default, comments and processing instructions are inserted into\n    the tree, but they can be ignored by passing the respective flags.\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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_start_ns = Py_None; Py_INCREF(Py_None);
  p->_target_end_ns = 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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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_start_ns);
  Py_CLEAR(p->_target_end_ns);
  Py_CLEAR(p->_target_doctype);
  Py_CLEAR(p->_target_pi);
  Py_CLEAR(p->_target_comment);
  __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_start_ns) {
    e = (*v)(p->_target_start_ns, a); if (e) return e;
  }
  if (p->_target_end_ns) {
    e = (*v)(p->_target_end_ns, 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_start_ns);
  Py_CLEAR(p->_target_end_ns);
  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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__PythonSaxParserTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__PythonSaxParserTarget},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__PythonSaxParserTarget_spec = {
  "lxml.etree._PythonSaxParserTarget",
  sizeof(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__PythonSaxParserTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__PythonSaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__TargetParserContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__TargetParserContext},
  {Py_tp_doc, (void *)PyDoc_STR("This class maps SAX2 events to the ET parser target interface.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__TargetParserContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__TargetParserContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__TargetParserContext_spec = {
  "lxml.etree._TargetParserContext",
  sizeof(struct __pyx_obj_4lxml_5etree__TargetParserContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__TargetParserContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__TargetParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("This class maps SAX2 events to the ET parser target interface.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TargetParserContext, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SerialisationError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("A libxml2 error that occurred during serialisation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SerialisationError_spec = {
  "lxml.etree.SerialisationError",
  sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_SerialisationError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SerialisationError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SerialisationError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("A libxml2 error that occurred during serialisation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FilelikeWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FilelikeWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FilelikeWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FilelikeWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FilelikeWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FilelikeWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FilelikeWriter_spec = {
  "lxml.etree._FilelikeWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__FilelikeWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FilelikeWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FilelikeWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree_C14NWriterTarget __pyx_vtable_4lxml_5etree_C14NWriterTarget;

static PyObject *__pyx_tp_new_4lxml_5etree_C14NWriterTarget(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_C14NWriterTarget;
  p->_write = Py_None; Py_INCREF(Py_None);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_qname_aware_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_find_qname_aware_attrs = Py_None; Py_INCREF(Py_None);
  p->_declared_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_prefix_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_preserve_space = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pending_start = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exclude_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exclude_attrs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_write);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_qname_aware_tags);
  Py_CLEAR(p->_find_qname_aware_attrs);
  Py_CLEAR(p->_declared_ns_stack);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_prefix_map);
  Py_CLEAR(p->_preserve_space);
  Py_CLEAR(p->_pending_start);
  Py_CLEAR(p->_exclude_tags);
  Py_CLEAR(p->_exclude_attrs);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree_C14NWriterTarget(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  if (p->_write) {
    e = (*v)(p->_write, a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  if (p->_qname_aware_tags) {
    e = (*v)(p->_qname_aware_tags, a); if (e) return e;
  }
  if (p->_find_qname_aware_attrs) {
    e = (*v)(p->_find_qname_aware_attrs, a); if (e) return e;
  }
  if (p->_declared_ns_stack) {
    e = (*v)(p->_declared_ns_stack, a); if (e) return e;
  }
  if (p->_ns_stack) {
    e = (*v)(p->_ns_stack, a); if (e) return e;
  }
  if (p->_prefix_map) {
    e = (*v)(p->_prefix_map, a); if (e) return e;
  }
  if (p->_preserve_space) {
    e = (*v)(p->_preserve_space, a); if (e) return e;
  }
  if (p->_pending_start) {
    e = (*v)(p->_pending_start, a); if (e) return e;
  }
  if (p->_exclude_tags) {
    e = (*v)(p->_exclude_tags, a); if (e) return e;
  }
  if (p->_exclude_attrs) {
    e = (*v)(p->_exclude_attrs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_C14NWriterTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_C14NWriterTarget *p = (struct __pyx_obj_4lxml_5etree_C14NWriterTarget *)o;
  Py_CLEAR(p->_write);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_qname_aware_tags);
  Py_CLEAR(p->_find_qname_aware_attrs);
  Py_CLEAR(p->_declared_ns_stack);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_prefix_map);
  Py_CLEAR(p->_preserve_space);
  Py_CLEAR(p->_pending_start);
  Py_CLEAR(p->_exclude_tags);
  Py_CLEAR(p->_exclude_attrs);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_C14NWriterTarget[] = {
  {"_iter_namespaces", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"start_ns", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"start", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"end", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"comment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"pi", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_C14NWriterTarget_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Canonicalization writer target for the XMLParser.\n\n    Serialises parse events to XML C14N 2.0.\n\n    Configuration options:\n\n    - *with_comments*: set to true to include comments\n    - *strip_text*: set to true to strip whitespace before and after text content\n    - *rewrite_prefixes*: set to true to replace namespace prefixes by \"n{number}\"\n    - *qname_aware_tags*: a set of qname aware tag names in which prefixes\n                          should be replaced in text content\n    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes\n                           should be replaced in text content\n    - *exclude_attrs*: a set of attribute names that should not be serialised\n    - *exclude_tags*: a set of tag names that should not be serialised\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_C14NWriterTarget},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_C14NWriterTarget},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_C14NWriterTarget},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_C14NWriterTarget},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_C14NWriterTarget_spec = {
  "lxml.etree.C14NWriterTarget",
  sizeof(struct __pyx_obj_4lxml_5etree_C14NWriterTarget),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_C14NWriterTarget_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_C14NWriterTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""C14NWriterTarget", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_C14NWriterTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_C14NWriterTarget, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("\n    Canonicalization writer target for the XMLParser.\n\n    Serialises parse events to XML C14N 2.0.\n\n    Configuration options:\n\n    - *with_comments*: set to true to include comments\n    - *strip_text*: set to true to strip whitespace before and after text content\n    - *rewrite_prefixes*: set to true to replace namespace prefixes by \"n{number}\"\n    - *qname_aware_tags*: a set of qname aware tag names in which prefixes\n                          should be replaced in text content\n    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes\n                           should be replaced in text content\n    - *exclude_attrs*: a set of attribute names that should not be serialised\n    - *exclude_tags*: a set of tag names that should not be serialised\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_C14NWriterTarget, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_C14NWriterTarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_C14NWriterTarget, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_16C14NWriterTarget_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_C14NWriterTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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);
  p->async_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_xmlfile) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->output_file);
  Py_CLEAR(p->encoding);
  Py_CLEAR(p->writer);
  Py_CLEAR(p->async_writer);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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;
  }
  if (p->async_writer) {
    e = (*v)(((PyObject *)p->async_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);
  Py_CLEAR(p->async_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_xmlfile[] = {
  {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_xmlfile_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_xmlfile},
  {Py_tp_doc, (void *)PyDoc_STR("xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\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\n                  # or write multiple Elements or strings at once\n                  xf.write(etree.Element('start'), \"text\", etree.Element('end'))\n\n    If 'output_file' is a file(-like) object, passing ``close=True`` will\n    close it when exiting the context manager.  By default, it is left\n    to the owner to do that.  When a file path is used, lxml will take care\n    of opening and closing the file itself.  Also, when a compression level\n    is set, lxml will deliberately close the file to make sure all data gets\n    compressed and written.\n\n    Setting ``buffered=False`` will flush the output after each operation,\n    such as opening or closing an ``xf.element()`` block or calling\n    ``xf.write()``.  Alternatively, calling ``xf.flush()`` can be used to\n    explicitly flush any pending output when buffering is enabled.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_xmlfile},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_xmlfile},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_xmlfile},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7xmlfile_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_xmlfile},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_xmlfile_spec = {
  "lxml.etree.xmlfile",
  sizeof(struct __pyx_obj_4lxml_5etree_xmlfile),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_xmlfile_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_xmlfile = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("xmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\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\n                  # or write multiple Elements or strings at once\n                  xf.write(etree.Element('start'), \"text\", etree.Element('end'))\n\n    If 'output_file' is a file(-like) object, passing ``close=True`` will\n    close it when exiting the context manager.  By default, it is left\n    to the owner to do that.  When a file path is used, lxml will take care\n    of opening and closing the file itself.  Also, when a compression level\n    is set, lxml will deliberately close the file to make sure all data gets\n    compressed and written.\n\n    Setting ``buffered=False`` will flush the output after each operation,\n    such as opening or closing an ``xf.element()`` block or calling\n    ``xf.write()``.  Alternatively, calling ``xf.flush()`` can be used to\n    explicitly flush any pending output when buffering is enabled.\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods_4lxml_5etree_htmlfile[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_htmlfile_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental HTML serialisation.  Works the same as\n    xmlfile.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_xmlfile},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_xmlfile},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_htmlfile},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8htmlfile_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_xmlfile},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_htmlfile_spec = {
  "lxml.etree.htmlfile",
  sizeof(struct __pyx_obj_4lxml_5etree_htmlfile),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_htmlfile_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_htmlfile = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""htmlfile", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_htmlfile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_xmlfile, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("htmlfile(self, output_file, encoding=None, compression=None, close=False, buffered=True)\n\n    A simple mechanism for incremental HTML serialisation.  Works the same as\n    xmlfile.\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_htmlfile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4lxml_5etree_8htmlfile_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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_element_stack);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"write_declaration", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration},
  {"write_doctype", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype},
  {"method", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8method},
  {"element", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10element},
  {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_12write},
  {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_14flush},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__IncrementalFileWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__IncrementalFileWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__IncrementalFileWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__IncrementalFileWriter_spec = {
  "lxml.etree._IncrementalFileWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__IncrementalFileWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__IncrementalFileWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__AsyncDataWriter __pyx_vtable_4lxml_5etree__AsyncDataWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncDataWriter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__AsyncDataWriter;
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_16_AsyncDataWriter_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_data);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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

static int __pyx_tp_clear_4lxml_5etree__AsyncDataWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncDataWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)o;
  Py_CLEAR(p->_data);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncDataWriter[] = {
  {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncDataWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncDataWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncDataWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncDataWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncDataWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncDataWriter_spec = {
  "lxml.etree._AsyncDataWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncDataWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncDataWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncDataWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncDataWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncDataWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncDataWriter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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__AsyncDataWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncDataWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncDataWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncDataWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4lxml_5etree__AsyncIncrementalFileWriter __pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter;
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  p->_buffer = ((struct __pyx_obj_4lxml_5etree__AsyncDataWriter *)Py_None); Py_INCREF(Py_None);
  p->_async_outfile = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_buffer);
  Py_CLEAR(p->_async_outfile);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  if (p->_buffer) {
    e = (*v)(((PyObject *)p->_buffer), a); if (e) return e;
  }
  if (p->_async_outfile) {
    e = (*v)(p->_async_outfile, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)o;
  Py_CLEAR(p->_writer);
  Py_CLEAR(p->_buffer);
  Py_CLEAR(p->_async_outfile);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter[] = {
  {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write_declaration", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write_doctype", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, METH_VARARGS|METH_KEYWORDS, 0},
  {"method", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"element", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec = {
  "lxml.etree._AsyncIncrementalFileWriter",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncIncrementalFileWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncIncrementalFileWriter", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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__AsyncIncrementalFileWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncIncrementalFileWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o);
  p->_element_writer = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)Py_None); Py_INCREF(Py_None);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element_writer);
  Py_CLEAR(p->_writer);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_4lxml_5etree__AsyncFileWriterElement(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  if (p->_element_writer) {
    e = (*v)(((PyObject *)p->_element_writer), 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__AsyncFileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *p = (struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement *)o;
  Py_CLEAR(p->_element_writer);
  Py_CLEAR(p->_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AsyncFileWriterElement[] = {
  {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__AsyncFileWriterElement_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__AsyncFileWriterElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__AsyncFileWriterElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__AsyncFileWriterElement_spec = {
  "lxml.etree._AsyncFileWriterElement",
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__AsyncFileWriterElement_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__AsyncFileWriterElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_AsyncFileWriterElement", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AsyncFileWriterElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AsyncFileWriterElement, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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__AsyncFileWriterElement, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AsyncFileWriterElement, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AsyncFileWriterElement, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AsyncFileWriterElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_freelist_4lxml_5etree__FileWriterElement[8];
static int __pyx_freecount_4lxml_5etree__FileWriterElement = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__FileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__FileWriterElement > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)o);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  p->_element = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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->_writer);
  Py_CLEAR(p->_element);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__FileWriterElement < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  if (p->_element) {
    e = (*v)(p->_element, 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->_writer);
  Py_CLEAR(p->_element);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileWriterElement[] = {
  {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__FileWriterElement_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__FileWriterElement},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__FileWriterElement},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__FileWriterElement},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__FileWriterElement},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__FileWriterElement},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__FileWriterElement_spec = {
  "lxml.etree._FileWriterElement",
  sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__FileWriterElement_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__FileWriterElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__MethodChanger *__pyx_freelist_4lxml_5etree__MethodChanger[8];
static int __pyx_freecount_4lxml_5etree__MethodChanger = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__MethodChanger(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__MethodChanger > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__MethodChanger[--__pyx_freecount_4lxml_5etree__MethodChanger];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  p = ((struct __pyx_obj_4lxml_5etree__MethodChanger *)o);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_MethodChanger_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree__MethodChanger(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p = (struct __pyx_obj_4lxml_5etree__MethodChanger *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_writer);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__MethodChanger < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger)))) {
    __pyx_freelist_4lxml_5etree__MethodChanger[__pyx_freecount_4lxml_5etree__MethodChanger++] = ((struct __pyx_obj_4lxml_5etree__MethodChanger *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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

static int __pyx_tp_clear_4lxml_5etree__MethodChanger(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MethodChanger *p = (struct __pyx_obj_4lxml_5etree__MethodChanger *)o;
  Py_CLEAR(p->_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__MethodChanger[] = {
  {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aenter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__aexit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_5etree_14_MethodChanger_10__aexit__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MethodChanger_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MethodChanger},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__MethodChanger},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__MethodChanger},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MethodChanger},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MethodChanger},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MethodChanger_spec = {
  "lxml.etree._MethodChanger",
  sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__MethodChanger_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MethodChanger = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""_MethodChanger", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MethodChanger), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MethodChanger, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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__MethodChanger, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__MethodChanger, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MethodChanger, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__MethodChanger, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_iterparse) {
      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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_9iterparse_9__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterparse[] = {
  {"set_element_class_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup},
  {"makeelement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9iterparse_5makeelement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9iterparse_4makeelement},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_9iterparse_9__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_iterparse[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_9iterparse_error_log, 0, (char *)PyDoc_STR("The error log of the last (or current) parser run.\n        "), 0},
  {(char *)"resolvers", __pyx_getprop_4lxml_5etree_9iterparse_resolvers, 0, (char *)PyDoc_STR("The custom resolver registry of the last (or current) parser run.\n        "), 0},
  {(char *)"version", __pyx_getprop_4lxml_5etree_9iterparse_version, 0, (char *)PyDoc_STR("The version of the underlying XML parser."), 0},
  {(char *)"root", __pyx_getprop_4lxml_5etree_9iterparse_root, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_iterparse_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_iterparse},
  {Py_tp_doc, (void *)PyDoc_STR("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.  The ``tag`` argument can also be\n    a sequence of tags to allow matching more than one tag.  By default,\n    events are generated for all elements.  Note that the 'start-ns' and\n    'end-ns' events are not 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: repla""ce 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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_iterparse},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_iterparse},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_9iterparse_7__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_9iterparse_9__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_iterparse},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_iterparse},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9iterparse_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_iterparse},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_iterparse_spec = {
  "lxml.etree.iterparse",
  sizeof(struct __pyx_obj_4lxml_5etree_iterparse),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_iterparse_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_iterparse = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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.  The ``tag`` argument can also be\n    a sequence of tags to allow matching more than one tag.  By default,\n    events are generated for all elements.  Note that the 'start-ns' and\n    'end-ns' events are not 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: repla""ce 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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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);
  p->_include_siblings = 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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_iterwalk) {
      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_CLEAR(p->_include_siblings);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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;
  }
  if (p->_include_siblings) {
    e = (*v)(p->_include_siblings, 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);
  Py_CLEAR(p->_include_siblings);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_4lxml_5etree_8iterwalk_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterwalk[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_8iterwalk_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {"skip_subtree", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_8iterwalk_6skip_subtree},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_iterwalk_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_iterwalk},
  {Py_tp_doc, (void *)PyDoc_STR("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\n    Just as for ``iterparse()``, the ``tag`` argument can be a single tag or a\n    sequence of tags.\n\n    After receiving a 'start' or 'start-ns' event, the children and\n    descendants of the current element can be excluded from iteration\n    by calling the ``skip_subtree()`` method.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_iterwalk},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_iterwalk},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_8iterwalk_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_4lxml_5etree_8iterwalk_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_iterwalk},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8iterwalk_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_iterwalk},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_iterwalk_spec = {
  "lxml.etree.iterwalk",
  sizeof(struct __pyx_obj_4lxml_5etree_iterwalk),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_iterwalk_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_iterwalk = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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\n    Just as for ``iterparse()``, the ``tag`` argument can be a single tag or a\n    sequence of tags.\n\n    After receiving a 'start' or 'start-ns' event, the children and\n    descendants of the current element can be excluded from iteration\n    by calling the ``skip_subtree()`` method.\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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__IDDict) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_keys);
  Py_CLEAR(p->_items);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_7_IDDict_13__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_7_IDDict_13__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__IDDict[] = {
  {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_3copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"has_key", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_11has_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_7_IDDict_13__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_15keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_23items, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7_IDDict_29itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__IDDict_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__IDDict},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_7_IDDict_13__repr__},
  {Py_sq_length, (void *)__pyx_pw_4lxml_5etree_7_IDDict_21__len__},
  {Py_sq_item, (void *)__pyx_sq_item_4lxml_5etree__IDDict},
  {Py_sq_contains, (void *)__pyx_pw_4lxml_5etree_7_IDDict_9__contains__},
  {Py_mp_length, (void *)__pyx_pw_4lxml_5etree_7_IDDict_21__len__},
  {Py_mp_subscript, (void *)__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__IDDict},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__IDDict},
  {Py_tp_iter, (void *)__pyx_pw_4lxml_5etree_7_IDDict_17__iter__},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__IDDict},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__IDDict},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__IDDict_spec = {
  "lxml.etree._IDDict",
  sizeof(struct __pyx_obj_4lxml_5etree__IDDict),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__IDDict_slots,
};
#else

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)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XIncludeError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error during XInclude processing.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XIncludeError_spec = {
  "lxml.etree.XIncludeError",
  sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XIncludeError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XIncludeError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XIncludeError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error during XInclude processing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XInclude) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XInclude_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XInclude},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_8XInclude_3__call__},
  {Py_tp_doc, (void *)PyDoc_STR("XInclude(self)\n    XInclude processor.\n\n    Create an instance and call it on an Element to run XInclude\n    processing.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XInclude},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XInclude},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XInclude},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XInclude},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_8XInclude_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XInclude},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XInclude_spec = {
  "lxml.etree.XInclude",
  sizeof(struct __pyx_obj_4lxml_5etree_XInclude),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XInclude_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XInclude = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XPath errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathError_spec = {
  "lxml.etree.XPathError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XPathError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class of all XPath errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathEvalError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error during XPath evaluation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathEvalError_spec = {
  "lxml.etree.XPathEvalError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XPathEvalError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathEvalError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathEvalError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error during XPath evaluation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathFunctionError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Internal error looking up an XPath extension function.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathFunctionError_spec = {
  "lxml.etree.XPathFunctionError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XPathFunctionError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathFunctionError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathFunctionError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Internal error looking up an XPath extension function.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathResultError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error handling an XPath result.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathResultError_spec = {
  "lxml.etree.XPathResultError",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XPathResultError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathResultError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XPathResultError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error handling an XPath result.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"test", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"match", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"replace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ExsltRegExp_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ExsltRegExp},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ExsltRegExp},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ExsltRegExp},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ExsltRegExp},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ExsltRegExp},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ExsltRegExp_spec = {
  "lxml.etree._ExsltRegExp",
  sizeof(struct __pyx_obj_4lxml_5etree__ExsltRegExp),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ExsltRegExp_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ExsltRegExp = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__BaseContext) {
      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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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, (char *)0, 0},
  {(char *)"eval_context", __pyx_getprop_4lxml_5etree_12_BaseContext_eval_context, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__BaseContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__BaseContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__BaseContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__BaseContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__BaseContext},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__BaseContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_12_BaseContext_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__BaseContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__BaseContext_spec = {
  "lxml.etree._BaseContext",
  sizeof(struct __pyx_obj_4lxml_5etree__BaseContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__BaseContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__BaseContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p;
  PyObject *o = __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_new, newfunc)(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;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->attrname);
  __Pyx_PyType_GetSlot((&PyUnicode_Type), tp_dealloc, destructor)(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_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 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 PyMethodDef __pyx_methods_4lxml_5etree__ElementUnicodeResult[] = {
  {"getparent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementUnicodeResult[] = {
  {(char *)"is_text", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text, 0, (char *)0, 0},
  {(char *)"is_attribute", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute, 0, (char *)0, 0},
  {(char *)"attrname", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname, 0, (char *)0, 0},
  {(char *)"is_tail", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ElementUnicodeResult_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__ElementUnicodeResult},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ElementUnicodeResult},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ElementUnicodeResult_spec = {
  "lxml.etree._ElementUnicodeResult",
  sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree__ElementUnicodeResult_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ElementUnicodeResult = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XPathContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_13_XPathContext_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathContext_spec = {
  "lxml.etree._XPathContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_error_log);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathEvaluatorBase[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XPathEvaluatorBase_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XPathEvaluatorBase_spec = {
  "lxml.etree._XPathEvaluatorBase",
  sizeof(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XPathEvaluatorBase_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XPathEvaluatorBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator) {
      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[] = {
  {"register_namespace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace},
  {"register_namespaces", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathElementEvaluator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPathElementEvaluator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathElementEvaluator_spec = {
  "lxml.etree.XPathElementEvaluator",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathElementEvaluator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathElementEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPathDocumentEvaluator_slots[] = {
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XPathElementEvaluator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPathDocumentEvaluator},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec = {
  "lxml.etree.XPathDocumentEvaluator",
  sizeof(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPathDocumentEvaluator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPathDocumentEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XPath) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_5XPath_9__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_5XPath_9__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPath[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_5XPath_9__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XPath[] = {
  {(char *)"path", __pyx_getprop_4lxml_5etree_5XPath_path, 0, (char *)PyDoc_STR("The literal XPath expression.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XPath_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XPath},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_5XPath_9__repr__},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_5XPath_5__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XPath},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XPath},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_5XPath_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XPath},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XPath_spec = {
  "lxml.etree.XPath",
  sizeof(struct __pyx_obj_4lxml_5etree_XPath),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XPath_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XPath = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_ETXPath_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_ETXPath},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7ETXPath_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_ETXPath},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_ETXPath_spec = {
  "lxml.etree.ETXPath",
  sizeof(struct __pyx_obj_4lxml_5etree_ETXPath),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_ETXPath_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_ETXPath = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XSLT errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTError_spec = {
  "lxml.etree.XSLTError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XSLTError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class of all XSLT errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTParseError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error parsing a stylesheet document.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTParseError_spec = {
  "lxml.etree.XSLTParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XSLTParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error parsing a stylesheet document.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTApplyError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error running an XSL transformation.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTApplyError_spec = {
  "lxml.etree.XSLTApplyError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XSLTApplyError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTApplyError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTApplyError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error running an XSL transformation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTExtensionError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error registering an XSLT extension.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTExtensionError_spec = {
  "lxml.etree.XSLTExtensionError",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XSLTExtensionError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtensionError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XSLTExtensionError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error registering an XSLT extension.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTResolverContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTResolverContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTResolverContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTResolverContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTResolverContext_spec = {
  "lxml.etree._XSLTResolverContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResolverContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTResolverContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTAccessControl[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLTAccessControl[] = {
  {(char *)"options", __pyx_getprop_4lxml_5etree_17XSLTAccessControl_options, 0, (char *)PyDoc_STR("The access control configuration as a map of options."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTAccessControl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLTAccessControl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XSLTAccessControl},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLTAccessControl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTAccessControl_spec = {
  "lxml.etree.XSLTAccessControl",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTAccessControl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_XSLTAccessControl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTAccessControl = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTContext},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_12_XSLTContext_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTContext_spec = {
  "lxml.etree._XSLTContext",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[8];
static int __pyx_freecount_4lxml_5etree__XSLTQuotedStringParam = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTQuotedStringParam[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTQuotedStringParam_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam},
  {Py_tp_doc, (void *)PyDoc_STR("A wrapper class for literal XSLT string parameters that require\n    quote escaping.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTQuotedStringParam},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec = {
  "lxml.etree._XSLTQuotedStringParam",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__XSLTQuotedStringParam_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTQuotedStringParam = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLT) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"strparam", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_7strparam, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_6strparam},
  {"set_global_max_depth", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth},
  {"tostring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_11tostring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_4XSLT_10tostring},
  {"__deepcopy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__copy__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_4XSLT_15__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLT[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_4XSLT_error_log, 0, (char *)PyDoc_STR("The log of errors and warnings of an XSLT execution."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLT_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLT},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_4XSLT_17__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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 and make the profile available\n      as XML document in ``result.xslt_profile`` (default: False)\n\n    Other keyword arguments of the call are passed to the stylesheet\n    as parameters.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XSLT},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLT},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_XSLT},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_4XSLT_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLT},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLT_spec = {
  "lxml.etree.XSLT",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLT),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XSLT_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLT = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_4XSLT_17__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*/
  PyDoc_STR("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 and make the profile available\n      as XML document in ``result.xslt_profile`` (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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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);
  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[] = {
  {"write_output", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_15_XSLTResultTree_write_output},
  {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, (char *)PyDoc_STR("Return an ElementTree with profiling data for the stylesheet run.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

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
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type_4lxml_5etree__XSLTResultTree_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__XSLTResultTree},
  {Py_tp_str, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__},
  #endif
  #if defined(Py_bf_releasebuffer)
  {Py_bf_releasebuffer, (void *)__pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__},
  #endif
  {Py_tp_doc, (void *)PyDoc_STR("The result of an XSLT evaluation.\n\n    Use ``str()`` or ``bytes()`` (or ``unicode()`` in Python 2.x) to serialise to a string,\n    and the ``.write_output()`` method to write serialise to a file.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__XSLTResultTree},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__XSLTResultTree},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTResultTree},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__XSLTResultTree},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTResultTree},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTResultTree_spec = {
  "lxml.etree._XSLTResultTree",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResultTree),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTResultTree_slots,
};
#else

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
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__releasebuffer__, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResultTree = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("The result of an XSLT evaluation.\n\n    Use ``str()`` or ``bytes()`` (or ``unicode()`` in Python 2.x) to serialise to a string,\n    and the ``.write_output()`` method to write serialise to a file.\n    "), /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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[] = {
  {"parseXSL", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL},
  {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__XSLTProcessingInstruction_slots[] = {
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Element},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__XSLTProcessingInstruction},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec = {
  "lxml.etree._XSLTProcessingInstruction",
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__XSLTProcessingInstruction_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__XSLTProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XSLTExtension) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTExtension[] = {
  {"execute", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_1execute, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_execute},
  {"apply_templates", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates},
  {"process_children", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_13XSLTExtension_4process_children},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XSLTExtension_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XSLTExtension},
  {Py_tp_doc, (void *)PyDoc_STR("Base class of an XSLT extension element.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XSLTExtension},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XSLTExtension},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XSLTExtension_spec = {
  "lxml.etree.XSLTExtension",
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtension),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_4lxml_5etree_XSLTExtension_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtension = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DocumentInvalid_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DocumentInvalid_spec = {
  "lxml.etree.DocumentInvalid",
  sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_DocumentInvalid_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DocumentInvalid = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DocumentInvalid", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree__Validator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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[] = {
  {"validate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_3validate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_2validate},
  {"assertValid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_5assertValid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_4assertValid},
  {"assert_", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_10_Validator_7assert_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_10_Validator_6assert_},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Validator[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_10_Validator_error_log, 0, (char *)PyDoc_STR("The log of validation errors and warnings."), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__Validator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__Validator},
  {Py_tp_doc, (void *)PyDoc_STR("Base class for XML validators.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__Validator},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__Validator},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__Validator},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__Validator_spec = {
  "lxml.etree._Validator",
  sizeof(struct __pyx_obj_4lxml_5etree__Validator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__Validator_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__Validator = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class for DTD errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDError_spec = {
  "lxml.etree.DTDError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_DTDError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class for DTD errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDParseError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing a DTD.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDParseError_spec = {
  "lxml.etree.DTDParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_DTDParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while parsing a DTD.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTDValidateError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a DTD.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTDValidateError_spec = {
  "lxml.etree.DTDValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_DTDValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTDValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""DTDValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a DTD.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_freelist_4lxml_5etree__DTDElementContentDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDElementContentDecl = 0;
#endif

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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__DTDElementContentDecl < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementContentDecl[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementContentDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_name, 0, (char *)0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_type, 0, (char *)0, 0},
  {(char *)"occur", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_occur, 0, (char *)0, 0},
  {(char *)"left", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_left, 0, (char *)0, 0},
  {(char *)"right", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_right, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDElementContentDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDElementContentDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDElementContentDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDElementContentDecl_spec = {
  "lxml.etree._DTDElementContentDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDElementContentDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementContentDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_freelist_4lxml_5etree__DTDAttributeDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDAttributeDecl = 0;
#endif

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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__DTDAttributeDecl < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDAttributeDecl[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDAttributeDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_name, 0, (char *)0, 0},
  {(char *)"elemname", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_elemname, 0, (char *)0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_prefix, 0, (char *)0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_type, 0, (char *)0, 0},
  {(char *)"default", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default, 0, (char *)0, 0},
  {(char *)"default_value", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default_value, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDAttributeDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDAttributeDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDAttributeDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDAttributeDecl_spec = {
  "lxml.etree._DTDAttributeDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDAttributeDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDAttributeDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_freelist_4lxml_5etree__DTDElementDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDElementDecl = 0;
#endif

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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__DTDElementDecl < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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 PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementDecl[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {"iterattributes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"attributes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_name, 0, (char *)0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_prefix, 0, (char *)0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_type, 0, (char *)0, 0},
  {(char *)"content", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_content, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDElementDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDElementDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDElementDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDElementDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDElementDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDElementDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDElementDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDElementDecl_spec = {
  "lxml.etree._DTDElementDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDElementDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_freelist_4lxml_5etree__DTDEntityDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDEntityDecl = 0;
#endif

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 CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) & (int)(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
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  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 CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree__DTDEntityDecl < 8) & (int)(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
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

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 PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_10system_url_1__get__(o);
}

static PyObject *__pyx_specialmethod___pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(self);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDEntityDecl[] = {
  {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDEntityDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_name, 0, (char *)0, 0},
  {(char *)"orig", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_orig, 0, (char *)0, 0},
  {(char *)"content", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_content, 0, (char *)0, 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_system_url, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__DTDEntityDecl_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl},
  {Py_tp_repr, (void *)__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__DTDEntityDecl},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__DTDEntityDecl},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__DTDEntityDecl},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree__DTDEntityDecl},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__DTDEntityDecl},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__DTDEntityDecl_spec = {
  "lxml.etree._DTDEntityDecl",
  sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__DTDEntityDecl_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__DTDEntityDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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 CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_DTD) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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[] = {
  {"iterelements", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_3iterelements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"elements", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_6elements, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"iterentities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_8iterentities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"entities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_3DTD_11entities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DTD[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_3DTD_name, 0, (char *)0, 0},
  {(char *)"external_id", __pyx_getprop_4lxml_5etree_3DTD_external_id, 0, (char *)0, 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_3DTD_system_url, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_DTD_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_DTD},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_3DTD_15__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_DTD},
  {Py_tp_getset, (void *)__pyx_getsets_4lxml_5etree_DTD},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_3DTD_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_DTD},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_DTD_spec = {
  "lxml.etree.DTD",
  sizeof(struct __pyx_obj_4lxml_5etree_DTD),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_DTD_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_DTD = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class for RelaxNG errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGError_spec = {
  "lxml.etree.RelaxNGError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_RelaxNGError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class for RelaxNG errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGParseError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as RelaxNG.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGParseError_spec = {
  "lxml.etree.RelaxNGParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_RelaxNGParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as RelaxNG.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNGValidateError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a RelaxNG schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNGValidateError_spec = {
  "lxml.etree.RelaxNGValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_RelaxNGValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNGValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""RelaxNGValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a RelaxNG schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_RelaxNG(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_RelaxNG) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_RelaxNG[] = {
  {"from_rnc_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_7RelaxNG_8from_rnc_string},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_RelaxNG_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_RelaxNG},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_7RelaxNG_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_RelaxNG},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_7RelaxNG_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_RelaxNG},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_RelaxNG_spec = {
  "lxml.etree.RelaxNG",
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNG),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_RelaxNG_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNG = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all XML Schema errors\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaError_spec = {
  "lxml.etree.XMLSchemaError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XMLSchemaError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class of all XML Schema errors\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaParseError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as XML Schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaParseError_spec = {
  "lxml.etree.XMLSchemaParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XMLSchemaParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as XML Schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchemaValidateError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with an XML Schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchemaValidateError_spec = {
  "lxml.etree.XMLSchemaValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_XMLSchemaValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchemaValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""XMLSchemaValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with an XML Schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_9XMLSchema_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_XMLSchema(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_XMLSchema) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_doc);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XMLSchema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  e = __pyx_tp_traverse_4lxml_5etree__Validator(o, v, 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_XMLSchema(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p = (struct __pyx_obj_4lxml_5etree_XMLSchema *)o;
  __pyx_tp_clear_4lxml_5etree__Validator(o);
  Py_CLEAR(p->_doc);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLSchema[] = {
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_XMLSchema_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_XMLSchema},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_9XMLSchema_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_XMLSchema},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_XMLSchema},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_XMLSchema},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_9XMLSchema_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_XMLSchema},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_XMLSchema_spec = {
  "lxml.etree.XMLSchema",
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchema),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_XMLSchema_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchema = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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_XMLSchema, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XMLSchema, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

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);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_schema);
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__ParserSchemaValidationContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__ParserSchemaValidationContext},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec = {
  "lxml.etree._ParserSchemaValidationContext",
  sizeof(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree__ParserSchemaValidationContext_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__ParserSchemaValidationContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Base class of all Schematron errors.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronError_spec = {
  "lxml.etree.SchematronError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_SchematronError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Base class of all Schematron errors.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronParseError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while parsing an XML document as Schematron schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronParseError_spec = {
  "lxml.etree.SchematronParseError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_SchematronParseError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronParseError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronParseError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while parsing an XML document as Schematron schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_SchematronValidateError_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("Error while validating an XML document with a Schematron schema.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree_Error},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree_Error},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_SchematronValidateError_spec = {
  "lxml.etree.SchematronValidateError",
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree_SchematronValidateError_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_SchematronValidateError = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""SchematronValidateError", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("Error while validating an XML document with a Schematron schema.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_Error, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_Error, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_4lxml_5etree_9LxmlError_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_4lxml_5etree_Schematron(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree_Schematron) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_4lxml_5etree_10Schematron_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree_Schematron_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree_Schematron},
  {Py_tp_call, (void *)__pyx_pw_4lxml_5etree_10Schematron_7__call__},
  {Py_tp_doc, (void *)PyDoc_STR("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 permitted 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    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree__Validator},
  {Py_tp_clear, (void *)__pyx_tp_clear_4lxml_5etree__Validator},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree_Schematron},
  {Py_tp_init, (void *)__pyx_pw_4lxml_5etree_10Schematron_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree_Schematron},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree_Schematron_spec = {
  "lxml.etree.Schematron",
  sizeof(struct __pyx_obj_4lxml_5etree_Schematron),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4lxml_5etree_Schematron_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree_Schematron = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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 permitted 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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4lxml_5etree__MemDebug(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__MemDebug(PyObject *o) {
  #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_4lxml_5etree__MemDebug[] = {
  {"bytes_used", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_bytes_used},
  {"blocks_used", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used},
  {"dict_size", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_4dict_size},
  {"dump", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_7dump, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_6dump},
  {"show", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4lxml_5etree_9_MemDebug_9show, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4lxml_5etree_9_MemDebug_8show},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree__MemDebug_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree__MemDebug},
  {Py_tp_doc, (void *)PyDoc_STR("Debugging support for the memory allocation in libxml2.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_4lxml_5etree__MemDebug},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree__MemDebug},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree__MemDebug_spec = {
  "lxml.etree._MemDebug",
  sizeof(struct __pyx_obj_4lxml_5etree__MemDebug),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_4lxml_5etree__MemDebug_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree__MemDebug = {
  PyVarObject_HEAD_INIT(0, 0)
  "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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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*/
  PyDoc_STR("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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[--__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_compression);
  Py_CLEAR(p->__pyx_v_f);
  Py_CLEAR(p->__pyx_v_file);
  Py_CLEAR(p->__pyx_v_zf);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file *)o;
  if (p->__pyx_v_compression) {
    e = (*v)(p->__pyx_v_compression, a); if (e) return e;
  }
  if (p->__pyx_v_f) {
    e = (*v)(p->__pyx_v_f, a); if (e) return e;
  }
  if (p->__pyx_v_file) {
    e = (*v)(p->__pyx_v_file, a); if (e) return e;
  }
  if (p->__pyx_v_zf) {
    e = (*v)(p->__pyx_v_zf, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec = {
  "lxml.etree.__pyx_scope_struct___open_utf8_file",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct___open_utf8_file", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct___open_utf8_file), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct___open_utf8_file, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_namespaces);
  Py_CLEAR(p->__pyx_v_ns_stack);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces *)o;
  if (p->__pyx_v_namespaces) {
    e = (*v)(p->__pyx_v_namespaces, a); if (e) return e;
  }
  if (p->__pyx_v_ns_stack) {
    e = (*v)(p->__pyx_v_ns_stack, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec = {
  "lxml.etree.__pyx_scope_struct_1__iter_namespaces",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_1__iter_namespaces", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1__iter_namespaces), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_1__iter_namespaces, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_2___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_2___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2___aenter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2___aenter__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_2___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_exc_tb);
  Py_CLEAR(p->__pyx_v_exc_type);
  Py_CLEAR(p->__pyx_v_exc_val);
  Py_CLEAR(p->__pyx_v_old_writer);
  Py_CLEAR(p->__pyx_v_raise_on_error);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__ *)o;
  if (p->__pyx_v_exc_tb) {
    e = (*v)(p->__pyx_v_exc_tb, a); if (e) return e;
  }
  if (p->__pyx_v_exc_type) {
    e = (*v)(p->__pyx_v_exc_type, a); if (e) return e;
  }
  if (p->__pyx_v_exc_val) {
    e = (*v)(p->__pyx_v_exc_val, a); if (e) return e;
  }
  if (p->__pyx_v_old_writer) {
    e = (*v)(((PyObject *)p->__pyx_v_old_writer), a); if (e) return e;
  }
  if (p->__pyx_v_raise_on_error) {
    e = (*v)(p->__pyx_v_raise_on_error, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_3___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_3___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3___aexit__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3___aexit__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_3___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec = {
  "lxml.etree.__pyx_scope_struct_4_flush",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_4_flush = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_4_flush", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_4_flush), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_4_flush, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_4_flush, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_4_flush, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_doctype);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_standalone);
  Py_CLEAR(p->__pyx_v_version);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration *)o;
  if (p->__pyx_v_doctype) {
    e = (*v)(p->__pyx_v_doctype, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_standalone) {
    e = (*v)(p->__pyx_v_standalone, a); if (e) return e;
  }
  if (p->__pyx_v_version) {
    e = (*v)(p->__pyx_v_version, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec = {
  "lxml.etree.__pyx_scope_struct_5_write_declaration",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_5_write_declaration", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_5_write_declaration), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_5_write_declaration, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_doctype);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype *)o;
  if (p->__pyx_v_doctype) {
    e = (*v)(p->__pyx_v_doctype, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec = {
  "lxml.etree.__pyx_scope_struct_6_write_doctype",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_6_write_doctype", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_6_write_doctype), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_6_write_doctype, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_method);
  Py_CLEAR(p->__pyx_v_pretty_print);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_with_tail);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write *)o;
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_method) {
    e = (*v)(p->__pyx_v_method, a); if (e) return e;
  }
  if (p->__pyx_v_pretty_print) {
    e = (*v)(p->__pyx_v_pretty_print, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_with_tail) {
    e = (*v)(p->__pyx_v_with_tail, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec = {
  "lxml.etree.__pyx_scope_struct_7_write",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_7_write_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_7_write = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_7_write", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_7_write), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_7_write, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_7_write, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_7_write, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec = {
  "lxml.etree.__pyx_scope_struct_8__close",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_8__close_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_8__close = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_8__close", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_8__close), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_8__close, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_8__close, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_8__close, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_9___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_9___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_9___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_9___aenter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_9___aenter__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_9___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__ *)o;
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_10___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_10___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_10___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_10___aexit__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_10___aexit__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_10___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec = {
  "lxml.etree.__pyx_scope_struct_11___aenter__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_11___aenter__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_11___aenter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_11___aenter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_11___aenter__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_11___aenter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__ *)o;
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec = {
  "lxml.etree.__pyx_scope_struct_12___aexit__",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_12___aexit__", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_12___aexit__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_12___aexit__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_12___aexit__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_12___aexit__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec = {
  "lxml.etree.__pyx_scope_struct_13_itervalues",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_13_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_13_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_13_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_13_itervalues, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_13_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_iterattributes},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec = {
  "lxml.etree.__pyx_scope_struct_14_iterattributes",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_14_iterattributes", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_14_iterattributes), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_14_iterattributes, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_14_iterattributes, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_14_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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_iterelements},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec = {
  "lxml.etree.__pyx_scope_struct_15_iterelements",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_15_iterelements", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_15_iterelements), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_15_iterelements, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_15_iterelements, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_15_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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities = 0;
#endif

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities)))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_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;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {Py_tp_new, (void *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_iterentities},
  {0, 0},
};
static PyType_Spec __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec = {
  "lxml.etree.__pyx_scope_struct_16_iterentities",
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_slots,
};
#else

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities = {
  PyVarObject_HEAD_INIT(0, 0)
  "lxml.etree.""__pyx_scope_struct_16_iterentities", /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_16_iterentities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_16_iterentities, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_16_iterentities, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_16_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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif
/* #### Code section: pystring_table ### */

static int __Pyx_CreateStringTabAndInitStrings(void) {
  __Pyx_StringTabEntry __pyx_string_tab[] = {
    {&__pyx_kp_u_0_9, __pyx_k_0_9, sizeof(__pyx_k_0_9), 0, 1, 0, 0},
    {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
    {&__pyx_kp_b_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 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_u_All_strings_must_be_XML_compatib, __pyx_k_All_strings_must_be_XML_compatib, sizeof(__pyx_k_All_strings_must_be_XML_compatib), 0, 1, 0, 0},
    {&__pyx_kp_s_An_XMLSyntaxError_that_addition, __pyx_k_An_XMLSyntaxError_that_addition, sizeof(__pyx_k_An_XMLSyntaxError_that_addition), 0, 0, 1, 0},
    {&__pyx_n_s_AncestorsIterator, __pyx_k_AncestorsIterator, sizeof(__pyx_k_AncestorsIterator), 0, 0, 1, 1},
    {&__pyx_n_s_AppendOnlyElementProxy_append, __pyx_k_AppendOnlyElementProxy_append, sizeof(__pyx_k_AppendOnlyElementProxy_append), 0, 0, 1, 1},
    {&__pyx_n_s_AppendOnlyElementProxy_extend, __pyx_k_AppendOnlyElementProxy_extend, sizeof(__pyx_k_AppendOnlyElementProxy_extend), 0, 0, 1, 1},
    {&__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_u_Argument_must_be_bytes_or_unicod, __pyx_k_Argument_must_be_bytes_or_unicod, sizeof(__pyx_k_Argument_must_be_bytes_or_unicod), 0, 1, 0, 0},
    {&__pyx_kp_u_Argument_must_be_string_or_unico, __pyx_k_Argument_must_be_string_or_unico, sizeof(__pyx_k_Argument_must_be_string_or_unico), 0, 1, 0, 0},
    {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncDataWriter_close, __pyx_k_AsyncDataWriter_close, sizeof(__pyx_k_AsyncDataWriter_close), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncDataWriter_write, __pyx_k_AsyncDataWriter_write, sizeof(__pyx_k_AsyncDataWriter_write), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncFileWriterElement___aenter, __pyx_k_AsyncFileWriterElement___aenter, sizeof(__pyx_k_AsyncFileWriterElement___aenter), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncFileWriterElement___aexit, __pyx_k_AsyncFileWriterElement___aexit, sizeof(__pyx_k_AsyncFileWriterElement___aexit), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter__clo, __pyx_k_AsyncIncrementalFileWriter__clo, sizeof(__pyx_k_AsyncIncrementalFileWriter__clo), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_elem, __pyx_k_AsyncIncrementalFileWriter_elem, sizeof(__pyx_k_AsyncIncrementalFileWriter_elem), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_flus, __pyx_k_AsyncIncrementalFileWriter_flus, sizeof(__pyx_k_AsyncIncrementalFileWriter_flus), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_meth, __pyx_k_AsyncIncrementalFileWriter_meth, sizeof(__pyx_k_AsyncIncrementalFileWriter_meth), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_writ, __pyx_k_AsyncIncrementalFileWriter_writ, sizeof(__pyx_k_AsyncIncrementalFileWriter_writ), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_writ_2, __pyx_k_AsyncIncrementalFileWriter_writ_2, sizeof(__pyx_k_AsyncIncrementalFileWriter_writ_2), 0, 0, 1, 1},
    {&__pyx_n_s_AsyncIncrementalFileWriter_writ_3, __pyx_k_AsyncIncrementalFileWriter_writ_3, sizeof(__pyx_k_AsyncIncrementalFileWriter_writ_3), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib, __pyx_k_Attrib, sizeof(__pyx_k_Attrib), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib___copy, __pyx_k_Attrib___copy, sizeof(__pyx_k_Attrib___copy), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib___deepcopy, __pyx_k_Attrib___deepcopy, sizeof(__pyx_k_Attrib___deepcopy), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_clear, __pyx_k_Attrib_clear, sizeof(__pyx_k_Attrib_clear), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_get, __pyx_k_Attrib_get, sizeof(__pyx_k_Attrib_get), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_has_key, __pyx_k_Attrib_has_key, sizeof(__pyx_k_Attrib_has_key), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_items, __pyx_k_Attrib_items, sizeof(__pyx_k_Attrib_items), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_iteritems, __pyx_k_Attrib_iteritems, sizeof(__pyx_k_Attrib_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_iterkeys, __pyx_k_Attrib_iterkeys, sizeof(__pyx_k_Attrib_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_itervalues, __pyx_k_Attrib_itervalues, sizeof(__pyx_k_Attrib_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_keys, __pyx_k_Attrib_keys, sizeof(__pyx_k_Attrib_keys), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_pop, __pyx_k_Attrib_pop, sizeof(__pyx_k_Attrib_pop), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_update, __pyx_k_Attrib_update, sizeof(__pyx_k_Attrib_update), 0, 0, 1, 1},
    {&__pyx_n_s_Attrib_values, __pyx_k_Attrib_values, sizeof(__pyx_k_Attrib_values), 0, 0, 1, 1},
    {&__pyx_n_s_AttributeBasedElementClassLookup, __pyx_k_AttributeBasedElementClassLookup, sizeof(__pyx_k_AttributeBasedElementClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_AttributeBasedElementClassLookup, __pyx_k_AttributeBasedElementClassLookup, sizeof(__pyx_k_AttributeBasedElementClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
    {&__pyx_n_u_BE, __pyx_k_BE, sizeof(__pyx_k_BE), 0, 1, 0, 1},
    {&__pyx_n_s_BaseErrorLog, __pyx_k_BaseErrorLog, sizeof(__pyx_k_BaseErrorLog), 0, 0, 1, 1},
    {&__pyx_n_s_BaseErrorLog_copy, __pyx_k_BaseErrorLog_copy, sizeof(__pyx_k_BaseErrorLog_copy), 0, 0, 1, 1},
    {&__pyx_n_s_BaseErrorLog_receive, __pyx_k_BaseErrorLog_receive, sizeof(__pyx_k_BaseErrorLog_receive), 0, 0, 1, 1},
    {&__pyx_n_s_BaseException, __pyx_k_BaseException, sizeof(__pyx_k_BaseException), 0, 0, 1, 1},
    {&__pyx_n_s_BaseParser_copy, __pyx_k_BaseParser_copy, sizeof(__pyx_k_BaseParser_copy), 0, 0, 1, 1},
    {&__pyx_n_s_BaseParser_makeelement, __pyx_k_BaseParser_makeelement, sizeof(__pyx_k_BaseParser_makeelement), 0, 0, 1, 1},
    {&__pyx_n_s_BaseParser_set_element_class_lo, __pyx_k_BaseParser_set_element_class_lo, sizeof(__pyx_k_BaseParser_set_element_class_lo), 0, 0, 1, 1},
    {&__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_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_n_u_C14NError, __pyx_k_C14NError, sizeof(__pyx_k_C14NError), 0, 1, 0, 1},
    {&__pyx_n_s_C14NWriterTarget, __pyx_k_C14NWriterTarget, sizeof(__pyx_k_C14NWriterTarget), 0, 0, 1, 1},
    {&__pyx_n_u_C14NWriterTarget, __pyx_k_C14NWriterTarget, sizeof(__pyx_k_C14NWriterTarget), 0, 1, 0, 1},
    {&__pyx_n_s_C14NWriterTarget__iter_namespace, __pyx_k_C14NWriterTarget__iter_namespace, sizeof(__pyx_k_C14NWriterTarget__iter_namespace), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget__start_locals_l, __pyx_k_C14NWriterTarget__start_locals_l, sizeof(__pyx_k_C14NWriterTarget__start_locals_l), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_close, __pyx_k_C14NWriterTarget_close, sizeof(__pyx_k_C14NWriterTarget_close), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_comment, __pyx_k_C14NWriterTarget_comment, sizeof(__pyx_k_C14NWriterTarget_comment), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_data, __pyx_k_C14NWriterTarget_data, sizeof(__pyx_k_C14NWriterTarget_data), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_end, __pyx_k_C14NWriterTarget_end, sizeof(__pyx_k_C14NWriterTarget_end), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_pi, __pyx_k_C14NWriterTarget_pi, sizeof(__pyx_k_C14NWriterTarget_pi), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_start, __pyx_k_C14NWriterTarget_start, sizeof(__pyx_k_C14NWriterTarget_start), 0, 0, 1, 1},
    {&__pyx_n_s_C14NWriterTarget_start_ns, __pyx_k_C14NWriterTarget_start_ns, sizeof(__pyx_k_C14NWriterTarget_start_ns), 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_u_CDATA, __pyx_k_CDATA, sizeof(__pyx_k_CDATA), 0, 1, 0, 1},
    {&__pyx_n_s_CRITICAL, __pyx_k_CRITICAL, sizeof(__pyx_k_CRITICAL), 0, 0, 1, 1},
    {&__pyx_n_s_CSSSelector, __pyx_k_CSSSelector, sizeof(__pyx_k_CSSSelector), 0, 0, 1, 1},
    {&__pyx_kp_u_Can_only_discard_comments_in_C14, __pyx_k_Can_only_discard_comments_in_C14, sizeof(__pyx_k_Can_only_discard_comments_in_C14), 0, 1, 0, 0},
    {&__pyx_kp_u_Can_only_strip_text_in_C14N_2_0, __pyx_k_Can_only_strip_text_in_C14N_2_0, sizeof(__pyx_k_Can_only_strip_text_in_C14N_2_0), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_asynchronously_write_to_a, __pyx_k_Cannot_asynchronously_write_to_a, sizeof(__pyx_k_Cannot_asynchronously_write_to_a), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_change_the_xml_prefix_of, __pyx_k_Cannot_change_the_xml_prefix_of, sizeof(__pyx_k_Cannot_change_the_xml_prefix_of), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_enable_XML_declaration_in, __pyx_k_Cannot_enable_XML_declaration_in, sizeof(__pyx_k_Cannot_enable_XML_declaration_in), 0, 1, 0, 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, __pyx_k_Cannot_resolve_URI, sizeof(__pyx_k_Cannot_resolve_URI), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_specify_encoding_with_C14, __pyx_k_Cannot_specify_encoding_with_C14, sizeof(__pyx_k_Cannot_specify_encoding_with_C14), 0, 1, 0, 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_u_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 1, 0, 1},
    {&__pyx_n_s_CommentBase, __pyx_k_CommentBase, sizeof(__pyx_k_CommentBase), 0, 0, 1, 1},
    {&__pyx_n_u_CommentBase, __pyx_k_CommentBase, sizeof(__pyx_k_CommentBase), 0, 1, 0, 1},
    {&__pyx_n_s_Comment_2, __pyx_k_Comment_2, sizeof(__pyx_k_Comment_2), 0, 0, 1, 1},
    {&__pyx_kp_u_Comment_may_not_contain_or_end_w, __pyx_k_Comment_may_not_contain_or_end_w, sizeof(__pyx_k_Comment_may_not_contain_or_end_w), 0, 1, 0, 0},
    {&__pyx_n_s_ContentOnlyElement_append, __pyx_k_ContentOnlyElement_append, sizeof(__pyx_k_ContentOnlyElement_append), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_get, __pyx_k_ContentOnlyElement_get, sizeof(__pyx_k_ContentOnlyElement_get), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_insert, __pyx_k_ContentOnlyElement_insert, sizeof(__pyx_k_ContentOnlyElement_insert), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_items, __pyx_k_ContentOnlyElement_items, sizeof(__pyx_k_ContentOnlyElement_items), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_keys, __pyx_k_ContentOnlyElement_keys, sizeof(__pyx_k_ContentOnlyElement_keys), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_set, __pyx_k_ContentOnlyElement_set, sizeof(__pyx_k_ContentOnlyElement_set), 0, 0, 1, 1},
    {&__pyx_n_s_ContentOnlyElement_values, __pyx_k_ContentOnlyElement_values, sizeof(__pyx_k_ContentOnlyElement_values), 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_u_CustomElementClassLookup, __pyx_k_CustomElementClassLookup, sizeof(__pyx_k_CustomElementClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_CustomElementClassLookup_lookup, __pyx_k_CustomElementClassLookup_lookup, sizeof(__pyx_k_CustomElementClassLookup_lookup), 0, 0, 1, 1},
    {&__pyx_n_s_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1},
    {&__pyx_n_u_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 1, 0, 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_u_DOCTYPE, __pyx_k_DOCTYPE, sizeof(__pyx_k_DOCTYPE), 0, 1, 0, 0},
    {&__pyx_kp_u_DOCTYPE_already_written_or_canno, __pyx_k_DOCTYPE_already_written_or_canno, sizeof(__pyx_k_DOCTYPE_already_written_or_canno), 0, 1, 0, 0},
    {&__pyx_n_s_DTD, __pyx_k_DTD, sizeof(__pyx_k_DTD), 0, 0, 1, 1},
    {&__pyx_n_u_DTD, __pyx_k_DTD, sizeof(__pyx_k_DTD), 0, 1, 0, 1},
    {&__pyx_n_s_DTDAttributeDecl_itervalues, __pyx_k_DTDAttributeDecl_itervalues, sizeof(__pyx_k_DTDAttributeDecl_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_DTDAttributeDecl_values, __pyx_k_DTDAttributeDecl_values, sizeof(__pyx_k_DTDAttributeDecl_values), 0, 0, 1, 1},
    {&__pyx_n_s_DTDElementDecl_attributes, __pyx_k_DTDElementDecl_attributes, sizeof(__pyx_k_DTDElementDecl_attributes), 0, 0, 1, 1},
    {&__pyx_n_s_DTDElementDecl_iterattributes, __pyx_k_DTDElementDecl_iterattributes, sizeof(__pyx_k_DTDElementDecl_iterattributes), 0, 0, 1, 1},
    {&__pyx_n_s_DTDError, __pyx_k_DTDError, sizeof(__pyx_k_DTDError), 0, 0, 1, 1},
    {&__pyx_n_u_DTDError, __pyx_k_DTDError, sizeof(__pyx_k_DTDError), 0, 1, 0, 1},
    {&__pyx_n_s_DTDParseError, __pyx_k_DTDParseError, sizeof(__pyx_k_DTDParseError), 0, 0, 1, 1},
    {&__pyx_n_u_DTDParseError, __pyx_k_DTDParseError, sizeof(__pyx_k_DTDParseError), 0, 1, 0, 1},
    {&__pyx_n_s_DTDValidateError, __pyx_k_DTDValidateError, sizeof(__pyx_k_DTDValidateError), 0, 0, 1, 1},
    {&__pyx_n_u_DTDValidateError, __pyx_k_DTDValidateError, sizeof(__pyx_k_DTDValidateError), 0, 1, 0, 1},
    {&__pyx_n_s_DTD_elements, __pyx_k_DTD_elements, sizeof(__pyx_k_DTD_elements), 0, 0, 1, 1},
    {&__pyx_n_s_DTD_entities, __pyx_k_DTD_entities, sizeof(__pyx_k_DTD_entities), 0, 0, 1, 1},
    {&__pyx_n_s_DTD_iterelements, __pyx_k_DTD_iterelements, sizeof(__pyx_k_DTD_iterelements), 0, 0, 1, 1},
    {&__pyx_n_s_DTD_iterentities, __pyx_k_DTD_iterentities, sizeof(__pyx_k_DTD_iterentities), 0, 0, 1, 1},
    {&__pyx_kp_u_DTD_not_initialised, __pyx_k_DTD_not_initialised, sizeof(__pyx_k_DTD_not_initialised), 0, 1, 0, 0},
    {&__pyx_n_s_DeprecationWarning, __pyx_k_DeprecationWarning, sizeof(__pyx_k_DeprecationWarning), 0, 0, 1, 1},
    {&__pyx_n_s_DocInfo, __pyx_k_DocInfo, sizeof(__pyx_k_DocInfo), 0, 0, 1, 1},
    {&__pyx_n_s_DocInfo_clear, __pyx_k_DocInfo_clear, sizeof(__pyx_k_DocInfo_clear), 0, 0, 1, 1},
    {&__pyx_n_s_Document, __pyx_k_Document, sizeof(__pyx_k_Document), 0, 0, 1, 1},
    {&__pyx_n_s_DocumentInvalid, __pyx_k_DocumentInvalid, sizeof(__pyx_k_DocumentInvalid), 0, 0, 1, 1},
    {&__pyx_n_u_DocumentInvalid, __pyx_k_DocumentInvalid, sizeof(__pyx_k_DocumentInvalid), 0, 1, 0, 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_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_DomainErrorLog, __pyx_k_DomainErrorLog, sizeof(__pyx_k_DomainErrorLog), 0, 0, 1, 1},
    {&__pyx_n_s_DomainErrorLog_receive, __pyx_k_DomainErrorLog_receive, sizeof(__pyx_k_DomainErrorLog_receive), 0, 0, 1, 1},
    {&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1},
    {&__pyx_n_s_ERR_INVALID_CHAR, __pyx_k_ERR_INVALID_CHAR, sizeof(__pyx_k_ERR_INVALID_CHAR), 0, 0, 1, 1},
    {&__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_u_ETCompatXMLParser, __pyx_k_ETCompatXMLParser, sizeof(__pyx_k_ETCompatXMLParser), 0, 1, 0, 1},
    {&__pyx_n_s_ETXPath, __pyx_k_ETXPath, sizeof(__pyx_k_ETXPath), 0, 0, 1, 1},
    {&__pyx_n_u_ETXPath, __pyx_k_ETXPath, sizeof(__pyx_k_ETXPath), 0, 1, 0, 1},
    {&__pyx_kp_u_Either_xml_data_or_from_file_mus, __pyx_k_Either_xml_data_or_from_file_mus, sizeof(__pyx_k_Either_xml_data_or_from_file_mus), 0, 1, 0, 0},
    {&__pyx_kp_u_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 1, 0, 0},
    {&__pyx_n_s_ElementBase, __pyx_k_ElementBase, sizeof(__pyx_k_ElementBase), 0, 0, 1, 1},
    {&__pyx_n_u_ElementBase, __pyx_k_ElementBase, sizeof(__pyx_k_ElementBase), 0, 1, 0, 1},
    {&__pyx_n_s_ElementChildIterator, __pyx_k_ElementChildIterator, sizeof(__pyx_k_ElementChildIterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementClassLookup, __pyx_k_ElementClassLookup, sizeof(__pyx_k_ElementClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_ElementClassLookup, __pyx_k_ElementClassLookup, sizeof(__pyx_k_ElementClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_ElementDefaultClassLookup, __pyx_k_ElementDefaultClassLookup, sizeof(__pyx_k_ElementDefaultClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_ElementDefaultClassLookup, __pyx_k_ElementDefaultClassLookup, sizeof(__pyx_k_ElementDefaultClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_ElementDepthFirstIterator, __pyx_k_ElementDepthFirstIterator, sizeof(__pyx_k_ElementDepthFirstIterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementIterator, __pyx_k_ElementIterator, sizeof(__pyx_k_ElementIterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementMatchIterator, __pyx_k_ElementMatchIterator, sizeof(__pyx_k_ElementMatchIterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementNamespaceClassLookup, __pyx_k_ElementNamespaceClassLookup, sizeof(__pyx_k_ElementNamespaceClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_ElementNamespaceClassLookup, __pyx_k_ElementNamespaceClassLookup, sizeof(__pyx_k_ElementNamespaceClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_ElementNamespaceClassLookup_get, __pyx_k_ElementNamespaceClassLookup_get, sizeof(__pyx_k_ElementNamespaceClassLookup_get), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTagMatcher, __pyx_k_ElementTagMatcher, sizeof(__pyx_k_ElementTagMatcher), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTextIterator, __pyx_k_ElementTextIterator, sizeof(__pyx_k_ElementTextIterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 0, 1, 1},
    {&__pyx_n_u_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 1, 0, 1},
    {&__pyx_n_s_ElementTree_2, __pyx_k_ElementTree_2, sizeof(__pyx_k_ElementTree_2), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree___copy, __pyx_k_ElementTree___copy, sizeof(__pyx_k_ElementTree___copy), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree___deepcopy, __pyx_k_ElementTree___deepcopy, sizeof(__pyx_k_ElementTree___deepcopy), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree__setroot, __pyx_k_ElementTree__setroot, sizeof(__pyx_k_ElementTree__setroot), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_find, __pyx_k_ElementTree_find, sizeof(__pyx_k_ElementTree_find), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_findall, __pyx_k_ElementTree_findall, sizeof(__pyx_k_ElementTree_findall), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_findtext, __pyx_k_ElementTree_findtext, sizeof(__pyx_k_ElementTree_findtext), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_getelementpath, __pyx_k_ElementTree_getelementpath, sizeof(__pyx_k_ElementTree_getelementpath), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_getiterator, __pyx_k_ElementTree_getiterator, sizeof(__pyx_k_ElementTree_getiterator), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_getpath, __pyx_k_ElementTree_getpath, sizeof(__pyx_k_ElementTree_getpath), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_getroot, __pyx_k_ElementTree_getroot, sizeof(__pyx_k_ElementTree_getroot), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_iter, __pyx_k_ElementTree_iter, sizeof(__pyx_k_ElementTree_iter), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_iterfind, __pyx_k_ElementTree_iterfind, sizeof(__pyx_k_ElementTree_iterfind), 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_n_s_ElementTree_parse, __pyx_k_ElementTree_parse, sizeof(__pyx_k_ElementTree_parse), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_relaxng, __pyx_k_ElementTree_relaxng, sizeof(__pyx_k_ElementTree_relaxng), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_write, __pyx_k_ElementTree_write, sizeof(__pyx_k_ElementTree_write), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_write_c14n, __pyx_k_ElementTree_write_c14n, sizeof(__pyx_k_ElementTree_write_c14n), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_xinclude, __pyx_k_ElementTree_xinclude, sizeof(__pyx_k_ElementTree_xinclude), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_xmlschema, __pyx_k_ElementTree_xmlschema, sizeof(__pyx_k_ElementTree_xmlschema), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_xpath, __pyx_k_ElementTree_xpath, sizeof(__pyx_k_ElementTree_xpath), 0, 0, 1, 1},
    {&__pyx_n_s_ElementTree_xslt, __pyx_k_ElementTree_xslt, sizeof(__pyx_k_ElementTree_xslt), 0, 0, 1, 1},
    {&__pyx_n_s_ElementUnicodeResult, __pyx_k_ElementUnicodeResult, sizeof(__pyx_k_ElementUnicodeResult), 0, 0, 1, 1},
    {&__pyx_n_s_ElementUnicodeResult_getparent, __pyx_k_ElementUnicodeResult_getparent, sizeof(__pyx_k_ElementUnicodeResult_getparent), 0, 0, 1, 1},
    {&__pyx_n_s_Element_2, __pyx_k_Element_2, sizeof(__pyx_k_Element_2), 0, 0, 1, 1},
    {&__pyx_n_u_Element_2, __pyx_k_Element_2, sizeof(__pyx_k_Element_2), 0, 1, 0, 1},
    {&__pyx_n_s_Element_3, __pyx_k_Element_3, sizeof(__pyx_k_Element_3), 0, 0, 1, 1},
    {&__pyx_n_s_Element___copy, __pyx_k_Element___copy, sizeof(__pyx_k_Element___copy), 0, 0, 1, 1},
    {&__pyx_n_s_Element___deepcopy, __pyx_k_Element___deepcopy, sizeof(__pyx_k_Element___deepcopy), 0, 0, 1, 1},
    {&__pyx_n_s_Element___reversed, __pyx_k_Element___reversed, sizeof(__pyx_k_Element___reversed), 0, 0, 1, 1},
    {&__pyx_n_s_Element__init, __pyx_k_Element__init, sizeof(__pyx_k_Element__init), 0, 0, 1, 1},
    {&__pyx_n_s_Element_addnext, __pyx_k_Element_addnext, sizeof(__pyx_k_Element_addnext), 0, 0, 1, 1},
    {&__pyx_n_s_Element_addprevious, __pyx_k_Element_addprevious, sizeof(__pyx_k_Element_addprevious), 0, 0, 1, 1},
    {&__pyx_n_s_Element_append, __pyx_k_Element_append, sizeof(__pyx_k_Element_append), 0, 0, 1, 1},
    {&__pyx_n_s_Element_clear, __pyx_k_Element_clear, sizeof(__pyx_k_Element_clear), 0, 0, 1, 1},
    {&__pyx_n_s_Element_cssselect, __pyx_k_Element_cssselect, sizeof(__pyx_k_Element_cssselect), 0, 0, 1, 1},
    {&__pyx_n_s_Element_extend, __pyx_k_Element_extend, sizeof(__pyx_k_Element_extend), 0, 0, 1, 1},
    {&__pyx_n_s_Element_find, __pyx_k_Element_find, sizeof(__pyx_k_Element_find), 0, 0, 1, 1},
    {&__pyx_n_s_Element_findall, __pyx_k_Element_findall, sizeof(__pyx_k_Element_findall), 0, 0, 1, 1},
    {&__pyx_n_s_Element_findtext, __pyx_k_Element_findtext, sizeof(__pyx_k_Element_findtext), 0, 0, 1, 1},
    {&__pyx_n_s_Element_get, __pyx_k_Element_get, sizeof(__pyx_k_Element_get), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getchildren, __pyx_k_Element_getchildren, sizeof(__pyx_k_Element_getchildren), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getiterator, __pyx_k_Element_getiterator, sizeof(__pyx_k_Element_getiterator), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getnext, __pyx_k_Element_getnext, sizeof(__pyx_k_Element_getnext), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getparent, __pyx_k_Element_getparent, sizeof(__pyx_k_Element_getparent), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getprevious, __pyx_k_Element_getprevious, sizeof(__pyx_k_Element_getprevious), 0, 0, 1, 1},
    {&__pyx_n_s_Element_getroottree, __pyx_k_Element_getroottree, sizeof(__pyx_k_Element_getroottree), 0, 0, 1, 1},
    {&__pyx_n_s_Element_index, __pyx_k_Element_index, sizeof(__pyx_k_Element_index), 0, 0, 1, 1},
    {&__pyx_n_s_Element_insert, __pyx_k_Element_insert, sizeof(__pyx_k_Element_insert), 0, 0, 1, 1},
    {&__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_is_not_in_this_tree_2, __pyx_k_Element_is_not_in_this_tree_2, sizeof(__pyx_k_Element_is_not_in_this_tree_2), 0, 1, 0, 0},
    {&__pyx_n_s_Element_items, __pyx_k_Element_items, sizeof(__pyx_k_Element_items), 0, 0, 1, 1},
    {&__pyx_n_s_Element_iter, __pyx_k_Element_iter, sizeof(__pyx_k_Element_iter), 0, 0, 1, 1},
    {&__pyx_n_s_Element_iterancestors, __pyx_k_Element_iterancestors, sizeof(__pyx_k_Element_iterancestors), 0, 0, 1, 1},
    {&__pyx_n_s_Element_iterchildren, __pyx_k_Element_iterchildren, sizeof(__pyx_k_Element_iterchildren), 0, 0, 1, 1},
    {&__pyx_n_s_Element_iterdescendants, __pyx_k_Element_iterdescendants, sizeof(__pyx_k_Element_iterdescendants), 0, 0, 1, 1},
    {&__pyx_n_s_Element_iterfind, __pyx_k_Element_iterfind, sizeof(__pyx_k_Element_iterfind), 0, 0, 1, 1},
    {&__pyx_n_s_Element_itersiblings, __pyx_k_Element_itersiblings, sizeof(__pyx_k_Element_itersiblings), 0, 0, 1, 1},
    {&__pyx_n_s_Element_itertext, __pyx_k_Element_itertext, sizeof(__pyx_k_Element_itertext), 0, 0, 1, 1},
    {&__pyx_n_s_Element_keys, __pyx_k_Element_keys, sizeof(__pyx_k_Element_keys), 0, 0, 1, 1},
    {&__pyx_n_s_Element_makeelement, __pyx_k_Element_makeelement, sizeof(__pyx_k_Element_makeelement), 0, 0, 1, 1},
    {&__pyx_n_s_Element_remove, __pyx_k_Element_remove, sizeof(__pyx_k_Element_remove), 0, 0, 1, 1},
    {&__pyx_n_s_Element_replace, __pyx_k_Element_replace, sizeof(__pyx_k_Element_replace), 0, 0, 1, 1},
    {&__pyx_n_s_Element_set, __pyx_k_Element_set, sizeof(__pyx_k_Element_set), 0, 0, 1, 1},
    {&__pyx_n_s_Element_values, __pyx_k_Element_values, sizeof(__pyx_k_Element_values), 0, 0, 1, 1},
    {&__pyx_n_s_Element_xpath, __pyx_k_Element_xpath, sizeof(__pyx_k_Element_xpath), 0, 0, 1, 1},
    {&__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_u_Entity, __pyx_k_Entity, sizeof(__pyx_k_Entity), 0, 1, 0, 1},
    {&__pyx_n_s_EntityBase, __pyx_k_EntityBase, sizeof(__pyx_k_EntityBase), 0, 0, 1, 1},
    {&__pyx_n_u_EntityBase, __pyx_k_EntityBase, sizeof(__pyx_k_EntityBase), 0, 1, 0, 1},
    {&__pyx_n_s_Entity_2, __pyx_k_Entity_2, sizeof(__pyx_k_Entity_2), 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_u_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 1, 0, 1},
    {&__pyx_n_s_ErrorDomains, __pyx_k_ErrorDomains, sizeof(__pyx_k_ErrorDomains), 0, 0, 1, 1},
    {&__pyx_n_u_ErrorDomains, __pyx_k_ErrorDomains, sizeof(__pyx_k_ErrorDomains), 0, 1, 0, 1},
    {&__pyx_n_s_ErrorLevels, __pyx_k_ErrorLevels, sizeof(__pyx_k_ErrorLevels), 0, 0, 1, 1},
    {&__pyx_n_u_ErrorLevels, __pyx_k_ErrorLevels, sizeof(__pyx_k_ErrorLevels), 0, 1, 0, 1},
    {&__pyx_n_s_ErrorLog, __pyx_k_ErrorLog, sizeof(__pyx_k_ErrorLog), 0, 0, 1, 1},
    {&__pyx_n_s_ErrorLog___exit, __pyx_k_ErrorLog___exit, sizeof(__pyx_k_ErrorLog___exit), 0, 0, 1, 1},
    {&__pyx_n_s_ErrorLog_clear, __pyx_k_ErrorLog_clear, sizeof(__pyx_k_ErrorLog_clear), 0, 0, 1, 1},
    {&__pyx_n_s_ErrorLog_copy, __pyx_k_ErrorLog_copy, sizeof(__pyx_k_ErrorLog_copy), 0, 0, 1, 1},
    {&__pyx_n_s_ErrorLog_receive, __pyx_k_ErrorLog_receive, sizeof(__pyx_k_ErrorLog_receive), 0, 0, 1, 1},
    {&__pyx_n_s_ErrorTypes, __pyx_k_ErrorTypes, sizeof(__pyx_k_ErrorTypes), 0, 0, 1, 1},
    {&__pyx_n_u_ErrorTypes, __pyx_k_ErrorTypes, sizeof(__pyx_k_ErrorTypes), 0, 1, 0, 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, __pyx_k_Error_applying_stylesheet_line, sizeof(__pyx_k_Error_applying_stylesheet_line), 0, 1, 0, 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_u_Error_in_xpath_expression, __pyx_k_Error_in_xpath_expression, sizeof(__pyx_k_Error_in_xpath_expression), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_reading, __pyx_k_Error_reading, sizeof(__pyx_k_Error_reading), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_reading_file, __pyx_k_Error_reading_file, sizeof(__pyx_k_Error_reading_file), 0, 1, 0, 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_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_ExsltRegExp_match, __pyx_k_ExsltRegExp_match, sizeof(__pyx_k_ExsltRegExp_match), 0, 0, 1, 1},
    {&__pyx_n_s_ExsltRegExp_replace, __pyx_k_ExsltRegExp_replace, sizeof(__pyx_k_ExsltRegExp_replace), 0, 0, 1, 1},
    {&__pyx_n_s_ExsltRegExp_test, __pyx_k_ExsltRegExp_test, sizeof(__pyx_k_ExsltRegExp_test), 0, 0, 1, 1},
    {&__pyx_n_s_Extension, __pyx_k_Extension, sizeof(__pyx_k_Extension), 0, 0, 1, 1},
    {&__pyx_n_u_Extension, __pyx_k_Extension, sizeof(__pyx_k_Extension), 0, 1, 0, 1},
    {&__pyx_n_s_FATAL, __pyx_k_FATAL, sizeof(__pyx_k_FATAL), 0, 0, 1, 1},
    {&__pyx_kp_u_Failed_to_create_file, __pyx_k_Failed_to_create_file, sizeof(__pyx_k_Failed_to_create_file), 0, 1, 0, 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_n_u_FallbackElementClassLookup, __pyx_k_FallbackElementClassLookup, sizeof(__pyx_k_FallbackElementClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_FallbackElementClassLookup_set_f, __pyx_k_FallbackElementClassLookup_set_f, sizeof(__pyx_k_FallbackElementClassLookup_set_f), 0, 0, 1, 1},
    {&__pyx_n_s_FeedParser, __pyx_k_FeedParser, sizeof(__pyx_k_FeedParser), 0, 0, 1, 1},
    {&__pyx_n_s_FeedParser_close, __pyx_k_FeedParser_close, sizeof(__pyx_k_FeedParser_close), 0, 0, 1, 1},
    {&__pyx_n_s_FeedParser_feed, __pyx_k_FeedParser_feed, sizeof(__pyx_k_FeedParser_feed), 0, 0, 1, 1},
    {&__pyx_n_s_FileWriterElement___enter, __pyx_k_FileWriterElement___enter, sizeof(__pyx_k_FileWriterElement___enter), 0, 0, 1, 1},
    {&__pyx_n_s_FileWriterElement___exit, __pyx_k_FileWriterElement___exit, sizeof(__pyx_k_FileWriterElement___exit), 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, __pyx_k_File_or_filename_expected_got, sizeof(__pyx_k_File_or_filename_expected_got), 0, 1, 0, 0},
    {&__pyx_kp_b_Forbidden_variable, __pyx_k_Forbidden_variable, sizeof(__pyx_k_Forbidden_variable), 0, 0, 0, 0},
    {&__pyx_n_s_FunctionNamespace, __pyx_k_FunctionNamespace, sizeof(__pyx_k_FunctionNamespace), 0, 0, 1, 1},
    {&__pyx_n_u_FunctionNamespace, __pyx_k_FunctionNamespace, sizeof(__pyx_k_FunctionNamespace), 0, 1, 0, 1},
    {&__pyx_kp_u_FunctionNamespace_line_207, __pyx_k_FunctionNamespace_line_207, sizeof(__pyx_k_FunctionNamespace_line_207), 0, 1, 0, 0},
    {&__pyx_kp_u_FunctionNamespace_ns_uri_Retriev, __pyx_k_FunctionNamespace_ns_uri_Retriev, sizeof(__pyx_k_FunctionNamespace_ns_uri_Retriev), 0, 1, 0, 0},
    {&__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_u_HTML, __pyx_k_HTML, sizeof(__pyx_k_HTML), 0, 1, 0, 1},
    {&__pyx_n_s_HTMLParser, __pyx_k_HTMLParser, sizeof(__pyx_k_HTMLParser), 0, 0, 1, 1},
    {&__pyx_n_u_HTMLParser, __pyx_k_HTMLParser, sizeof(__pyx_k_HTMLParser), 0, 1, 0, 1},
    {&__pyx_n_s_HTMLPullParser, __pyx_k_HTMLPullParser, sizeof(__pyx_k_HTMLPullParser), 0, 0, 1, 1},
    {&__pyx_n_s_HTMLPullParser_read_events, __pyx_k_HTMLPullParser_read_events, sizeof(__pyx_k_HTMLPullParser_read_events), 0, 0, 1, 1},
    {&__pyx_n_s_ICONV_COMPILED_VERSION, __pyx_k_ICONV_COMPILED_VERSION, sizeof(__pyx_k_ICONV_COMPILED_VERSION), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict, __pyx_k_IDDict, sizeof(__pyx_k_IDDict), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_copy, __pyx_k_IDDict_copy, sizeof(__pyx_k_IDDict_copy), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_get, __pyx_k_IDDict_get, sizeof(__pyx_k_IDDict_get), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_has_key, __pyx_k_IDDict_has_key, sizeof(__pyx_k_IDDict_has_key), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_items, __pyx_k_IDDict_items, sizeof(__pyx_k_IDDict_items), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_iteritems, __pyx_k_IDDict_iteritems, sizeof(__pyx_k_IDDict_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_iterkeys, __pyx_k_IDDict_iterkeys, sizeof(__pyx_k_IDDict_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_itervalues, __pyx_k_IDDict_itervalues, sizeof(__pyx_k_IDDict_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_keys, __pyx_k_IDDict_keys, sizeof(__pyx_k_IDDict_keys), 0, 0, 1, 1},
    {&__pyx_n_s_IDDict_values, __pyx_k_IDDict_values, sizeof(__pyx_k_IDDict_values), 0, 0, 1, 1},
    {&__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_u_Illegal_Unicode_kind, __pyx_k_Illegal_Unicode_kind, sizeof(__pyx_k_Illegal_Unicode_kind), 0, 1, 0, 0},
    {&__pyx_kp_u_Illegal_document_provided_NULL, __pyx_k_Illegal_document_provided_NULL, sizeof(__pyx_k_Illegal_document_provided_NULL), 0, 1, 0, 0},
    {&__pyx_kp_u_Illegal_document_provided_expect, __pyx_k_Illegal_document_provided_expect, sizeof(__pyx_k_Illegal_document_provided_expect), 0, 1, 0, 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_kp_u_Inconsistent_enter_action_in_con, __pyx_k_Inconsistent_enter_action_in_con, sizeof(__pyx_k_Inconsistent_enter_action_in_con), 0, 1, 0, 0},
    {&__pyx_kp_u_Inconsistent_exit_action_in_cont, __pyx_k_Inconsistent_exit_action_in_cont, sizeof(__pyx_k_Inconsistent_exit_action_in_cont), 0, 1, 0, 0},
    {&__pyx_n_s_IncrementalFileWriter_element, __pyx_k_IncrementalFileWriter_element, sizeof(__pyx_k_IncrementalFileWriter_element), 0, 0, 1, 1},
    {&__pyx_n_s_IncrementalFileWriter_flush, __pyx_k_IncrementalFileWriter_flush, sizeof(__pyx_k_IncrementalFileWriter_flush), 0, 0, 1, 1},
    {&__pyx_n_s_IncrementalFileWriter_method, __pyx_k_IncrementalFileWriter_method, sizeof(__pyx_k_IncrementalFileWriter_method), 0, 0, 1, 1},
    {&__pyx_n_s_IncrementalFileWriter_write, __pyx_k_IncrementalFileWriter_write, sizeof(__pyx_k_IncrementalFileWriter_write), 0, 0, 1, 1},
    {&__pyx_n_s_IncrementalFileWriter_write_dec, __pyx_k_IncrementalFileWriter_write_dec, sizeof(__pyx_k_IncrementalFileWriter_write_dec), 0, 0, 1, 1},
    {&__pyx_n_s_IncrementalFileWriter_write_doc, __pyx_k_IncrementalFileWriter_write_doc, sizeof(__pyx_k_IncrementalFileWriter_write_doc), 0, 0, 1, 1},
    {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
    {&__pyx_kp_u_Initial_indentation_level_must_b, __pyx_k_Initial_indentation_level_must_b, sizeof(__pyx_k_Initial_indentation_level_must_b), 0, 1, 0, 0},
    {&__pyx_kp_u_Input_object_has_no_document, __pyx_k_Input_object_has_no_document, sizeof(__pyx_k_Input_object_has_no_document), 0, 1, 0, 0},
    {&__pyx_kp_u_Input_object_is_not_an_XML_eleme, __pyx_k_Input_object_is_not_an_XML_eleme, sizeof(__pyx_k_Input_object_is_not_an_XML_eleme), 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_u_Invalid_HTML_tag_name, __pyx_k_Invalid_HTML_tag_name, sizeof(__pyx_k_Invalid_HTML_tag_name), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_PI_name, __pyx_k_Invalid_PI_name, sizeof(__pyx_k_Invalid_PI_name), 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, __pyx_k_Invalid_attribute_dictionary, sizeof(__pyx_k_Invalid_attribute_dictionary), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_attribute_name, __pyx_k_Invalid_attribute_name, sizeof(__pyx_k_Invalid_attribute_name), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_character, __pyx_k_Invalid_character, sizeof(__pyx_k_Invalid_character), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_character_reference, __pyx_k_Invalid_character_reference, sizeof(__pyx_k_Invalid_character_reference), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_character_s, __pyx_k_Invalid_character_s, sizeof(__pyx_k_Invalid_character_s), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_child_type, __pyx_k_Invalid_child_type, sizeof(__pyx_k_Invalid_child_type), 0, 1, 0, 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, __pyx_k_Invalid_entity_name, sizeof(__pyx_k_Invalid_entity_name), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_entity_reference, __pyx_k_Invalid_entity_reference, sizeof(__pyx_k_Invalid_entity_reference), 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, __pyx_k_Invalid_input_object, sizeof(__pyx_k_Invalid_input_object), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_input_tag_of_type, __pyx_k_Invalid_input_tag_of_type, sizeof(__pyx_k_Invalid_input_tag_of_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_namespace_URI, __pyx_k_Invalid_namespace_URI, sizeof(__pyx_k_Invalid_namespace_URI), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_namespace_prefix, __pyx_k_Invalid_namespace_prefix, sizeof(__pyx_k_Invalid_namespace_prefix), 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_2, __pyx_k_Invalid_tag_name_2, sizeof(__pyx_k_Invalid_tag_name_2), 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_u_LE, __pyx_k_LE, sizeof(__pyx_k_LE), 0, 1, 0, 1},
    {&__pyx_n_s_LIBXML_COMPILED_VERSION, __pyx_k_LIBXML_COMPILED_VERSION, sizeof(__pyx_k_LIBXML_COMPILED_VERSION), 0, 0, 1, 1},
    {&__pyx_n_u_LIBXML_COMPILED_VERSION, __pyx_k_LIBXML_COMPILED_VERSION, sizeof(__pyx_k_LIBXML_COMPILED_VERSION), 0, 1, 0, 1},
    {&__pyx_n_s_LIBXML_VERSION, __pyx_k_LIBXML_VERSION, sizeof(__pyx_k_LIBXML_VERSION), 0, 0, 1, 1},
    {&__pyx_n_u_LIBXML_VERSION, __pyx_k_LIBXML_VERSION, sizeof(__pyx_k_LIBXML_VERSION), 0, 1, 0, 1},
    {&__pyx_n_s_LIBXSLT_COMPILED_VERSION, __pyx_k_LIBXSLT_COMPILED_VERSION, sizeof(__pyx_k_LIBXSLT_COMPILED_VERSION), 0, 0, 1, 1},
    {&__pyx_n_u_LIBXSLT_COMPILED_VERSION, __pyx_k_LIBXSLT_COMPILED_VERSION, sizeof(__pyx_k_LIBXSLT_COMPILED_VERSION), 0, 1, 0, 1},
    {&__pyx_n_s_LIBXSLT_VERSION, __pyx_k_LIBXSLT_VERSION, sizeof(__pyx_k_LIBXSLT_VERSION), 0, 0, 1, 1},
    {&__pyx_n_u_LIBXSLT_VERSION, __pyx_k_LIBXSLT_VERSION, sizeof(__pyx_k_LIBXSLT_VERSION), 0, 1, 0, 1},
    {&__pyx_n_s_LXML_VERSION, __pyx_k_LXML_VERSION, sizeof(__pyx_k_LXML_VERSION), 0, 0, 1, 1},
    {&__pyx_n_u_LXML_VERSION, __pyx_k_LXML_VERSION, sizeof(__pyx_k_LXML_VERSION), 0, 1, 0, 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_ListErrorLog, __pyx_k_ListErrorLog, sizeof(__pyx_k_ListErrorLog), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_copy, __pyx_k_ListErrorLog_copy, sizeof(__pyx_k_ListErrorLog_copy), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_domains, __pyx_k_ListErrorLog_filter_domains, sizeof(__pyx_k_ListErrorLog_filter_domains), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_from_errors, __pyx_k_ListErrorLog_filter_from_errors, sizeof(__pyx_k_ListErrorLog_filter_from_errors), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_from_fatals, __pyx_k_ListErrorLog_filter_from_fatals, sizeof(__pyx_k_ListErrorLog_filter_from_fatals), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_from_level, __pyx_k_ListErrorLog_filter_from_level, sizeof(__pyx_k_ListErrorLog_filter_from_level), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_from_warnin, __pyx_k_ListErrorLog_filter_from_warnin, sizeof(__pyx_k_ListErrorLog_filter_from_warnin), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_levels, __pyx_k_ListErrorLog_filter_levels, sizeof(__pyx_k_ListErrorLog_filter_levels), 0, 0, 1, 1},
    {&__pyx_n_s_ListErrorLog_filter_types, __pyx_k_ListErrorLog_filter_types, sizeof(__pyx_k_ListErrorLog_filter_types), 0, 0, 1, 1},
    {&__pyx_n_s_LogEntry, __pyx_k_LogEntry, sizeof(__pyx_k_LogEntry), 0, 0, 1, 1},
    {&__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_u_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 1, 0, 1},
    {&__pyx_n_s_LxmlRegistryError, __pyx_k_LxmlRegistryError, sizeof(__pyx_k_LxmlRegistryError), 0, 0, 1, 1},
    {&__pyx_n_u_LxmlRegistryError, __pyx_k_LxmlRegistryError, sizeof(__pyx_k_LxmlRegistryError), 0, 1, 0, 1},
    {&__pyx_n_s_LxmlSyntaxError, __pyx_k_LxmlSyntaxError, sizeof(__pyx_k_LxmlSyntaxError), 0, 0, 1, 1},
    {&__pyx_n_u_LxmlSyntaxError, __pyx_k_LxmlSyntaxError, sizeof(__pyx_k_LxmlSyntaxError), 0, 1, 0, 1},
    {&__pyx_n_s_MemDebug_blocks_used, __pyx_k_MemDebug_blocks_used, sizeof(__pyx_k_MemDebug_blocks_used), 0, 0, 1, 1},
    {&__pyx_n_s_MemDebug_bytes_used, __pyx_k_MemDebug_bytes_used, sizeof(__pyx_k_MemDebug_bytes_used), 0, 0, 1, 1},
    {&__pyx_n_s_MemDebug_dict_size, __pyx_k_MemDebug_dict_size, sizeof(__pyx_k_MemDebug_dict_size), 0, 0, 1, 1},
    {&__pyx_n_s_MemDebug_dump, __pyx_k_MemDebug_dump, sizeof(__pyx_k_MemDebug_dump), 0, 0, 1, 1},
    {&__pyx_n_s_MemDebug_show, __pyx_k_MemDebug_show, sizeof(__pyx_k_MemDebug_show), 0, 0, 1, 1},
    {&__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_n_s_MethodChanger___aenter, __pyx_k_MethodChanger___aenter, sizeof(__pyx_k_MethodChanger___aenter), 0, 0, 1, 1},
    {&__pyx_n_s_MethodChanger___aexit, __pyx_k_MethodChanger___aexit, sizeof(__pyx_k_MethodChanger___aexit), 0, 0, 1, 1},
    {&__pyx_n_s_MethodChanger___enter, __pyx_k_MethodChanger___enter, sizeof(__pyx_k_MethodChanger___enter), 0, 0, 1, 1},
    {&__pyx_n_s_MethodChanger___exit, __pyx_k_MethodChanger___exit, sizeof(__pyx_k_MethodChanger___exit), 0, 0, 1, 1},
    {&__pyx_kp_u_Method_changed_outside_of_contex, __pyx_k_Method_changed_outside_of_contex, sizeof(__pyx_k_Method_changed_outside_of_contex), 0, 1, 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_u_NAMESPACE, __pyx_k_NAMESPACE, sizeof(__pyx_k_NAMESPACE), 0, 1, 0, 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_kp_u_Namespace, __pyx_k_Namespace, sizeof(__pyx_k_Namespace), 0, 1, 0, 0},
    {&__pyx_n_s_NamespaceRegistryError, __pyx_k_NamespaceRegistryError, sizeof(__pyx_k_NamespaceRegistryError), 0, 0, 1, 1},
    {&__pyx_n_u_NamespaceRegistryError, __pyx_k_NamespaceRegistryError, sizeof(__pyx_k_NamespaceRegistryError), 0, 1, 0, 1},
    {&__pyx_n_s_NamespaceRegistry___deco, __pyx_k_NamespaceRegistry___deco, sizeof(__pyx_k_NamespaceRegistry___deco), 0, 0, 1, 1},
    {&__pyx_n_s_NamespaceRegistry__deco, __pyx_k_NamespaceRegistry__deco, sizeof(__pyx_k_NamespaceRegistry__deco), 0, 0, 1, 1},
    {&__pyx_n_s_NamespaceRegistry_clear, __pyx_k_NamespaceRegistry_clear, sizeof(__pyx_k_NamespaceRegistry_clear), 0, 0, 1, 1},
    {&__pyx_n_s_NamespaceRegistry_items, __pyx_k_NamespaceRegistry_items, sizeof(__pyx_k_NamespaceRegistry_items), 0, 0, 1, 1},
    {&__pyx_n_s_NamespaceRegistry_iteritems, __pyx_k_NamespaceRegistry_iteritems, sizeof(__pyx_k_NamespaceRegistry_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_NamespaceRegistry_update, __pyx_k_NamespaceRegistry_update, sizeof(__pyx_k_NamespaceRegistry_update), 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_document_to_serialise, __pyx_k_No_document_to_serialise, sizeof(__pyx_k_No_document_to_serialise), 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_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 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_OpaqueDocumentWrapper_append, __pyx_k_OpaqueDocumentWrapper_append, sizeof(__pyx_k_OpaqueDocumentWrapper_append), 0, 0, 1, 1},
    {&__pyx_n_s_OpaqueDocumentWrapper_extend, __pyx_k_OpaqueDocumentWrapper_extend, sizeof(__pyx_k_OpaqueDocumentWrapper_extend), 0, 0, 1, 1},
    {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
    {&__pyx_kp_u_Output_file_needs_an_async_write, __pyx_k_Output_file_needs_an_async_write, sizeof(__pyx_k_Output_file_needs_an_async_write), 0, 1, 0, 0},
    {&__pyx_n_u_PARSER, __pyx_k_PARSER, sizeof(__pyx_k_PARSER), 0, 1, 0, 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_n_u_PIBase, __pyx_k_PIBase, sizeof(__pyx_k_PIBase), 0, 1, 0, 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_kp_u_PI_text_must_not_contain, __pyx_k_PI_text_must_not_contain, sizeof(__pyx_k_PI_text_must_not_contain), 0, 1, 0, 0},
    {&__pyx_kp_u_PUBLIC, __pyx_k_PUBLIC, sizeof(__pyx_k_PUBLIC), 0, 1, 0, 0},
    {&__pyx_n_s_ParseError, __pyx_k_ParseError, sizeof(__pyx_k_ParseError), 0, 0, 1, 1},
    {&__pyx_n_u_ParseError, __pyx_k_ParseError, sizeof(__pyx_k_ParseError), 0, 1, 0, 1},
    {&__pyx_n_s_ParseError___init, __pyx_k_ParseError___init, sizeof(__pyx_k_ParseError___init), 0, 0, 1, 1},
    {&__pyx_n_s_ParseError_position, __pyx_k_ParseError_position, sizeof(__pyx_k_ParseError_position), 0, 0, 1, 1},
    {&__pyx_n_s_ParserBasedElementClassLookup, __pyx_k_ParserBasedElementClassLookup, sizeof(__pyx_k_ParserBasedElementClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_ParserBasedElementClassLookup, __pyx_k_ParserBasedElementClassLookup, sizeof(__pyx_k_ParserBasedElementClassLookup), 0, 1, 0, 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_n_u_ParserError, __pyx_k_ParserError, sizeof(__pyx_k_ParserError), 0, 1, 0, 1},
    {&__pyx_kp_u_ParserSchemaValidationContext_n, __pyx_k_ParserSchemaValidationContext_n, sizeof(__pyx_k_ParserSchemaValidationContext_n), 0, 1, 0, 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_u_Prefix, __pyx_k_Prefix, sizeof(__pyx_k_Prefix), 0, 1, 0, 0},
    {&__pyx_kp_u_Prefix_format_reserved_for_inter, __pyx_k_Prefix_format_reserved_for_inter, sizeof(__pyx_k_Prefix_format_reserved_for_inter), 0, 1, 0, 0},
    {&__pyx_n_s_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 0, 1, 1},
    {&__pyx_n_u_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 1, 0, 1},
    {&__pyx_n_s_ProcessingInstruction_2, __pyx_k_ProcessingInstruction_2, sizeof(__pyx_k_ProcessingInstruction_2), 0, 0, 1, 1},
    {&__pyx_n_s_ProcessingInstruction_get, __pyx_k_ProcessingInstruction_get, sizeof(__pyx_k_ProcessingInstruction_get), 0, 0, 1, 1},
    {&__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_u_PyErrorLog, __pyx_k_PyErrorLog, sizeof(__pyx_k_PyErrorLog), 0, 1, 0, 1},
    {&__pyx_n_s_PyErrorLog_copy, __pyx_k_PyErrorLog_copy, sizeof(__pyx_k_PyErrorLog_copy), 0, 0, 1, 1},
    {&__pyx_n_s_PyErrorLog_log, __pyx_k_PyErrorLog_log, sizeof(__pyx_k_PyErrorLog_log), 0, 0, 1, 1},
    {&__pyx_n_s_PyErrorLog_receive, __pyx_k_PyErrorLog_receive, sizeof(__pyx_k_PyErrorLog_receive), 0, 0, 1, 1},
    {&__pyx_n_s_PythonElementClassLookup, __pyx_k_PythonElementClassLookup, sizeof(__pyx_k_PythonElementClassLookup), 0, 0, 1, 1},
    {&__pyx_n_u_PythonElementClassLookup, __pyx_k_PythonElementClassLookup, sizeof(__pyx_k_PythonElementClassLookup), 0, 1, 0, 1},
    {&__pyx_n_s_PythonElementClassLookup_lookup, __pyx_k_PythonElementClassLookup_lookup, sizeof(__pyx_k_PythonElementClassLookup_lookup), 0, 0, 1, 1},
    {&__pyx_n_s_QName, __pyx_k_QName, sizeof(__pyx_k_QName), 0, 0, 1, 1},
    {&__pyx_n_u_QName, __pyx_k_QName, sizeof(__pyx_k_QName), 0, 1, 0, 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_n_s_ReadOnlyElementProxy_get, __pyx_k_ReadOnlyElementProxy_get, sizeof(__pyx_k_ReadOnlyElementProxy_get), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyElementProxy_items, __pyx_k_ReadOnlyElementProxy_items, sizeof(__pyx_k_ReadOnlyElementProxy_items), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyElementProxy_keys, __pyx_k_ReadOnlyElementProxy_keys, sizeof(__pyx_k_ReadOnlyElementProxy_keys), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyElementProxy_values, __pyx_k_ReadOnlyElementProxy_values, sizeof(__pyx_k_ReadOnlyElementProxy_values), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy___copy, __pyx_k_ReadOnlyProxy___copy, sizeof(__pyx_k_ReadOnlyProxy___copy), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy___deepcopy, __pyx_k_ReadOnlyProxy___deepcopy, sizeof(__pyx_k_ReadOnlyProxy___deepcopy), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy_getchildren, __pyx_k_ReadOnlyProxy_getchildren, sizeof(__pyx_k_ReadOnlyProxy_getchildren), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy_getnext, __pyx_k_ReadOnlyProxy_getnext, sizeof(__pyx_k_ReadOnlyProxy_getnext), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy_getparent, __pyx_k_ReadOnlyProxy_getparent, sizeof(__pyx_k_ReadOnlyProxy_getparent), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy_getprevious, __pyx_k_ReadOnlyProxy_getprevious, sizeof(__pyx_k_ReadOnlyProxy_getprevious), 0, 0, 1, 1},
    {&__pyx_n_s_ReadOnlyProxy_iterchildren, __pyx_k_ReadOnlyProxy_iterchildren, sizeof(__pyx_k_ReadOnlyProxy_iterchildren), 0, 0, 1, 1},
    {&__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_u_RelaxNG, __pyx_k_RelaxNG, sizeof(__pyx_k_RelaxNG), 0, 1, 0, 1},
    {&__pyx_n_s_RelaxNGError, __pyx_k_RelaxNGError, sizeof(__pyx_k_RelaxNGError), 0, 0, 1, 1},
    {&__pyx_n_u_RelaxNGError, __pyx_k_RelaxNGError, sizeof(__pyx_k_RelaxNGError), 0, 1, 0, 1},
    {&__pyx_n_s_RelaxNGErrorTypes, __pyx_k_RelaxNGErrorTypes, sizeof(__pyx_k_RelaxNGErrorTypes), 0, 0, 1, 1},
    {&__pyx_n_u_RelaxNGErrorTypes, __pyx_k_RelaxNGErrorTypes, sizeof(__pyx_k_RelaxNGErrorTypes), 0, 1, 0, 1},
    {&__pyx_n_s_RelaxNGParseError, __pyx_k_RelaxNGParseError, sizeof(__pyx_k_RelaxNGParseError), 0, 0, 1, 1},
    {&__pyx_n_u_RelaxNGParseError, __pyx_k_RelaxNGParseError, sizeof(__pyx_k_RelaxNGParseError), 0, 1, 0, 1},
    {&__pyx_n_s_RelaxNGValidateError, __pyx_k_RelaxNGValidateError, sizeof(__pyx_k_RelaxNGValidateError), 0, 0, 1, 1},
    {&__pyx_n_u_RelaxNGValidateError, __pyx_k_RelaxNGValidateError, sizeof(__pyx_k_RelaxNGValidateError), 0, 1, 0, 1},
    {&__pyx_n_s_RelaxNG_from_rnc_string, __pyx_k_RelaxNG_from_rnc_string, sizeof(__pyx_k_RelaxNG_from_rnc_string), 0, 0, 1, 1},
    {&__pyx_kp_u_RelaxNG_instance_not_initialised, __pyx_k_RelaxNG_instance_not_initialised, sizeof(__pyx_k_RelaxNG_instance_not_initialised), 0, 1, 0, 0},
    {&__pyx_n_s_Resolver, __pyx_k_Resolver, sizeof(__pyx_k_Resolver), 0, 0, 1, 1},
    {&__pyx_n_u_Resolver, __pyx_k_Resolver, sizeof(__pyx_k_Resolver), 0, 1, 0, 1},
    {&__pyx_n_s_ResolverRegistry_add, __pyx_k_ResolverRegistry_add, sizeof(__pyx_k_ResolverRegistry_add), 0, 0, 1, 1},
    {&__pyx_n_s_ResolverRegistry_copy, __pyx_k_ResolverRegistry_copy, sizeof(__pyx_k_ResolverRegistry_copy), 0, 0, 1, 1},
    {&__pyx_n_s_ResolverRegistry_remove, __pyx_k_ResolverRegistry_remove, sizeof(__pyx_k_ResolverRegistry_remove), 0, 0, 1, 1},
    {&__pyx_n_s_ResolverRegistry_resolve, __pyx_k_ResolverRegistry_resolve, sizeof(__pyx_k_ResolverRegistry_resolve), 0, 0, 1, 1},
    {&__pyx_n_s_Resolver_resolve, __pyx_k_Resolver_resolve, sizeof(__pyx_k_Resolver_resolve), 0, 0, 1, 1},
    {&__pyx_n_s_Resolver_resolve_empty, __pyx_k_Resolver_resolve_empty, sizeof(__pyx_k_Resolver_resolve_empty), 0, 0, 1, 1},
    {&__pyx_n_s_Resolver_resolve_file, __pyx_k_Resolver_resolve_file, sizeof(__pyx_k_Resolver_resolve_file), 0, 0, 1, 1},
    {&__pyx_n_s_Resolver_resolve_filename, __pyx_k_Resolver_resolve_filename, sizeof(__pyx_k_Resolver_resolve_filename), 0, 0, 1, 1},
    {&__pyx_n_s_Resolver_resolve_string, __pyx_k_Resolver_resolve_string, sizeof(__pyx_k_Resolver_resolve_string), 0, 0, 1, 1},
    {&__pyx_kp_b_Resource_error, __pyx_k_Resource_error, sizeof(__pyx_k_Resource_error), 0, 0, 0, 0},
    {&__pyx_n_s_RotatingErrorLog, __pyx_k_RotatingErrorLog, sizeof(__pyx_k_RotatingErrorLog), 0, 0, 1, 1},
    {&__pyx_n_s_RotatingErrorLog_receive, __pyx_k_RotatingErrorLog_receive, sizeof(__pyx_k_RotatingErrorLog_receive), 0, 0, 1, 1},
    {&__pyx_kp_u_SYSTEM, __pyx_k_SYSTEM, sizeof(__pyx_k_SYSTEM), 0, 1, 0, 0},
    {&__pyx_n_s_SaxParserTarget, __pyx_k_SaxParserTarget, sizeof(__pyx_k_SaxParserTarget), 0, 0, 1, 1},
    {&__pyx_kp_u_Schema_instance_not_initialised, __pyx_k_Schema_instance_not_initialised, sizeof(__pyx_k_Schema_instance_not_initialised), 0, 1, 0, 0},
    {&__pyx_n_s_Schematron, __pyx_k_Schematron, sizeof(__pyx_k_Schematron), 0, 0, 1, 1},
    {&__pyx_n_u_Schematron, __pyx_k_Schematron, sizeof(__pyx_k_Schematron), 0, 1, 0, 1},
    {&__pyx_n_s_SchematronError, __pyx_k_SchematronError, sizeof(__pyx_k_SchematronError), 0, 0, 1, 1},
    {&__pyx_n_u_SchematronError, __pyx_k_SchematronError, sizeof(__pyx_k_SchematronError), 0, 1, 0, 1},
    {&__pyx_n_s_SchematronParseError, __pyx_k_SchematronParseError, sizeof(__pyx_k_SchematronParseError), 0, 0, 1, 1},
    {&__pyx_n_u_SchematronParseError, __pyx_k_SchematronParseError, sizeof(__pyx_k_SchematronParseError), 0, 1, 0, 1},
    {&__pyx_n_s_SchematronValidateError, __pyx_k_SchematronValidateError, sizeof(__pyx_k_SchematronValidateError), 0, 0, 1, 1},
    {&__pyx_n_u_SchematronValidateError, __pyx_k_SchematronValidateError, sizeof(__pyx_k_SchematronValidateError), 0, 1, 0, 1},
    {&__pyx_kp_u_Schematron_instance_not_initiali, __pyx_k_Schematron_instance_not_initiali, sizeof(__pyx_k_Schematron_instance_not_initiali), 0, 1, 0, 0},
    {&__pyx_n_s_SerialisationError, __pyx_k_SerialisationError, sizeof(__pyx_k_SerialisationError), 0, 0, 1, 1},
    {&__pyx_n_u_SerialisationError, __pyx_k_SerialisationError, sizeof(__pyx_k_SerialisationError), 0, 1, 0, 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_n_s_SiblingsIterator, __pyx_k_SiblingsIterator, sizeof(__pyx_k_SiblingsIterator), 0, 0, 1, 1},
    {&__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_n_u_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 0, 1, 0, 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_kp_u_System_URL_may_not_contain_both, __pyx_k_System_URL_may_not_contain_both, sizeof(__pyx_k_System_URL_may_not_contain_both), 0, 1, 0, 0},
    {&__pyx_n_u_TAG, __pyx_k_TAG, sizeof(__pyx_k_TAG), 0, 1, 0, 1},
    {&__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_The_docstring_option_is_deprecat, __pyx_k_The_docstring_option_is_deprecat, sizeof(__pyx_k_The_docstring_option_is_deprecat), 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_search_incorrectly_ignores, __pyx_k_This_search_incorrectly_ignores, sizeof(__pyx_k_This_search_incorrectly_ignores), 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_n_s_TreeBuilder, __pyx_k_TreeBuilder, sizeof(__pyx_k_TreeBuilder), 0, 0, 1, 1},
    {&__pyx_n_u_TreeBuilder, __pyx_k_TreeBuilder, sizeof(__pyx_k_TreeBuilder), 0, 1, 0, 1},
    {&__pyx_n_s_TreeBuilder_close, __pyx_k_TreeBuilder_close, sizeof(__pyx_k_TreeBuilder_close), 0, 0, 1, 1},
    {&__pyx_n_s_TreeBuilder_comment, __pyx_k_TreeBuilder_comment, sizeof(__pyx_k_TreeBuilder_comment), 0, 0, 1, 1},
    {&__pyx_n_s_TreeBuilder_data, __pyx_k_TreeBuilder_data, sizeof(__pyx_k_TreeBuilder_data), 0, 0, 1, 1},
    {&__pyx_n_s_TreeBuilder_end, __pyx_k_TreeBuilder_end, sizeof(__pyx_k_TreeBuilder_end), 0, 0, 1, 1},
    {&__pyx_n_s_TreeBuilder_pi, __pyx_k_TreeBuilder_pi, sizeof(__pyx_k_TreeBuilder_pi), 0, 0, 1, 1},
    {&__pyx_n_s_TreeBuilder_start, __pyx_k_TreeBuilder_start, sizeof(__pyx_k_TreeBuilder_start), 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_kp_u_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 1, 0, 0},
    {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
    {&__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_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_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_b_Unknown_error, __pyx_k_Unknown_error, sizeof(__pyx_k_Unknown_error), 0, 0, 0, 0},
    {&__pyx_kp_u_Unknown_libxml2_version, __pyx_k_Unknown_libxml2_version, sizeof(__pyx_k_Unknown_libxml2_version), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_node_type, __pyx_k_Unknown_node_type, sizeof(__pyx_k_Unknown_node_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_return_type, __pyx_k_Unknown_return_type, sizeof(__pyx_k_Unknown_return_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_xpath_result, __pyx_k_Unknown_xpath_result, sizeof(__pyx_k_Unknown_xpath_result), 0, 1, 0, 0},
    {&__pyx_kp_b_Unregistered_function, __pyx_k_Unregistered_function, sizeof(__pyx_k_Unregistered_function), 0, 0, 0, 0},
    {&__pyx_kp_u_Unsupported_element_type, __pyx_k_Unsupported_element_type, sizeof(__pyx_k_Unsupported_element_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Unsupported_node_type, __pyx_k_Unsupported_node_type, sizeof(__pyx_k_Unsupported_node_type), 0, 1, 0, 0},
    {&__pyx_n_s_Validator, __pyx_k_Validator, sizeof(__pyx_k_Validator), 0, 0, 1, 1},
    {&__pyx_n_s_Validator__append_log_message, __pyx_k_Validator__append_log_message, sizeof(__pyx_k_Validator__append_log_message), 0, 0, 1, 1},
    {&__pyx_n_s_Validator__clear_error_log, __pyx_k_Validator__clear_error_log, sizeof(__pyx_k_Validator__clear_error_log), 0, 0, 1, 1},
    {&__pyx_n_s_Validator_assert, __pyx_k_Validator_assert, sizeof(__pyx_k_Validator_assert), 0, 0, 1, 1},
    {&__pyx_n_s_Validator_assertValid, __pyx_k_Validator_assertValid, sizeof(__pyx_k_Validator_assertValid), 0, 0, 1, 1},
    {&__pyx_n_s_Validator_validate, __pyx_k_Validator_validate, sizeof(__pyx_k_Validator_validate), 0, 0, 1, 1},
    {&__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_u_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 1, 0, 1},
    {&__pyx_n_s_XInclude, __pyx_k_XInclude, sizeof(__pyx_k_XInclude), 0, 0, 1, 1},
    {&__pyx_n_u_XInclude, __pyx_k_XInclude, sizeof(__pyx_k_XInclude), 0, 1, 0, 1},
    {&__pyx_n_s_XIncludeError, __pyx_k_XIncludeError, sizeof(__pyx_k_XIncludeError), 0, 0, 1, 1},
    {&__pyx_n_u_XIncludeError, __pyx_k_XIncludeError, sizeof(__pyx_k_XIncludeError), 0, 1, 0, 1},
    {&__pyx_kp_u_XInclude_instance_not_initialise, __pyx_k_XInclude_instance_not_initialise, sizeof(__pyx_k_XInclude_instance_not_initialise), 0, 1, 0, 0},
    {&__pyx_kp_u_XInclude_processing_failed, __pyx_k_XInclude_processing_failed, sizeof(__pyx_k_XInclude_processing_failed), 0, 1, 0, 0},
    {&__pyx_kp_u_XInclude_processor_not_initialis, __pyx_k_XInclude_processor_not_initialis, sizeof(__pyx_k_XInclude_processor_not_initialis), 0, 1, 0, 0},
    {&__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_XMLDTDID, __pyx_k_XMLDTDID, sizeof(__pyx_k_XMLDTDID), 0, 0, 1, 1},
    {&__pyx_n_u_XMLDTDID, __pyx_k_XMLDTDID, sizeof(__pyx_k_XMLDTDID), 0, 1, 0, 1},
    {&__pyx_n_s_XMLID, __pyx_k_XMLID, sizeof(__pyx_k_XMLID), 0, 0, 1, 1},
    {&__pyx_n_u_XMLID, __pyx_k_XMLID, sizeof(__pyx_k_XMLID), 0, 1, 0, 1},
    {&__pyx_n_s_XMLParser, __pyx_k_XMLParser, sizeof(__pyx_k_XMLParser), 0, 0, 1, 1},
    {&__pyx_n_u_XMLParser, __pyx_k_XMLParser, sizeof(__pyx_k_XMLParser), 0, 1, 0, 1},
    {&__pyx_n_s_XMLPullParser, __pyx_k_XMLPullParser, sizeof(__pyx_k_XMLPullParser), 0, 0, 1, 1},
    {&__pyx_n_s_XMLPullParser_read_events, __pyx_k_XMLPullParser_read_events, sizeof(__pyx_k_XMLPullParser_read_events), 0, 0, 1, 1},
    {&__pyx_n_s_XMLSchema, __pyx_k_XMLSchema, sizeof(__pyx_k_XMLSchema), 0, 0, 1, 1},
    {&__pyx_n_u_XMLSchema, __pyx_k_XMLSchema, sizeof(__pyx_k_XMLSchema), 0, 1, 0, 1},
    {&__pyx_n_s_XMLSchemaError, __pyx_k_XMLSchemaError, sizeof(__pyx_k_XMLSchemaError), 0, 0, 1, 1},
    {&__pyx_n_u_XMLSchemaError, __pyx_k_XMLSchemaError, sizeof(__pyx_k_XMLSchemaError), 0, 1, 0, 1},
    {&__pyx_n_s_XMLSchemaParseError, __pyx_k_XMLSchemaParseError, sizeof(__pyx_k_XMLSchemaParseError), 0, 0, 1, 1},
    {&__pyx_n_u_XMLSchemaParseError, __pyx_k_XMLSchemaParseError, sizeof(__pyx_k_XMLSchemaParseError), 0, 1, 0, 1},
    {&__pyx_n_s_XMLSchemaValidateError, __pyx_k_XMLSchemaValidateError, sizeof(__pyx_k_XMLSchemaValidateError), 0, 0, 1, 1},
    {&__pyx_n_u_XMLSchemaValidateError, __pyx_k_XMLSchemaValidateError, sizeof(__pyx_k_XMLSchemaValidateError), 0, 1, 0, 1},
    {&__pyx_n_s_XMLSyntaxAssertionError, __pyx_k_XMLSyntaxAssertionError, sizeof(__pyx_k_XMLSyntaxAssertionError), 0, 0, 1, 1},
    {&__pyx_n_s_XMLSyntaxAssertionError___init, __pyx_k_XMLSyntaxAssertionError___init, sizeof(__pyx_k_XMLSyntaxAssertionError___init), 0, 0, 1, 1},
    {&__pyx_n_s_XMLSyntaxError, __pyx_k_XMLSyntaxError, sizeof(__pyx_k_XMLSyntaxError), 0, 0, 1, 1},
    {&__pyx_n_u_XMLSyntaxError, __pyx_k_XMLSyntaxError, sizeof(__pyx_k_XMLSyntaxError), 0, 1, 0, 1},
    {&__pyx_n_s_XMLTreeBuilder, __pyx_k_XMLTreeBuilder, sizeof(__pyx_k_XMLTreeBuilder), 0, 0, 1, 1},
    {&__pyx_n_u_XMLTreeBuilder, __pyx_k_XMLTreeBuilder, sizeof(__pyx_k_XMLTreeBuilder), 0, 1, 0, 1},
    {&__pyx_kp_u_XML_declaration_already_written, __pyx_k_XML_declaration_already_written, sizeof(__pyx_k_XML_declaration_already_written), 0, 1, 0, 0},
    {&__pyx_kp_u_XML_line_3261, __pyx_k_XML_line_3261, sizeof(__pyx_k_XML_line_3261), 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_u_XPath, __pyx_k_XPath, sizeof(__pyx_k_XPath), 0, 1, 0, 1},
    {&__pyx_n_s_XPathDocumentEvaluator, __pyx_k_XPathDocumentEvaluator, sizeof(__pyx_k_XPathDocumentEvaluator), 0, 0, 1, 1},
    {&__pyx_n_u_XPathDocumentEvaluator, __pyx_k_XPathDocumentEvaluator, sizeof(__pyx_k_XPathDocumentEvaluator), 0, 1, 0, 1},
    {&__pyx_n_s_XPathElementEvaluator, __pyx_k_XPathElementEvaluator, sizeof(__pyx_k_XPathElementEvaluator), 0, 0, 1, 1},
    {&__pyx_n_s_XPathElementEvaluator_register_n, __pyx_k_XPathElementEvaluator_register_n, sizeof(__pyx_k_XPathElementEvaluator_register_n), 0, 0, 1, 1},
    {&__pyx_n_s_XPathElementEvaluator_register_n_2, __pyx_k_XPathElementEvaluator_register_n_2, sizeof(__pyx_k_XPathElementEvaluator_register_n_2), 0, 0, 1, 1},
    {&__pyx_n_s_XPathError, __pyx_k_XPathError, sizeof(__pyx_k_XPathError), 0, 0, 1, 1},
    {&__pyx_n_u_XPathError, __pyx_k_XPathError, sizeof(__pyx_k_XPathError), 0, 1, 0, 1},
    {&__pyx_n_s_XPathEvalError, __pyx_k_XPathEvalError, sizeof(__pyx_k_XPathEvalError), 0, 0, 1, 1},
    {&__pyx_n_u_XPathEvalError, __pyx_k_XPathEvalError, sizeof(__pyx_k_XPathEvalError), 0, 1, 0, 1},
    {&__pyx_n_s_XPathEvaluator, __pyx_k_XPathEvaluator, sizeof(__pyx_k_XPathEvaluator), 0, 0, 1, 1},
    {&__pyx_n_u_XPathEvaluator, __pyx_k_XPathEvaluator, sizeof(__pyx_k_XPathEvaluator), 0, 1, 0, 1},
    {&__pyx_n_s_XPathEvaluatorBase, __pyx_k_XPathEvaluatorBase, sizeof(__pyx_k_XPathEvaluatorBase), 0, 0, 1, 1},
    {&__pyx_n_s_XPathFunctionError, __pyx_k_XPathFunctionError, sizeof(__pyx_k_XPathFunctionError), 0, 0, 1, 1},
    {&__pyx_n_u_XPathFunctionError, __pyx_k_XPathFunctionError, sizeof(__pyx_k_XPathFunctionError), 0, 1, 0, 1},
    {&__pyx_n_s_XPathResultError, __pyx_k_XPathResultError, sizeof(__pyx_k_XPathResultError), 0, 0, 1, 1},
    {&__pyx_n_u_XPathResultError, __pyx_k_XPathResultError, sizeof(__pyx_k_XPathResultError), 0, 1, 0, 1},
    {&__pyx_n_s_XPathSyntaxError, __pyx_k_XPathSyntaxError, sizeof(__pyx_k_XPathSyntaxError), 0, 0, 1, 1},
    {&__pyx_n_u_XPathSyntaxError, __pyx_k_XPathSyntaxError, sizeof(__pyx_k_XPathSyntaxError), 0, 1, 0, 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_u_XPath_context_not_initialised, __pyx_k_XPath_context_not_initialised, sizeof(__pyx_k_XPath_context_not_initialised), 0, 1, 0, 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_u_XPath_evaluator_not_initialised, __pyx_k_XPath_evaluator_not_initialised, sizeof(__pyx_k_XPath_evaluator_not_initialised), 0, 1, 0, 0},
    {&__pyx_kp_u_XPath_function, __pyx_k_XPath_function, sizeof(__pyx_k_XPath_function), 0, 1, 0, 0},
    {&__pyx_n_s_XSLT, __pyx_k_XSLT, sizeof(__pyx_k_XSLT), 0, 0, 1, 1},
    {&__pyx_n_u_XSLT, __pyx_k_XSLT, sizeof(__pyx_k_XSLT), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTAccessControl, __pyx_k_XSLTAccessControl, sizeof(__pyx_k_XSLTAccessControl), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTAccessControl, __pyx_k_XSLTAccessControl, sizeof(__pyx_k_XSLTAccessControl), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTApplyError, __pyx_k_XSLTApplyError, sizeof(__pyx_k_XSLTApplyError), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTApplyError, __pyx_k_XSLTApplyError, sizeof(__pyx_k_XSLTApplyError), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTError, __pyx_k_XSLTError, sizeof(__pyx_k_XSLTError), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTError, __pyx_k_XSLTError, sizeof(__pyx_k_XSLTError), 0, 1, 0, 1},
    {&__pyx_n_u_XSLTErrorLog, __pyx_k_XSLTErrorLog, sizeof(__pyx_k_XSLTErrorLog), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTExtension, __pyx_k_XSLTExtension, sizeof(__pyx_k_XSLTExtension), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTExtension, __pyx_k_XSLTExtension, sizeof(__pyx_k_XSLTExtension), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTExtensionError, __pyx_k_XSLTExtensionError, sizeof(__pyx_k_XSLTExtensionError), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTExtensionError, __pyx_k_XSLTExtensionError, sizeof(__pyx_k_XSLTExtensionError), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTExtension_apply_templates, __pyx_k_XSLTExtension_apply_templates, sizeof(__pyx_k_XSLTExtension_apply_templates), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTExtension_execute, __pyx_k_XSLTExtension_execute, sizeof(__pyx_k_XSLTExtension_execute), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTExtension_process_children, __pyx_k_XSLTExtension_process_children, sizeof(__pyx_k_XSLTExtension_process_children), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTParseError, __pyx_k_XSLTParseError, sizeof(__pyx_k_XSLTParseError), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTParseError, __pyx_k_XSLTParseError, sizeof(__pyx_k_XSLTParseError), 0, 1, 0, 1},
    {&__pyx_n_s_XSLTProcessingInstruction, __pyx_k_XSLTProcessingInstruction, sizeof(__pyx_k_XSLTProcessingInstruction), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTProcessingInstruction_parse, __pyx_k_XSLTProcessingInstruction_parse, sizeof(__pyx_k_XSLTProcessingInstruction_parse), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTProcessingInstruction_set, __pyx_k_XSLTProcessingInstruction_set, sizeof(__pyx_k_XSLTProcessingInstruction_set), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTResultTree, __pyx_k_XSLTResultTree, sizeof(__pyx_k_XSLTResultTree), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTResultTree_write_output, __pyx_k_XSLTResultTree_write_output, sizeof(__pyx_k_XSLTResultTree_write_output), 0, 0, 1, 1},
    {&__pyx_n_s_XSLTSaveError, __pyx_k_XSLTSaveError, sizeof(__pyx_k_XSLTSaveError), 0, 0, 1, 1},
    {&__pyx_n_u_XSLTSaveError, __pyx_k_XSLTSaveError, sizeof(__pyx_k_XSLTSaveError), 0, 1, 0, 1},
    {&__pyx_n_s_XSLT___copy, __pyx_k_XSLT___copy, sizeof(__pyx_k_XSLT___copy), 0, 0, 1, 1},
    {&__pyx_n_s_XSLT___deepcopy, __pyx_k_XSLT___deepcopy, sizeof(__pyx_k_XSLT___deepcopy), 0, 0, 1, 1},
    {&__pyx_kp_u_XSLT_context_not_initialised, __pyx_k_XSLT_context_not_initialised, sizeof(__pyx_k_XSLT_context_not_initialised), 0, 1, 0, 0},
    {&__pyx_n_s_XSLT_set_global_max_depth, __pyx_k_XSLT_set_global_max_depth, sizeof(__pyx_k_XSLT_set_global_max_depth), 0, 0, 1, 1},
    {&__pyx_n_s_XSLT_strparam, __pyx_k_XSLT_strparam, sizeof(__pyx_k_XSLT_strparam), 0, 0, 1, 1},
    {&__pyx_kp_u_XSLT_stylesheet_not_initialised, __pyx_k_XSLT_stylesheet_not_initialised, sizeof(__pyx_k_XSLT_stylesheet_not_initialised), 0, 1, 0, 0},
    {&__pyx_n_s_XSLT_tostring, __pyx_k_XSLT_tostring, sizeof(__pyx_k_XSLT_tostring), 0, 0, 1, 1},
    {&__pyx_n_s__106, __pyx_k__106, sizeof(__pyx_k__106), 0, 0, 1, 1},
    {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
    {&__pyx_kp_b__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 0, 0},
    {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
    {&__pyx_kp_b__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 0, 0, 0},
    {&__pyx_kp_u__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 1, 0, 0},
    {&__pyx_kp_u__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0, 0},
    {&__pyx_kp_u__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 1, 0, 0},
    {&__pyx_kp_u__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 1, 0, 0},
    {&__pyx_kp_b__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 0, 0, 0},
    {&__pyx_kp_u__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 1, 0, 0},
    {&__pyx_n_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 1},
    {&__pyx_kp_b__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 0, 0},
    {&__pyx_kp_u__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 1, 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_b__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 0, 0},
    {&__pyx_kp_u__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 1, 0, 0},
    {&__pyx_kp_u__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 1, 0, 0},
    {&__pyx_kp_u__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 1, 0, 0},
    {&__pyx_kp_b__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 0, 0},
    {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
    {&__pyx_kp_u__30, __pyx_k__30, sizeof(__pyx_k__30), 0, 1, 0, 0},
    {&__pyx_kp_u__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 1, 0, 0},
    {&__pyx_kp_b__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 0, 0},
    {&__pyx_kp_u__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 1, 0, 0},
    {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 0},
    {&__pyx_kp_u__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 1, 0, 0},
    {&__pyx_kp_b__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 0, 0, 0},
    {&__pyx_kp_u__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 1, 0, 0},
    {&__pyx_kp_b__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 0, 0},
    {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
    {&__pyx_kp_u__41, __pyx_k__41, sizeof(__pyx_k__41), 0, 1, 0, 0},
    {&__pyx_kp_u__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 1, 0, 0},
    {&__pyx_kp_u__43, __pyx_k__43, sizeof(__pyx_k__43), 0, 1, 0, 0},
    {&__pyx_kp_u__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 1, 0, 0},
    {&__pyx_kp_b__48, __pyx_k__48, sizeof(__pyx_k__48), 0, 0, 0, 0},
    {&__pyx_kp_b__489, __pyx_k__489, sizeof(__pyx_k__489), 0, 0, 0, 0},
    {&__pyx_kp_b__491, __pyx_k__491, sizeof(__pyx_k__491), 0, 0, 0, 0},
    {&__pyx_kp_b__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 0, 0, 0},
    {&__pyx_kp_u__52, __pyx_k__52, sizeof(__pyx_k__52), 0, 1, 0, 0},
    {&__pyx_n_s__56, __pyx_k__56, sizeof(__pyx_k__56), 0, 0, 1, 1},
    {&__pyx_n_u__56, __pyx_k__56, sizeof(__pyx_k__56), 0, 1, 0, 1},
    {&__pyx_kp_u__57, __pyx_k__57, sizeof(__pyx_k__57), 0, 1, 0, 0},
    {&__pyx_kp_u__61, __pyx_k__61, sizeof(__pyx_k__61), 0, 1, 0, 0},
    {&__pyx_kp_b__63, __pyx_k__63, sizeof(__pyx_k__63), 0, 0, 0, 0},
    {&__pyx_kp_u__71, __pyx_k__71, sizeof(__pyx_k__71), 0, 1, 0, 0},
    {&__pyx_kp_u__72, __pyx_k__72, sizeof(__pyx_k__72), 0, 1, 0, 0},
    {&__pyx_kp_u__73, __pyx_k__73, sizeof(__pyx_k__73), 0, 1, 0, 0},
    {&__pyx_kp_u__74, __pyx_k__74, sizeof(__pyx_k__74), 0, 1, 0, 0},
    {&__pyx_kp_u__75, __pyx_k__75, sizeof(__pyx_k__75), 0, 1, 0, 0},
    {&__pyx_kp_u__95, __pyx_k__95, sizeof(__pyx_k__95), 0, 1, 0, 0},
    {&__pyx_kp_u__96, __pyx_k__96, sizeof(__pyx_k__96), 0, 1, 0, 0},
    {&__pyx_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_addnext, __pyx_k_addnext, sizeof(__pyx_k_addnext), 0, 0, 1, 1},
    {&__pyx_n_s_addprevious, __pyx_k_addprevious, sizeof(__pyx_k_addprevious), 0, 0, 1, 1},
    {&__pyx_n_s_adopt_external_document, __pyx_k_adopt_external_document, sizeof(__pyx_k_adopt_external_document), 0, 0, 1, 1},
    {&__pyx_n_s_aenter, __pyx_k_aenter, sizeof(__pyx_k_aenter), 0, 0, 1, 1},
    {&__pyx_n_s_aexit, __pyx_k_aexit, sizeof(__pyx_k_aexit), 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_kp_u_amp, __pyx_k_amp, sizeof(__pyx_k_amp), 0, 1, 0, 0},
    {&__pyx_n_u_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 1, 0, 1},
    {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 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_apply_templates, __pyx_k_apply_templates, sizeof(__pyx_k_apply_templates), 0, 0, 1, 1},
    {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
    {&__pyx_kp_u_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, 1, 0, 0},
    {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
    {&__pyx_n_s_assert, __pyx_k_assert, sizeof(__pyx_k_assert), 0, 0, 1, 1},
    {&__pyx_n_s_assertValid, __pyx_k_assertValid, sizeof(__pyx_k_assertValid), 0, 0, 1, 1},
    {&__pyx_n_s_async_outfile, __pyx_k_async_outfile, sizeof(__pyx_k_async_outfile), 0, 0, 1, 1},
    {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
    {&__pyx_kp_u_at_0x, __pyx_k_at_0x, sizeof(__pyx_k_at_0x), 0, 1, 0, 0},
    {&__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_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
    {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
    {&__pyx_n_s_await, __pyx_k_await, sizeof(__pyx_k_await), 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_n_s_blocks_used, __pyx_k_blocks_used, sizeof(__pyx_k_blocks_used), 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_bstring, __pyx_k_bstring, sizeof(__pyx_k_bstring), 0, 0, 1, 1},
    {&__pyx_n_s_buffered, __pyx_k_buffered, sizeof(__pyx_k_buffered), 0, 0, 1, 1},
    {&__pyx_n_s_build_smart_strings, __pyx_k_build_smart_strings, sizeof(__pyx_k_build_smart_strings), 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_bytes_used, __pyx_k_bytes_used, sizeof(__pyx_k_bytes_used), 0, 0, 1, 1},
    {&__pyx_n_u_c14n, __pyx_k_c14n, sizeof(__pyx_k_c14n), 0, 1, 0, 1},
    {&__pyx_n_u_c14n2, __pyx_k_c14n2, sizeof(__pyx_k_c14n2), 0, 1, 0, 1},
    {&__pyx_n_s_c_attr, __pyx_k_c_attr, sizeof(__pyx_k_c_attr), 0, 0, 1, 1},
    {&__pyx_n_s_c_attr_next, __pyx_k_c_attr_next, sizeof(__pyx_k_c_attr_next), 0, 0, 1, 1},
    {&__pyx_n_s_c_attrs, __pyx_k_c_attrs, sizeof(__pyx_k_c_attrs), 0, 0, 1, 1},
    {&__pyx_n_s_c_buffer, __pyx_k_c_buffer, sizeof(__pyx_k_c_buffer), 0, 0, 1, 1},
    {&__pyx_n_s_c_child, __pyx_k_c_child, sizeof(__pyx_k_c_child), 0, 0, 1, 1},
    {&__pyx_n_s_c_compression, __pyx_k_c_compression, sizeof(__pyx_k_c_compression), 0, 0, 1, 1},
    {&__pyx_n_s_c_context_node, __pyx_k_c_context_node, sizeof(__pyx_k_c_context_node), 0, 0, 1, 1},
    {&__pyx_n_s_c_count, __pyx_k_c_count, sizeof(__pyx_k_c_count), 0, 0, 1, 1},
    {&__pyx_n_s_c_ctxt, __pyx_k_c_ctxt, sizeof(__pyx_k_c_ctxt), 0, 0, 1, 1},
    {&__pyx_n_s_c_dict, __pyx_k_c_dict, sizeof(__pyx_k_c_dict), 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_dtd, __pyx_k_c_dtd, sizeof(__pyx_k_c_dtd), 0, 0, 1, 1},
    {&__pyx_n_s_c_element, __pyx_k_c_element, sizeof(__pyx_k_c_element), 0, 0, 1, 1},
    {&__pyx_n_s_c_encoding, __pyx_k_c_encoding, sizeof(__pyx_k_c_encoding), 0, 0, 1, 1},
    {&__pyx_n_s_c_href, __pyx_k_c_href, sizeof(__pyx_k_c_href), 0, 0, 1, 1},
    {&__pyx_n_s_c_method, __pyx_k_c_method, sizeof(__pyx_k_c_method), 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_new_next, __pyx_k_c_new_next, sizeof(__pyx_k_c_new_next), 0, 0, 1, 1},
    {&__pyx_n_s_c_new_node, __pyx_k_c_new_node, sizeof(__pyx_k_c_new_node), 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_node_next, __pyx_k_c_node_next, sizeof(__pyx_k_c_node_next), 0, 0, 1, 1},
    {&__pyx_n_s_c_old_next, __pyx_k_c_old_next, sizeof(__pyx_k_c_old_next), 0, 0, 1, 1},
    {&__pyx_n_s_c_old_node, __pyx_k_c_old_node, sizeof(__pyx_k_c_old_node), 0, 0, 1, 1},
    {&__pyx_n_s_c_old_output_parent, __pyx_k_c_old_output_parent, sizeof(__pyx_k_c_old_output_parent), 0, 0, 1, 1},
    {&__pyx_n_s_c_parent, __pyx_k_c_parent, sizeof(__pyx_k_c_parent), 0, 0, 1, 1},
    {&__pyx_n_s_c_path, __pyx_k_c_path, sizeof(__pyx_k_c_path), 0, 0, 1, 1},
    {&__pyx_n_s_c_source_doc, __pyx_k_c_source_doc, sizeof(__pyx_k_c_source_doc), 0, 0, 1, 1},
    {&__pyx_n_s_c_standalone, __pyx_k_c_standalone, sizeof(__pyx_k_c_standalone), 0, 0, 1, 1},
    {&__pyx_n_s_c_start, __pyx_k_c_start, sizeof(__pyx_k_c_start), 0, 0, 1, 1},
    {&__pyx_n_s_c_start_node, __pyx_k_c_start_node, sizeof(__pyx_k_c_start_node), 0, 0, 1, 1},
    {&__pyx_n_s_c_stop, __pyx_k_c_stop, sizeof(__pyx_k_c_stop), 0, 0, 1, 1},
    {&__pyx_n_s_c_version, __pyx_k_c_version, sizeof(__pyx_k_c_version), 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_add_ancestor_as_sibling_p, __pyx_k_cannot_add_ancestor_as_sibling_p, sizeof(__pyx_k_cannot_add_ancestor_as_sibling_p), 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_u_cannot_append_parent_to_itself, __pyx_k_cannot_append_parent_to_itself, sizeof(__pyx_k_cannot_append_parent_to_itself), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_append_trailing_element_t, __pyx_k_cannot_append_trailing_element_t, sizeof(__pyx_k_cannot_append_trailing_element_t), 0, 1, 0, 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_be_serialized, __pyx_k_cannot_be_serialized, sizeof(__pyx_k_cannot_be_serialized), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_parse_from, __pyx_k_cannot_parse_from, sizeof(__pyx_k_cannot_parse_from), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_serialize, __pyx_k_cannot_serialize, sizeof(__pyx_k_cannot_serialize), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_set_a_maximum_stylesheet, __pyx_k_cannot_set_a_maximum_stylesheet, sizeof(__pyx_k_cannot_set_a_maximum_stylesheet), 0, 1, 0, 0},
    {&__pyx_n_s_canonicalize, __pyx_k_canonicalize, sizeof(__pyx_k_canonicalize), 0, 0, 1, 1},
    {&__pyx_n_u_canonicalize, __pyx_k_canonicalize, sizeof(__pyx_k_canonicalize), 0, 1, 0, 1},
    {&__pyx_n_s_capsule, __pyx_k_capsule, sizeof(__pyx_k_capsule), 0, 0, 1, 1},
    {&__pyx_n_u_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 1, 0, 1},
    {&__pyx_n_s_child, __pyx_k_child, sizeof(__pyx_k_child), 0, 0, 1, 1},
    {&__pyx_n_s_children, __pyx_k_children, sizeof(__pyx_k_children), 0, 0, 1, 1},
    {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
    {&__pyx_n_u_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 1, 0, 1},
    {&__pyx_n_s_class_dict_iterable, __pyx_k_class_dict_iterable, sizeof(__pyx_k_class_dict_iterable), 0, 0, 1, 1},
    {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 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_u_cleanup_namespaces, __pyx_k_cleanup_namespaces, sizeof(__pyx_k_cleanup_namespaces), 0, 1, 0, 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_u_clear_error_log_2, __pyx_k_clear_error_log_2, sizeof(__pyx_k_clear_error_log_2), 0, 1, 0, 1},
    {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
    {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
    {&__pyx_n_s_close_2, __pyx_k_close_2, sizeof(__pyx_k_close_2), 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_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
    {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
    {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
    {&__pyx_n_s_collect_ids, __pyx_k_collect_ids, sizeof(__pyx_k_collect_ids), 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_kp_u_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 1, 0, 0},
    {&__pyx_n_s_column_2, __pyx_k_column_2, sizeof(__pyx_k_column_2), 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_comment_factory, __pyx_k_comment_factory, sizeof(__pyx_k_comment_factory), 0, 0, 1, 1},
    {&__pyx_n_s_compact, __pyx_k_compact, sizeof(__pyx_k_compact), 0, 0, 1, 1},
    {&__pyx_kp_u_compact_syntax_not_supported_ple, __pyx_k_compact_syntax_not_supported_ple, sizeof(__pyx_k_compact_syntax_not_supported_ple), 0, 1, 0, 0},
    {&__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_content, __pyx_k_content, sizeof(__pyx_k_content), 0, 0, 1, 1},
    {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
    {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
    {&__pyx_n_s_contextmanager, __pyx_k_contextmanager, sizeof(__pyx_k_contextmanager), 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_count, __pyx_k_count, sizeof(__pyx_k_count), 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_cssselect, __pyx_k_cssselect, sizeof(__pyx_k_cssselect), 0, 0, 1, 1},
    {&__pyx_n_s_ctxt, __pyx_k_ctxt, sizeof(__pyx_k_ctxt), 0, 0, 1, 1},
    {&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 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_deco, __pyx_k_deco, sizeof(__pyx_k_deco), 0, 0, 1, 1},
    {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
    {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1},
    {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
    {&__pyx_kp_u_default_2, __pyx_k_default_2, sizeof(__pyx_k_default_2), 0, 1, 0, 0},
    {&__pyx_n_s_default_doctype, __pyx_k_default_doctype, sizeof(__pyx_k_default_doctype), 0, 0, 1, 1},
    {&__pyx_n_s_default_resolver, __pyx_k_default_resolver, sizeof(__pyx_k_default_resolver), 0, 0, 1, 1},
    {&__pyx_kp_u_default_value, __pyx_k_default_value, sizeof(__pyx_k_default_value), 0, 1, 0, 0},
    {&__pyx_n_s_default_value_2, __pyx_k_default_value_2, sizeof(__pyx_k_default_value_2), 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_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
    {&__pyx_n_u_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 1, 0, 1},
    {&__pyx_n_s_dict_size, __pyx_k_dict_size, sizeof(__pyx_k_dict_size), 0, 0, 1, 1},
    {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
    {&__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_doc_ref, __pyx_k_doc_ref, sizeof(__pyx_k_doc_ref), 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_n_u_dump, __pyx_k_dump, sizeof(__pyx_k_dump), 0, 1, 0, 1},
    {&__pyx_n_s_dumps, __pyx_k_dumps, sizeof(__pyx_k_dumps), 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_el, __pyx_k_el, sizeof(__pyx_k_el), 0, 0, 1, 1},
    {&__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_element_writer, __pyx_k_element_writer, sizeof(__pyx_k_element_writer), 0, 0, 1, 1},
    {&__pyx_n_s_elementpath, __pyx_k_elementpath, sizeof(__pyx_k_elementpath), 0, 0, 1, 1},
    {&__pyx_n_s_elements, __pyx_k_elements, sizeof(__pyx_k_elements), 0, 0, 1, 1},
    {&__pyx_n_s_elements_only, __pyx_k_elements_only, sizeof(__pyx_k_elements_only), 0, 0, 1, 1},
    {&__pyx_kp_u_elemname, __pyx_k_elemname, sizeof(__pyx_k_elemname), 0, 1, 0, 0},
    {&__pyx_n_s_elemname_2, __pyx_k_elemname_2, sizeof(__pyx_k_elemname_2), 0, 0, 1, 1},
    {&__pyx_n_u_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 1, 0, 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_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 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_u_end_ns, __pyx_k_end_ns, sizeof(__pyx_k_end_ns), 0, 1, 0, 0},
    {&__pyx_n_s_end_ns_2, __pyx_k_end_ns_2, sizeof(__pyx_k_end_ns_2), 0, 0, 1, 1},
    {&__pyx_kp_u_end_tag_mismatch_expected, __pyx_k_end_tag_mismatch_expected, sizeof(__pyx_k_end_tag_mismatch_expected), 0, 1, 0, 0},
    {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
    {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
    {&__pyx_n_s_entities, __pyx_k_entities, sizeof(__pyx_k_entities), 0, 0, 1, 1},
    {&__pyx_n_u_entities, __pyx_k_entities, sizeof(__pyx_k_entities), 0, 1, 0, 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_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 0, 0, 1, 1},
    {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
    {&__pyx_n_u_enumeration, __pyx_k_enumeration, sizeof(__pyx_k_enumeration), 0, 1, 0, 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_evaluator, __pyx_k_evaluator, sizeof(__pyx_k_evaluator), 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_exclude_attrs, __pyx_k_exclude_attrs, sizeof(__pyx_k_exclude_attrs), 0, 0, 1, 1},
    {&__pyx_n_s_exclude_tags, __pyx_k_exclude_tags, sizeof(__pyx_k_exclude_tags), 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_kp_u_expected, __pyx_k_expected, sizeof(__pyx_k_expected), 0, 1, 0, 0},
    {&__pyx_kp_u_expected_string_or_Element, __pyx_k_expected_string_or_Element, sizeof(__pyx_k_expected_string_or_Element), 0, 1, 0, 0},
    {&__pyx_n_s_expr, __pyx_k_expr, sizeof(__pyx_k_expr), 0, 0, 1, 1},
    {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
    {&__pyx_kp_u_extension_element, __pyx_k_extension_element, sizeof(__pyx_k_extension_element), 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_b_file_2, __pyx_k_file_2, sizeof(__pyx_k_file_2), 0, 0, 0, 0},
    {&__pyx_kp_u_file_must_be_a_filename_file_lik, __pyx_k_file_must_be_a_filename_file_lik, sizeof(__pyx_k_file_must_be_a_filename_file_lik), 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_domains, __pyx_k_filter_domains, sizeof(__pyx_k_filter_domains), 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_fatals, __pyx_k_filter_from_fatals, sizeof(__pyx_k_filter_from_fatals), 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_from_warnings, __pyx_k_filter_from_warnings, sizeof(__pyx_k_filter_from_warnings), 0, 0, 1, 1},
    {&__pyx_n_s_filter_levels, __pyx_k_filter_levels, sizeof(__pyx_k_filter_levels), 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_filtered, __pyx_k_filtered, sizeof(__pyx_k_filtered), 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_u_fixed, __pyx_k_fixed, sizeof(__pyx_k_fixed), 0, 1, 0, 1},
    {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
    {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 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_from_file, __pyx_k_from_file, sizeof(__pyx_k_from_file), 0, 0, 1, 1},
    {&__pyx_n_s_from_rnc_string, __pyx_k_from_rnc_string, sizeof(__pyx_k_from_rnc_string), 0, 0, 1, 1},
    {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1},
    {&__pyx_n_u_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 1, 0, 1},
    {&__pyx_n_s_fromstringlist, __pyx_k_fromstringlist, sizeof(__pyx_k_fromstringlist), 0, 0, 1, 1},
    {&__pyx_n_u_fromstringlist, __pyx_k_fromstringlist, sizeof(__pyx_k_fromstringlist), 0, 1, 0, 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_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 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_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 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_u_get_default_parser, __pyx_k_get_default_parser, sizeof(__pyx_k_get_default_parser), 0, 1, 0, 1},
    {&__pyx_n_s_get_namespace, __pyx_k_get_namespace, sizeof(__pyx_k_get_namespace), 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_getelementpath, __pyx_k_getelementpath, sizeof(__pyx_k_getelementpath), 0, 0, 1, 1},
    {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
    {&__pyx_n_s_getfullargspec, __pyx_k_getfullargspec, sizeof(__pyx_k_getfullargspec), 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_getpath, __pyx_k_getpath, sizeof(__pyx_k_getpath), 0, 0, 1, 1},
    {&__pyx_n_s_getprevious, __pyx_k_getprevious, sizeof(__pyx_k_getprevious), 0, 0, 1, 1},
    {&__pyx_n_s_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 0, 0, 1, 1},
    {&__pyx_n_s_getroottree, __pyx_k_getroottree, sizeof(__pyx_k_getroottree), 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_n_s_getwriter, __pyx_k_getwriter, sizeof(__pyx_k_getwriter), 0, 0, 1, 1},
    {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0},
    {&__pyx_kp_u_got_invalid_input_value_of_type, __pyx_k_got_invalid_input_value_of_type, sizeof(__pyx_k_got_invalid_input_value_of_type), 0, 1, 0, 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_kp_u_gt, __pyx_k_gt, sizeof(__pyx_k_gt), 0, 1, 0, 0},
    {&__pyx_n_s_gzip, __pyx_k_gzip, sizeof(__pyx_k_gzip), 0, 0, 1, 1},
    {&__pyx_n_s_has_key, __pyx_k_has_key, sizeof(__pyx_k_has_key), 0, 0, 1, 1},
    {&__pyx_n_u_href, __pyx_k_href, sizeof(__pyx_k_href), 0, 1, 0, 1},
    {&__pyx_kp_u_href_2, __pyx_k_href_2, sizeof(__pyx_k_href_2), 0, 1, 0, 0},
    {&__pyx_n_s_href_utf, __pyx_k_href_utf, sizeof(__pyx_k_href_utf), 0, 0, 1, 1},
    {&__pyx_n_s_hrefs, __pyx_k_hrefs, sizeof(__pyx_k_hrefs), 0, 0, 1, 1},
    {&__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_n_u_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 1, 0, 1},
    {&__pyx_n_s_htmlfile, __pyx_k_htmlfile, sizeof(__pyx_k_htmlfile), 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_u_http_www_w3_org_XML_1998_namesp, __pyx_k_http_www_w3_org_XML_1998_namesp, sizeof(__pyx_k_http_www_w3_org_XML_1998_namesp), 0, 1, 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_kp_u_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, 1, 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_id_name, __pyx_k_id_name, sizeof(__pyx_k_id_name), 0, 0, 1, 1},
    {&__pyx_n_u_idref, __pyx_k_idref, sizeof(__pyx_k_idref), 0, 1, 0, 1},
    {&__pyx_n_u_idrefs, __pyx_k_idrefs, sizeof(__pyx_k_idrefs), 0, 1, 0, 1},
    {&__pyx_n_u_implied, __pyx_k_implied, sizeof(__pyx_k_implied), 0, 1, 0, 1},
    {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
    {&__pyx_kp_u_in_public_id, __pyx_k_in_public_id, sizeof(__pyx_k_in_public_id), 0, 1, 0, 0},
    {&__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_u_inconsistent_exit_action_in_cont, __pyx_k_inconsistent_exit_action_in_cont, sizeof(__pyx_k_inconsistent_exit_action_in_cont), 0, 1, 0, 0},
    {&__pyx_n_s_indent, __pyx_k_indent, sizeof(__pyx_k_indent), 0, 0, 1, 1},
    {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
    {&__pyx_kp_u_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 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_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1},
    {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
    {&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
    {&__pyx_kp_u_input_is_not_an_Element, __pyx_k_input_is_not_an_Element, sizeof(__pyx_k_input_is_not_an_Element), 0, 1, 0, 0},
    {&__pyx_n_s_input_node, __pyx_k_input_node, sizeof(__pyx_k_input_node), 0, 0, 1, 1},
    {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
    {&__pyx_n_s_insert_comments, __pyx_k_insert_comments, sizeof(__pyx_k_insert_comments), 0, 0, 1, 1},
    {&__pyx_n_s_insert_pis, __pyx_k_insert_pis, sizeof(__pyx_k_insert_pis), 0, 0, 1, 1},
    {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
    {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
    {&__pyx_n_s_int1, __pyx_k_int1, sizeof(__pyx_k_int1), 0, 0, 1, 1},
    {&__pyx_n_s_int2, __pyx_k_int2, sizeof(__pyx_k_int2), 0, 0, 1, 1},
    {&__pyx_n_u_internal, __pyx_k_internal, sizeof(__pyx_k_internal), 0, 1, 0, 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_n_s_intersection, __pyx_k_intersection, sizeof(__pyx_k_intersection), 0, 0, 1, 1},
    {&__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, __pyx_k_invalid_argument_type, sizeof(__pyx_k_invalid_argument_type), 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, __pyx_k_invalid_event_name, sizeof(__pyx_k_invalid_event_name), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_node_type, __pyx_k_invalid_node_type, sizeof(__pyx_k_invalid_node_type), 0, 1, 0, 0},
    {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
    {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
    {&__pyx_kp_u_is_not_declared_in_scope, __pyx_k_is_not_declared_in_scope, sizeof(__pyx_k_is_not_declared_in_scope), 0, 1, 0, 0},
    {&__pyx_n_s_is_owned, __pyx_k_is_owned, sizeof(__pyx_k_is_owned), 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_iselement, __pyx_k_iselement, sizeof(__pyx_k_iselement), 0, 0, 1, 1},
    {&__pyx_n_u_iselement, __pyx_k_iselement, sizeof(__pyx_k_iselement), 0, 1, 0, 1},
    {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
    {&__pyx_n_s_islice, __pyx_k_islice, sizeof(__pyx_k_islice), 0, 0, 1, 1},
    {&__pyx_n_s_isspace, __pyx_k_isspace, sizeof(__pyx_k_isspace), 0, 0, 1, 1},
    {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 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_iter_namespaces, __pyx_k_iter_namespaces, sizeof(__pyx_k_iter_namespaces), 0, 0, 1, 1},
    {&__pyx_n_s_iterancestors, __pyx_k_iterancestors, sizeof(__pyx_k_iterancestors), 0, 0, 1, 1},
    {&__pyx_n_s_iterattributes, __pyx_k_iterattributes, sizeof(__pyx_k_iterattributes), 0, 0, 1, 1},
    {&__pyx_n_s_iterchildren, __pyx_k_iterchildren, sizeof(__pyx_k_iterchildren), 0, 0, 1, 1},
    {&__pyx_n_s_iterdescendants, __pyx_k_iterdescendants, sizeof(__pyx_k_iterdescendants), 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_u_iterparse, __pyx_k_iterparse, sizeof(__pyx_k_iterparse), 0, 1, 0, 1},
    {&__pyx_n_s_iterparse_makeelement, __pyx_k_iterparse_makeelement, sizeof(__pyx_k_iterparse_makeelement), 0, 0, 1, 1},
    {&__pyx_n_s_iterparse_set_element_class_look, __pyx_k_iterparse_set_element_class_look, sizeof(__pyx_k_iterparse_set_element_class_look), 0, 0, 1, 1},
    {&__pyx_n_s_itersiblings, __pyx_k_itersiblings, sizeof(__pyx_k_itersiblings), 0, 0, 1, 1},
    {&__pyx_n_s_itertext, __pyx_k_itertext, sizeof(__pyx_k_itertext), 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_u_iterwalk, __pyx_k_iterwalk, sizeof(__pyx_k_iterwalk), 0, 1, 0, 1},
    {&__pyx_n_s_iterwalk_skip_subtree, __pyx_k_iterwalk_skip_subtree, sizeof(__pyx_k_iterwalk_skip_subtree), 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_keep_ns_prefixes, __pyx_k_keep_ns_prefixes, sizeof(__pyx_k_keep_ns_prefixes), 0, 0, 1, 1},
    {&__pyx_n_s_keep_tail, __pyx_k_keep_tail, sizeof(__pyx_k_keep_tail), 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_kw, __pyx_k_kw, sizeof(__pyx_k_kw), 0, 0, 1, 1},
    {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
    {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 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_n_s_levels, __pyx_k_levels, sizeof(__pyx_k_levels), 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_kp_u_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 1, 0, 0},
    {&__pyx_n_s_line_2, __pyx_k_line_2, sizeof(__pyx_k_line_2), 0, 0, 1, 1},
    {&__pyx_kp_u_line_3, __pyx_k_line_3, sizeof(__pyx_k_line_3), 0, 1, 0, 0},
    {&__pyx_n_s_lineno, __pyx_k_lineno, sizeof(__pyx_k_lineno), 0, 0, 1, 1},
    {&__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, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
    {&__pyx_n_s_load_dtd, __pyx_k_load_dtd, sizeof(__pyx_k_load_dtd), 0, 0, 1, 1},
    {&__pyx_n_s_loads, __pyx_k_loads, sizeof(__pyx_k_loads), 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_kp_u_lt, __pyx_k_lt, sizeof(__pyx_k_lt), 0, 1, 0, 0},
    {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
    {&__pyx_n_s_lxml_cssselect, __pyx_k_lxml_cssselect, sizeof(__pyx_k_lxml_cssselect), 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_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 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_u_mixed, __pyx_k_mixed, sizeof(__pyx_k_mixed), 0, 1, 0, 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_mro_entries, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1},
    {&__pyx_n_u_mult, __pyx_k_mult, sizeof(__pyx_k_mult), 0, 1, 0, 1},
    {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
    {&__pyx_n_u_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 1, 0, 1},
    {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
    {&__pyx_n_u_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 1, 0, 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, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
    {&__pyx_n_s_new_doc, __pyx_k_new_doc, sizeof(__pyx_k_new_doc), 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_new_namespaces, __pyx_k_new_namespaces, sizeof(__pyx_k_new_namespaces), 0, 0, 1, 1},
    {&__pyx_n_s_new_pos, __pyx_k_new_pos, sizeof(__pyx_k_new_pos), 0, 0, 1, 1},
    {&__pyx_n_u_nmtoken, __pyx_k_nmtoken, sizeof(__pyx_k_nmtoken), 0, 1, 0, 1},
    {&__pyx_n_u_nmtokens, __pyx_k_nmtokens, sizeof(__pyx_k_nmtokens), 0, 1, 0, 1},
    {&__pyx_kp_u_no_content_written, __pyx_k_no_content_written, sizeof(__pyx_k_no_content_written), 0, 1, 0, 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_u_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 1, 0, 1},
    {&__pyx_kp_u_not_allowed_inside_CDATA, __pyx_k_not_allowed_inside_CDATA, sizeof(__pyx_k_not_allowed_inside_CDATA), 0, 1, 0, 0},
    {&__pyx_kp_u_not_found, __pyx_k_not_found, sizeof(__pyx_k_not_found), 0, 1, 0, 0},
    {&__pyx_kp_u_not_found_2, __pyx_k_not_found_2, sizeof(__pyx_k_not_found_2), 0, 1, 0, 0},
    {&__pyx_kp_u_not_in_an_element, __pyx_k_not_in_an_element, sizeof(__pyx_k_not_in_an_element), 0, 1, 0, 0},
    {&__pyx_n_u_notation, __pyx_k_notation, sizeof(__pyx_k_notation), 0, 1, 0, 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_u_ns_d, __pyx_k_ns_d, sizeof(__pyx_k_ns_d), 0, 1, 0, 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_stack, __pyx_k_ns_stack, sizeof(__pyx_k_ns_stack), 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_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
    {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
    {&__pyx_kp_u_object_name, __pyx_k_object_name, sizeof(__pyx_k_object_name), 0, 1, 0, 0},
    {&__pyx_kp_u_occur, __pyx_k_occur, sizeof(__pyx_k_occur), 0, 1, 0, 0},
    {&__pyx_n_s_occur_2, __pyx_k_occur_2, sizeof(__pyx_k_occur_2), 0, 0, 1, 1},
    {&__pyx_kp_u_of_QName, __pyx_k_of_QName, sizeof(__pyx_k_of_QName), 0, 1, 0, 0},
    {&__pyx_kp_u_of_name, __pyx_k_of_name, sizeof(__pyx_k_of_name), 0, 1, 0, 0},
    {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
    {&__pyx_n_s_old, __pyx_k_old, sizeof(__pyx_k_old), 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_old_writer, __pyx_k_old_writer, sizeof(__pyx_k_old_writer), 0, 0, 1, 1},
    {&__pyx_n_u_once, __pyx_k_once, sizeof(__pyx_k_once), 0, 1, 0, 1},
    {&__pyx_kp_u_only_XML_documents_have_declarat, __pyx_k_only_XML_documents_have_declarat, sizeof(__pyx_k_only_XML_documents_have_declarat), 0, 1, 0, 0},
    {&__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_open_utf8_file, __pyx_k_open_utf8_file, sizeof(__pyx_k_open_utf8_file), 0, 0, 1, 1},
    {&__pyx_n_u_opt, __pyx_k_opt, sizeof(__pyx_k_opt), 0, 1, 0, 1},
    {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
    {&__pyx_n_u_or, __pyx_k_or, sizeof(__pyx_k_or), 0, 1, 0, 1},
    {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
    {&__pyx_n_s_other_element, __pyx_k_other_element, sizeof(__pyx_k_other_element), 0, 0, 1, 1},
    {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 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_u_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 0, 1, 0, 1},
    {&__pyx_n_s_parseXSL, __pyx_k_parseXSL, sizeof(__pyx_k_parseXSL), 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_u_parseid, __pyx_k_parseid, sizeof(__pyx_k_parseid), 0, 1, 0, 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_n_s_partial, __pyx_k_partial, sizeof(__pyx_k_partial), 0, 0, 1, 1},
    {&__pyx_kp_u_passing_a_single_string_into_fro, __pyx_k_passing_a_single_string_into_fro, sizeof(__pyx_k_passing_a_single_string_into_fro), 0, 1, 0, 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_u_pcdata, __pyx_k_pcdata, sizeof(__pyx_k_pcdata), 0, 1, 0, 1},
    {&__pyx_kp_u_pending_open_tags_on_close, __pyx_k_pending_open_tags_on_close, sizeof(__pyx_k_pending_open_tags_on_close), 0, 1, 0, 0},
    {&__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_pi_factory, __pyx_k_pi_factory, sizeof(__pyx_k_pi_factory), 0, 0, 1, 1},
    {&__pyx_n_u_plus, __pyx_k_plus, sizeof(__pyx_k_plus), 0, 1, 0, 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_kp_u_prefix_2, __pyx_k_prefix_2, sizeof(__pyx_k_prefix_2), 0, 1, 0, 0},
    {&__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_u_preserve, __pyx_k_preserve, sizeof(__pyx_k_preserve), 0, 1, 0, 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_process_children, __pyx_k_process_children, sizeof(__pyx_k_process_children), 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_property, __pyx_k_property, sizeof(__pyx_k_property), 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_pyucs4_encoding_name, __pyx_k_pyucs4_encoding_name, sizeof(__pyx_k_pyucs4_encoding_name), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
    {&__pyx_n_s_qname_aware_attrs, __pyx_k_qname_aware_attrs, sizeof(__pyx_k_qname_aware_attrs), 0, 0, 1, 1},
    {&__pyx_n_s_qname_aware_tags, __pyx_k_qname_aware_tags, sizeof(__pyx_k_qname_aware_tags), 0, 0, 1, 1},
    {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
    {&__pyx_kp_u_quot, __pyx_k_quot, sizeof(__pyx_k_quot), 0, 1, 0, 0},
    {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
    {&__pyx_n_s_raise_on_error, __pyx_k_raise_on_error, sizeof(__pyx_k_raise_on_error), 0, 0, 1, 1},
    {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
    {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
    {&__pyx_n_s_rclose, __pyx_k_rclose, sizeof(__pyx_k_rclose), 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_u_reading_file_objects_must_return, __pyx_k_reading_file_objects_must_return, sizeof(__pyx_k_reading_file_objects_must_return), 0, 1, 0, 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, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1},
    {&__pyx_n_s_register_namespace, __pyx_k_register_namespace, sizeof(__pyx_k_register_namespace), 0, 0, 1, 1},
    {&__pyx_n_u_register_namespace, __pyx_k_register_namespace, sizeof(__pyx_k_register_namespace), 0, 1, 0, 1},
    {&__pyx_n_s_register_namespaces, __pyx_k_register_namespaces, sizeof(__pyx_k_register_namespaces), 0, 0, 1, 1},
    {&__pyx_n_s_registry, __pyx_k_registry, sizeof(__pyx_k_registry), 0, 0, 1, 1},
    {&__pyx_n_s_relaxng, __pyx_k_relaxng, sizeof(__pyx_k_relaxng), 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_u_required, __pyx_k_required, sizeof(__pyx_k_required), 0, 1, 0, 1},
    {&__pyx_n_s_resolve, __pyx_k_resolve, sizeof(__pyx_k_resolve), 0, 0, 1, 1},
    {&__pyx_n_s_resolve_empty, __pyx_k_resolve_empty, sizeof(__pyx_k_resolve_empty), 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_resolve_external_entities, __pyx_k_resolve_external_entities, sizeof(__pyx_k_resolve_external_entities), 0, 0, 1, 1},
    {&__pyx_n_s_resolve_file, __pyx_k_resolve_file, sizeof(__pyx_k_resolve_file), 0, 0, 1, 1},
    {&__pyx_n_s_resolve_filename, __pyx_k_resolve_filename, sizeof(__pyx_k_resolve_filename), 0, 0, 1, 1},
    {&__pyx_n_s_resolve_string, __pyx_k_resolve_string, sizeof(__pyx_k_resolve_string), 0, 0, 1, 1},
    {&__pyx_n_s_resolver, __pyx_k_resolver, sizeof(__pyx_k_resolver), 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_n_s_result_doc, __pyx_k_result_doc, sizeof(__pyx_k_result_doc), 0, 0, 1, 1},
    {&__pyx_n_s_result_list, __pyx_k_result_list, sizeof(__pyx_k_result_list), 0, 0, 1, 1},
    {&__pyx_n_s_result_node, __pyx_k_result_node, sizeof(__pyx_k_result_node), 0, 0, 1, 1},
    {&__pyx_kp_u_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, 1, 0, 0},
    {&__pyx_n_s_result_tree, __pyx_k_result_tree, sizeof(__pyx_k_result_tree), 0, 0, 1, 1},
    {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
    {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
    {&__pyx_n_s_reversed_2, __pyx_k_reversed_2, sizeof(__pyx_k_reversed_2), 0, 0, 1, 1},
    {&__pyx_n_s_reversed_nsmap, __pyx_k_reversed_nsmap, sizeof(__pyx_k_reversed_nsmap), 0, 0, 1, 1},
    {&__pyx_n_s_rewrite_prefixes, __pyx_k_rewrite_prefixes, sizeof(__pyx_k_rewrite_prefixes), 0, 0, 1, 1},
    {&__pyx_n_s_rexp, __pyx_k_rexp, sizeof(__pyx_k_rexp), 0, 0, 1, 1},
    {&__pyx_n_s_rexpc, __pyx_k_rexpc, sizeof(__pyx_k_rexpc), 0, 0, 1, 1},
    {&__pyx_kp_u_rnc, __pyx_k_rnc, sizeof(__pyx_k_rnc), 0, 1, 0, 0},
    {&__pyx_n_s_rnc2rng, __pyx_k_rnc2rng, sizeof(__pyx_k_rnc2rng), 0, 0, 1, 1},
    {&__pyx_n_s_rng_str, __pyx_k_rng_str, sizeof(__pyx_k_rng_str), 0, 0, 1, 1},
    {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
    {&__pyx_n_s_rsplit, __pyx_k_rsplit, sizeof(__pyx_k_rsplit), 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_href_s_s, __pyx_k_s_href_s_s, sizeof(__pyx_k_s_href_s_s), 0, 1, 0, 0},
    {&__pyx_n_s_s_match, __pyx_k_s_match, sizeof(__pyx_k_s_match), 0, 0, 1, 1},
    {&__pyx_kp_u_s_r, __pyx_k_s_r, sizeof(__pyx_k_s_r), 0, 1, 0, 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_b_script, __pyx_k_script, sizeof(__pyx_k_script), 0, 0, 0, 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_u_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 0, 1, 0, 1},
    {&__pyx_n_s_sequence_or_dict, __pyx_k_sequence_or_dict, sizeof(__pyx_k_sequence_or_dict), 0, 0, 1, 1},
    {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 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_u_set_default_parser, __pyx_k_set_default_parser, sizeof(__pyx_k_set_default_parser), 0, 1, 0, 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_u_set_element_class_lookup, __pyx_k_set_element_class_lookup, sizeof(__pyx_k_set_element_class_lookup), 0, 1, 0, 1},
    {&__pyx_n_s_set_fallback, __pyx_k_set_fallback, sizeof(__pyx_k_set_fallback), 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_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1},
    {&__pyx_n_s_setitem, __pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 0, 1, 1},
    {&__pyx_n_s_setroot, __pyx_k_setroot, sizeof(__pyx_k_setroot), 0, 0, 1, 1},
    {&__pyx_n_s_setter, __pyx_k_setter, sizeof(__pyx_k_setter), 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_show, __pyx_k_show, sizeof(__pyx_k_show), 0, 0, 1, 1},
    {&__pyx_n_s_sio, __pyx_k_sio, sizeof(__pyx_k_sio), 0, 0, 1, 1},
    {&__pyx_n_s_skip_subtree, __pyx_k_skip_subtree, sizeof(__pyx_k_skip_subtree), 0, 0, 1, 1},
    {&__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_space, __pyx_k_space, sizeof(__pyx_k_space), 0, 0, 1, 1},
    {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
    {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
    {&__pyx_n_s_splitlines, __pyx_k_splitlines, sizeof(__pyx_k_splitlines), 0, 0, 1, 1},
    {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1},
    {&__pyx_kp_s_src_lxml_classlookup_pxi, __pyx_k_src_lxml_classlookup_pxi, sizeof(__pyx_k_src_lxml_classlookup_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_cleanup_pxi, __pyx_k_src_lxml_cleanup_pxi, sizeof(__pyx_k_src_lxml_cleanup_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_debug_pxi, __pyx_k_src_lxml_debug_pxi, sizeof(__pyx_k_src_lxml_debug_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_docloader_pxi, __pyx_k_src_lxml_docloader_pxi, sizeof(__pyx_k_src_lxml_docloader_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_dtd_pxi, __pyx_k_src_lxml_dtd_pxi, sizeof(__pyx_k_src_lxml_dtd_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_etree_pyx, __pyx_k_src_lxml_etree_pyx, sizeof(__pyx_k_src_lxml_etree_pyx), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_extensions_pxi, __pyx_k_src_lxml_extensions_pxi, sizeof(__pyx_k_src_lxml_extensions_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_iterparse_pxi, __pyx_k_src_lxml_iterparse_pxi, sizeof(__pyx_k_src_lxml_iterparse_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_k_src_lxml_nsclasses_pxi, sizeof(__pyx_k_src_lxml_nsclasses_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_parser_pxi, __pyx_k_src_lxml_parser_pxi, sizeof(__pyx_k_src_lxml_parser_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_parsertarget_pxi, __pyx_k_src_lxml_parsertarget_pxi, sizeof(__pyx_k_src_lxml_parsertarget_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_k_src_lxml_readonlytree_pxi, sizeof(__pyx_k_src_lxml_readonlytree_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_relaxng_pxi, __pyx_k_src_lxml_relaxng_pxi, sizeof(__pyx_k_src_lxml_relaxng_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_saxparser_pxi, __pyx_k_src_lxml_saxparser_pxi, sizeof(__pyx_k_src_lxml_saxparser_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_serializer_pxi, __pyx_k_src_lxml_serializer_pxi, sizeof(__pyx_k_src_lxml_serializer_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_k_src_lxml_xmlerror_pxi, sizeof(__pyx_k_src_lxml_xmlerror_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_xmlid_pxi, __pyx_k_src_lxml_xmlid_pxi, sizeof(__pyx_k_src_lxml_xmlid_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_xpath_pxi, __pyx_k_src_lxml_xpath_pxi, sizeof(__pyx_k_src_lxml_xpath_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_xslt_pxi, __pyx_k_src_lxml_xslt_pxi, sizeof(__pyx_k_src_lxml_xslt_pxi), 0, 0, 1, 0},
    {&__pyx_kp_s_src_lxml_xsltext_pxi, __pyx_k_src_lxml_xsltext_pxi, sizeof(__pyx_k_src_lxml_xsltext_pxi), 0, 0, 1, 0},
    {&__pyx_n_s_stacklevel, __pyx_k_stacklevel, sizeof(__pyx_k_stacklevel), 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_u_start_ns, __pyx_k_start_ns, sizeof(__pyx_k_start_ns), 0, 1, 0, 0},
    {&__pyx_n_s_start_ns_2, __pyx_k_start_ns_2, sizeof(__pyx_k_start_ns_2), 0, 0, 1, 1},
    {&__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_str1, __pyx_k_str1, sizeof(__pyx_k_str1), 0, 0, 1, 1},
    {&__pyx_n_s_str2, __pyx_k_str2, sizeof(__pyx_k_str2), 0, 0, 1, 1},
    {&__pyx_n_s_str3, __pyx_k_str3, sizeof(__pyx_k_str3), 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, __pyx_k_string___STRING__XSLT, sizeof(__pyx_k_string___STRING__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_u_strip_attributes, __pyx_k_strip_attributes, sizeof(__pyx_k_strip_attributes), 0, 1, 0, 1},
    {&__pyx_n_s_strip_cdata, __pyx_k_strip_cdata, sizeof(__pyx_k_strip_cdata), 0, 0, 1, 1},
    {&__pyx_n_s_strip_elements, __pyx_k_strip_elements, sizeof(__pyx_k_strip_elements), 0, 0, 1, 1},
    {&__pyx_n_u_strip_elements, __pyx_k_strip_elements, sizeof(__pyx_k_strip_elements), 0, 1, 0, 1},
    {&__pyx_n_s_strip_tags, __pyx_k_strip_tags, sizeof(__pyx_k_strip_tags), 0, 0, 1, 1},
    {&__pyx_n_u_strip_tags, __pyx_k_strip_tags, sizeof(__pyx_k_strip_tags), 0, 1, 0, 1},
    {&__pyx_n_s_strip_text, __pyx_k_strip_text, sizeof(__pyx_k_strip_text), 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_b_style, __pyx_k_style, sizeof(__pyx_k_style), 0, 0, 0, 1},
    {&__pyx_n_s_style, __pyx_k_style, sizeof(__pyx_k_style), 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_u_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 1, 0, 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_u_text_root, __pyx_k_text_root, sizeof(__pyx_k_text_root), 0, 1, 0, 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_kp_u_to_extended_slice_of_size, __pyx_k_to_extended_slice_of_size, sizeof(__pyx_k_to_extended_slice_of_size), 0, 1, 0, 0},
    {&__pyx_n_s_top_nsmap, __pyx_k_top_nsmap, sizeof(__pyx_k_top_nsmap), 0, 0, 1, 1},
    {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
    {&__pyx_n_u_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 1, 0, 1},
    {&__pyx_n_s_tostringlist, __pyx_k_tostringlist, sizeof(__pyx_k_tostringlist), 0, 0, 1, 1},
    {&__pyx_n_u_tostringlist, __pyx_k_tostringlist, sizeof(__pyx_k_tostringlist), 0, 1, 0, 1},
    {&__pyx_n_s_tounicode, __pyx_k_tounicode, sizeof(__pyx_k_tounicode), 0, 0, 1, 1},
    {&__pyx_n_u_tounicode, __pyx_k_tounicode, sizeof(__pyx_k_tounicode), 0, 1, 0, 1},
    {&__pyx_n_s_translator, __pyx_k_translator, sizeof(__pyx_k_translator), 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_kp_u_type_2, __pyx_k_type_2, sizeof(__pyx_k_type_2), 0, 1, 0, 0},
    {&__pyx_kp_u_type_3, __pyx_k_type_3, sizeof(__pyx_k_type_3), 0, 1, 0, 0},
    {&__pyx_n_s_type_name, __pyx_k_type_name, sizeof(__pyx_k_type_name), 0, 0, 1, 1},
    {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 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_u_undefined, __pyx_k_undefined, sizeof(__pyx_k_undefined), 0, 1, 0, 1},
    {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1},
    {&__pyx_n_u_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 1, 0, 1},
    {&__pyx_kp_u_unknown_encoding, __pyx_k_unknown_encoding, sizeof(__pyx_k_unknown_encoding), 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_2, __pyx_k_unknown_error_2, sizeof(__pyx_k_unknown_error_2), 0, 1, 0, 0},
    {&__pyx_kp_u_unknown_output_method, __pyx_k_unknown_output_method, sizeof(__pyx_k_unknown_output_method), 0, 1, 0, 0},
    {&__pyx_kp_u_unsupported_XSLT_result_type, __pyx_k_unsupported_XSLT_result_type, sizeof(__pyx_k_unsupported_XSLT_result_type), 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_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
    {&__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_u_use_global_python_log, __pyx_k_use_global_python_log, sizeof(__pyx_k_use_global_python_log), 0, 1, 0, 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_variables_2, __pyx_k_variables_2, sizeof(__pyx_k_variables_2), 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_u_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 1, 0, 1},
    {&__pyx_kp_u_w_w, __pyx_k_w_w, sizeof(__pyx_k_w_w), 0, 1, 0, 0},
    {&__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_u_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 0, 1},
    {&__pyx_n_s_with_comments, __pyx_k_with_comments, sizeof(__pyx_k_with_comments), 0, 0, 1, 1},
    {&__pyx_n_s_with_prefixes, __pyx_k_with_prefixes, sizeof(__pyx_k_with_prefixes), 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_u_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 1, 0, 1},
    {&__pyx_n_s_write_c14n, __pyx_k_write_c14n, sizeof(__pyx_k_write_c14n), 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_doctype, __pyx_k_write_doctype, sizeof(__pyx_k_write_doctype), 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_write_output, __pyx_k_write_output, sizeof(__pyx_k_write_output), 0, 0, 1, 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_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1},
    {&__pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9, __pyx_k_x20_x0D_x0Aa_zA_Z0_9, sizeof(__pyx_k_x20_x0D_x0Aa_zA_Z0_9), 0, 1, 0, 0},
    {&__pyx_kp_u_x9, __pyx_k_x9, sizeof(__pyx_k_x9), 0, 1, 0, 0},
    {&__pyx_kp_u_xA, __pyx_k_xA, sizeof(__pyx_k_xA), 0, 1, 0, 0},
    {&__pyx_kp_u_xD, __pyx_k_xD, sizeof(__pyx_k_xD), 0, 1, 0, 0},
    {&__pyx_n_s_xinclude, __pyx_k_xinclude, sizeof(__pyx_k_xinclude), 0, 0, 1, 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_data, __pyx_k_xml_data, sizeof(__pyx_k_xml_data), 0, 0, 1, 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_kp_u_xml_xml, __pyx_k_xml_xml, sizeof(__pyx_k_xml_xml), 0, 1, 0, 0},
    {&__pyx_n_s_xmlfile, __pyx_k_xmlfile, sizeof(__pyx_k_xmlfile), 0, 0, 1, 1},
    {&__pyx_n_s_xmlfile___aenter, __pyx_k_xmlfile___aenter, sizeof(__pyx_k_xmlfile___aenter), 0, 0, 1, 1},
    {&__pyx_n_s_xmlfile___aexit, __pyx_k_xmlfile___aexit, sizeof(__pyx_k_xmlfile___aexit), 0, 0, 1, 1},
    {&__pyx_n_s_xmlfile___enter, __pyx_k_xmlfile___enter, sizeof(__pyx_k_xmlfile___enter), 0, 0, 1, 1},
    {&__pyx_n_s_xmlfile___exit, __pyx_k_xmlfile___exit, sizeof(__pyx_k_xmlfile___exit), 0, 0, 1, 1},
    {&__pyx_kp_u_xmlns, __pyx_k_xmlns, sizeof(__pyx_k_xmlns), 0, 1, 0, 0},
    {&__pyx_n_b_xmlns_2, __pyx_k_xmlns_2, sizeof(__pyx_k_xmlns_2), 0, 0, 0, 1},
    {&__pyx_n_u_xmlns_2, __pyx_k_xmlns_2, sizeof(__pyx_k_xmlns_2), 0, 1, 0, 1},
    {&__pyx_n_s_xmlschema, __pyx_k_xmlschema, sizeof(__pyx_k_xmlschema), 0, 0, 1, 1},
    {&__pyx_n_s_xpath, __pyx_k_xpath, sizeof(__pyx_k_xpath), 0, 0, 1, 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, __pyx_k_xslt, sizeof(__pyx_k_xslt), 0, 0, 1, 1},
    {&__pyx_kp_u_xslt_2, __pyx_k_xslt_2, sizeof(__pyx_k_xslt_2), 0, 1, 0, 0},
    {&__pyx_n_s_xslt_3, __pyx_k_xslt_3, sizeof(__pyx_k_xslt_3), 0, 0, 1, 1},
    {&__pyx_n_s_xslt_input, __pyx_k_xslt_input, sizeof(__pyx_k_xslt_input), 0, 0, 1, 1},
    {&__pyx_n_s_zf, __pyx_k_zf, sizeof(__pyx_k_zf), 0, 0, 1, 1},
    {0, 0, 0, 0, 0, 0, 0}
  };
  return __Pyx_InitStrings(__pyx_string_tab);
}
/* #### Code section: cached_builtins ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_SyntaxError = __Pyx_GetBuiltinName(__pyx_n_s_SyntaxError); if (!__pyx_builtin_SyntaxError) __PYX_ERR(0, 226, __pyx_L1_error)
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 270, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(1, 814, __pyx_L1_error)
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(2, 18, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(3, 3, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(4, 6, __pyx_L1_error)
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(5, 437, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 93, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 193, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 216, __pyx_L1_error)
  __pyx_builtin_BaseException = __Pyx_GetBuiltinName(__pyx_n_s_BaseException); if (!__pyx_builtin_BaseException) __PYX_ERR(0, 329, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(6, 238, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(7, 26, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(7, 48, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(7, 410, __pyx_L1_error)
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(7, 1043, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(7, 1043, __pyx_L1_error)
  #endif
  __pyx_builtin_UnicodeEncodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeEncodeError); if (!__pyx_builtin_UnicodeEncodeError) __PYX_ERR(7, 1595, __pyx_L1_error)
  __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(7, 1613, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 318, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 778, __pyx_L1_error)
  __pyx_builtin_FutureWarning = __Pyx_GetBuiltinName(__pyx_n_s_FutureWarning); if (!__pyx_builtin_FutureWarning) __PYX_ERR(0, 1217, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 1888, __pyx_L1_error)
  __pyx_builtin_DeprecationWarning = __Pyx_GetBuiltinName(__pyx_n_s_DeprecationWarning); if (!__pyx_builtin_DeprecationWarning) __PYX_ERR(0, 2092, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 2638, __pyx_L1_error)
  __pyx_builtin_ReferenceError = __Pyx_GetBuiltinName(__pyx_n_s_ReferenceError); if (!__pyx_builtin_ReferenceError) __PYX_ERR(8, 18, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(9, 52, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(2, 670, __pyx_L1_error)
  __pyx_builtin_LookupError = __Pyx_GetBuiltinName(__pyx_n_s_LookupError); if (!__pyx_builtin_LookupError) __PYX_ERR(2, 858, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(3, 548, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(10, 691, __pyx_L1_error)
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(10, 1122, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(11, 629, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "lxml/etree.pyx":193
 *     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_u_Prefix_format_reserved_for_inter); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "lxml/etree.pyx":198
 *     if (uri_utf == b"http://www.w3.org/XML/1998/namespace" and prefix_utf != b'xml'
 *             or prefix_utf == b'xml' and uri_utf != b"http://www.w3.org/XML/1998/namespace"):
 *         raise ValueError("Cannot change the 'xml' prefix of the XML namespace")             # <<<<<<<<<<<<<<
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Cannot_change_the_xml_prefix_of); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "lxml/etree.pyx":237
 * cdef tuple __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace('-', '.').split('.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_u__3, __pyx_kp_u__4); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
  __pyx_slice__6 = PySlice_New(Py_None, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__6);
  __Pyx_GIVEREF(__pyx_slice__6);

  /* "lxml/etree.pyx":243
 *         except ValueError:
 *             if item.startswith('dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith('alpha'):
 */
  __pyx_slice__7 = PySlice_New(__pyx_int_3, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__7);
  __Pyx_GIVEREF(__pyx_slice__7);

  /* "lxml/etree.pyx":246
 *                 item = -300
 *             elif item.startswith('alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith('beta'):
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_5, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "lxml/etree.pyx":249
 *                 item = -200
 *             elif item.startswith('beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
 */
  __pyx_slice__9 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__9)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__9);
  __Pyx_GIVEREF(__pyx_slice__9);

  /* "src/lxml/proxy.pxi":600
 *     """
 *     if c_doc is NULL:
 *         raise ValueError("Illegal document provided: NULL")             # <<<<<<<<<<<<<<
 *     if c_doc.type not in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         doc_type = c_doc.type
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Illegal_document_provided_NULL); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(6, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "src/lxml/apihelpers.pxi":1343
 *     # prevent cycles
 *     if _isAncestorOrSame(c_node, parent._c_node):
 *         raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_cannot_append_parent_to_itself); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(7, 1343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "src/lxml/apihelpers.pxi":1397
 *         if element._c_node is c_node:
 *             return 0  # nothing to do
 *         raise ValueError("cannot add ancestor as sibling, please break cycle first")             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_cannot_add_ancestor_as_sibling_p); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(7, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "src/lxml/apihelpers.pxi":1530
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if not valid:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_All_strings_must_be_XML_compatib); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(7, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "src/lxml/apihelpers.pxi":1599
 *         return filename8
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_Argument_must_be_string_or_unico); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(7, 1599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "src/lxml/xmlerror.pxi":602
 *     except KeyError:
 *         log = (<object>thread_dict)[name] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_int_100); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "lxml/etree.pyx":628
 *                 # enclosed in single quotes or quotes.
 *                 if b"'" in bvalue and b'"' in bvalue:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'System URL may not contain both single (\') and double quotes (").')
 *                 c_value = tree.xmlStrdup(_xcstr(bvalue))
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_u_System_URL_may_not_contain_both); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "lxml/etree.pyx":1214
 *         """__bool__(self)"""
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             "The behavior of this method will change in future versions. "
 *             "Use specific 'len(elem)' or 'elem is not None' test instead.",
 */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_kp_u_The_behavior_of_this_method_will, __pyx_builtin_FutureWarning); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "lxml/etree.pyx":2049
 *         if method in ('c14n', 'c14n2'):
 *             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__36 = PyTuple_Pack(1, __pyx_kp_u_Cannot_specify_encoding_with_C14); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 2049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "lxml/etree.pyx":2051
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 * 
 *             if method == 'c14n':
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_u_Cannot_enable_XML_declaration_in); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "lxml/etree.pyx":2057
 *                                 compression, inclusive_ns_prefixes)
 *             else:  # c14n2
 *                 with _open_utf8_file(file, compression=compression) as f:             # <<<<<<<<<<<<<<
 *                     target = C14NWriterTarget(
 *                         f.write, with_comments=with_comments, strip_text=strip_text)
 */
  __pyx_tuple__38 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 2057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "lxml/etree.pyx":2064
 * 
 *         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__39 = PyTuple_Pack(1, __pyx_kp_u_Can_only_discard_comments_in_C14); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 2064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "lxml/etree.pyx":2090
 *         if docstring is not None and doctype is None:
 *             import warnings
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 "The 'docstring' option is deprecated. Use 'doctype' instead.",
 *                 DeprecationWarning)
 */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_kp_u_The_docstring_option_is_deprecat, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "lxml/etree.pyx":2256
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *                 from warnings import warn
 */
  __pyx_slice__44 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__44)) __PYX_ERR(0, 2256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__44);
  __Pyx_GIVEREF(__pyx_slice__44);

  /* "lxml/etree.pyx":3039
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = ("start", "comment", "pi", "end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = ("start",)
 */
  __pyx_tuple__46 = PyTuple_Pack(4, __pyx_n_u_start, __pyx_n_u_comment, __pyx_n_u_pi, __pyx_n_u_end); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 3039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "lxml/etree.pyx":3041
 *             events = ("start", "comment", "pi", "end")
 *         else:
 *             events = ("start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._events = iterwalk(element, events=events, tag=tag)
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_u_start); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 3041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "lxml/etree.pyx":3111
 *         text = _utf8(text)
 *         if b'--' in text or text.endswith(b'-'):
 *             raise ValueError("Comment may not contain '--' or end with '-'")             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _newXMLDoc()
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_Comment_may_not_contain_or_end_w); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "lxml/etree.pyx":3324
 *     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__51 = PyTuple_Pack(1, __pyx_kp_u_passing_a_single_string_into_fro); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 3324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "lxml/etree.pyx":3481
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if strip_text:
 *         raise ValueError("Can only strip text in C14N 2.0 serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is unicode or (encoding is not None and encoding.lower() == 'unicode'):
 *         if xml_declaration:
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_u_Can_only_strip_text_in_C14N_2_0); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 3481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "src/lxml/readonlytree.pxi":18
 *         """
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_u_Proxy_invalidated); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(8, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "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__55 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__55)) __PYX_ERR(8, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__55);
  __Pyx_GIVEREF(__pyx_slice__55);

  /* "src/lxml/parser.pxi":1663
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_u_end); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 1663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "src/lxml/parser.pxi":1984
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Unicode strings with encoding declaration are not supported. "
 *                 "Please use bytes input or XML fragments without declaration.")
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_u_Unicode_strings_with_encoding_de); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "src/lxml/saxparser.pxi":552
 *             context._target._handleSaxEndNs(prefix_uri[0])
 *         if build_events:
 *             context.events_iterator._events.append(('end-ns', None))             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
  __pyx_tuple__60 = PyTuple_Pack(2, __pyx_kp_u_end_ns, Py_None); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(3, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "src/lxml/serializer.pxi":876
 *     """
 *     if xml_data is None and from_file is None:
 *         raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")             # <<<<<<<<<<<<<<
 * 
 *     sio = None
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_u_Either_xml_data_or_from_file_mus); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(10, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "src/lxml/serializer.pxi":907
 * 
 * cdef _tree_to_target(element, target):
 *     for event, elem in iterwalk(element, events=('start', 'end', 'start-ns', 'comment', 'pi')):             # <<<<<<<<<<<<<<
 *         text = None
 *         if event == 'start':
 */
  __pyx_tuple__65 = PyTuple_Pack(5, __pyx_n_u_start, __pyx_n_u_end, __pyx_kp_u_start_ns, __pyx_n_u_comment, __pyx_n_u_pi); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(10, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "src/lxml/serializer.pxi":991
 *         # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
 *         self._declared_ns_stack = [[
 *             ("http://www.w3.org/XML/1998/namespace", "xml"),             # <<<<<<<<<<<<<<
 *         ]]
 *         # Stack with user declared namespace prefixes as (uri, prefix) pairs.
 */
  __pyx_tuple__66 = PyTuple_Pack(2, __pyx_kp_u_http_www_w3_org_XML_1998_namespa, __pyx_n_u_xml); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(10, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "src/lxml/serializer.pxi":1011
 * 
 *     cdef _resolve_prefix_name(self, prefixed_name):
 *         prefix, name = prefixed_name.split(':', 1)             # <<<<<<<<<<<<<<
 *         for uri, p in self._iter_namespaces(self._ns_stack):
 *             if p == prefix:
 */
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_kp_u__17, __pyx_int_1); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(10, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "src/lxml/serializer.pxi":1019
 *     cdef _qname(self, qname, uri=None):
 *         if uri is None:
 *             uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)             # <<<<<<<<<<<<<<
 *         else:
 *             tag = qname
 */
  __pyx_slice__69 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__69)) __PYX_ERR(10, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__69);
  __Pyx_GIVEREF(__pyx_slice__69);
  __pyx_tuple__70 = PyTuple_Pack(2, __pyx_kp_u__19, __pyx_int_1); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(10, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "src/lxml/serializer.pxi":1362
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 *             raise TypeError("Cannot asynchronously write to a plain file")             # <<<<<<<<<<<<<<
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_u_Cannot_asynchronously_write_to_a); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(10, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "src/lxml/serializer.pxi":1364
 *             raise TypeError("Cannot asynchronously write to a plain file")
 *         if not hasattr(self.output_file, 'write'):
 *             raise TypeError("Output file needs an async .write() method")             # <<<<<<<<<<<<<<
 *         self.async_writer = _AsyncIncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel,
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_kp_u_Output_file_needs_an_async_write); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(10, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "src/lxml/serializer.pxi":1565
 *         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__80 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__80)) __PYX_ERR(10, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__80);
  __Pyx_GIVEREF(__pyx_slice__80);

  /* "src/lxml/serializer.pxi":1573
 *         ok_to_write = self._c_out.error == xmlerror.XML_ERR_OK
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         if ok_to_write:
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 */
  __pyx_slice__81 = PySlice_New(__pyx_int_1, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__81)) __PYX_ERR(10, 1573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__81);
  __Pyx_GIVEREF(__pyx_slice__81);

  /* "src/lxml/iterparse.pxi":221
 *         if not isinstance(data, bytes):
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")             # <<<<<<<<<<<<<<
 *         if not data:
 *             try:
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_kp_u_reading_file_objects_must_return); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(14, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath('//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_u_string_id); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(15, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "src/lxml/xmlid.pxi":114
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return self._keys[:]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_slice__93 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__93)) __PYX_ERR(15, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__93);
  __Pyx_GIVEREF(__pyx_slice__93);

  /* "src/lxml/xpath.pxi":480
 *                 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__94 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__94)) __PYX_ERR(18, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__94);
  __Pyx_GIVEREF(__pyx_slice__94);

  /* "src/lxml/xslt.pxi":468
 *         """
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")             # <<<<<<<<<<<<<<
 *         xslt.xsltMaxDepth = max_depth
 * 
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_kp_u_cannot_set_a_maximum_stylesheet); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(5, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "src/lxml/xslt.pxi":868
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             "//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={"xsl" : "http://www.w3.org/1999/XSL/Transform"})
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_kp_u_xsl_stylesheet_xml_id_id); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(5, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "src/lxml/dtd.pxi":374
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             raise DTDError("Failed to create validation context")             # <<<<<<<<<<<<<<
 * 
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_create_validation_cont); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(20, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "src/lxml/relaxng.pxi":13
 * cdef int _require_rnc2rng() except -1:
 *     if _rnc2rng is None:
 *         raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *             'compact syntax not supported (please install rnc2rng)')
 *     return 0
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_kp_u_compact_syntax_not_supported_ple); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(21, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 if file[-4:].lower() == '.rnc':             # <<<<<<<<<<<<<<
 *                     _require_rnc2rng()
 *                     rng_data_utf8 = _utf8(_rnc2rng.dumps(_rnc2rng.load(file)))
 */
  __pyx_slice__105 = PySlice_New(__pyx_int_neg_4, Py_None, Py_None); if (unlikely(!__pyx_slice__105)) __PYX_ERR(21, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__105);
  __Pyx_GIVEREF(__pyx_slice__105);

  /* "lxml/etree.pyx":92
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_tuple__107 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_key); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getitem, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 92, __pyx_L1_error)

  /* "lxml/etree.pyx":95
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_tuple__109 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_setitem, 95, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(0, 95, __pyx_L1_error)

  /* "lxml/etree.pyx":98
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_delitem, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 98, __pyx_L1_error)

  /* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_contains, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(0, 101, __pyx_L1_error)

  /* "lxml/etree.pyx":104
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_tuple__113 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_len, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 104, __pyx_L1_error)

  /* "lxml/etree.pyx":107
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iter_2, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 107, __pyx_L1_error)

  /* "lxml/etree.pyx":150
 * 
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode("UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 * 
 */
  __pyx_tuple__116 = PyTuple_Pack(1, __pyx_kp_u_UTF_8); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);

  /* "lxml/etree.pyx":183
 * _update_default_namespace_prefixes_items()
 * 
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_tuple__117 = PyTuple_Pack(1, __pyx_kp_b_ns_d_2); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);

  /* "lxml/etree.pyx":185
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */
  __pyx_tuple__118 = 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__118)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_register_namespace, 185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 185, __pyx_L1_error)

  /* "lxml/etree.pyx":268
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 */
  __pyx_tuple__120 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);

  /* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
 */
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_clear_error_log_2, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(1, 11, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":194
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 */
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_copy, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(1, 194, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_tuple__123 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);
  __pyx_codeobj__124 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_receive, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__124)) __PYX_ERR(1, 200, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
 */
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_copy, 290, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(1, 290, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """Filter the errors by the given domains and return a new error log
 *         containing the matches.
 */
  __pyx_tuple__126 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_domains, __pyx_n_s_entry, __pyx_n_s_filtered, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(1, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_domains, 328, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(1, 328, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
 */
  __pyx_tuple__128 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_types, __pyx_n_s_entry, __pyx_n_s_filtered, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_types, 338, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(1, 338, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
 */
  __pyx_tuple__130 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_levels, __pyx_n_s_entry, __pyx_n_s_filtered, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_levels, 350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(1, 350, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
 */
  __pyx_tuple__132 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_level, __pyx_n_s_entry, __pyx_n_s_filtered, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(1, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);
  __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_from_level, 362, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(1, 362, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
 */
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_from_fatals, 371, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(1, 371, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
 */
  __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_from_errors, 378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(1, 378, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
 */
  __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_filter_from_warnings, 385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(1, 385, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":444
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
 */
  __pyx_tuple__137 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_args); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);
  __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_exit, 444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(1, 444, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":464
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
 */
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_clear, 464, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(1, 464, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
 */
  __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_copy, 470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(1, 470, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":480
 *         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
 */
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_receive, 480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(1, 480, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":490
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
 */
  __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_receive, 490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(1, 490, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":500
 *         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
 */
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_receive, 500, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(1, 500, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
 */
  __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_copy, 551, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(1, 551, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
 */
  __pyx_tuple__145 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_log_entry, __pyx_n_s_message, __pyx_n_s_args); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(1, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_log, 556, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(1, 556, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
 */
  __pyx_tuple__147 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log_entry); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);
  __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_receive, 573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(1, 573, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
 */
  __pyx_tuple__149 = PyTuple_Pack(1, __pyx_n_s_log); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(1, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__149);
  __Pyx_GIVEREF(__pyx_tuple__149);
  __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlerror_pxi, __pyx_n_s_use_global_python_log, 623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(1, 623, __pyx_L1_error)

  /* "src/lxml/xmlerror.pxi":814
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error levels"""
 * 
 */
  __pyx_tuple__151 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__151);
  __Pyx_GIVEREF(__pyx_tuple__151);
  __pyx_tuple__152 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__152)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__152);
  __Pyx_GIVEREF(__pyx_tuple__152);

  /* "src/lxml/xmlerror.pxi":817
 *     """Libxml2 error levels"""
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error domains"""
 * 
 */
  __pyx_tuple__153 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__153);
  __Pyx_GIVEREF(__pyx_tuple__153);
  __pyx_tuple__154 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);

  /* "src/lxml/xmlerror.pxi":820
 *     """Libxml2 error domains"""
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error types"""
 * 
 */
  __pyx_tuple__155 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__155);
  __Pyx_GIVEREF(__pyx_tuple__155);
  __pyx_tuple__156 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__156);
  __Pyx_GIVEREF(__pyx_tuple__156);

  /* "src/lxml/xmlerror.pxi":823
 *     """Libxml2 error types"""
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 RelaxNG error types"""
 * 
 */
  __pyx_tuple__157 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__157);
  __Pyx_GIVEREF(__pyx_tuple__157);
  __pyx_tuple__158 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__158);
  __Pyx_GIVEREF(__pyx_tuple__158);

  /* "lxml/etree.pyx":539
 * 
 * 
 * cdef object _find_invalid_public_id_characters = re.compile(             # <<<<<<<<<<<<<<
 *     ur"[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+").search
 * 
 */
  __pyx_tuple__159 = PyTuple_Pack(1, __pyx_kp_u_x20_x0D_x0Aa_zA_Z0_9); if (unlikely(!__pyx_tuple__159)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__159);
  __Pyx_GIVEREF(__pyx_tuple__159);

  /* "lxml/etree.pyx":573
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */
  __pyx_tuple__160 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_c_doc, __pyx_n_s_c_dtd); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);
  __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_clear, 573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(0, 573, __pyx_L1_error)

  /* "lxml/etree.pyx":730
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         """_init(self)
 * 
 */
  __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_init_2, 730, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 730, __pyx_L1_error)

  /* "lxml/etree.pyx":818
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */
  __pyx_tuple__163 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_memo); if (unlikely(!__pyx_tuple__163)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__163);
  __Pyx_GIVEREF(__pyx_tuple__163);
  __pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_deepcopy, 818, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) __PYX_ERR(0, 818, __pyx_L1_error)

  /* "lxml/etree.pyx":822
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */
  __pyx_tuple__165 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_c_doc, __pyx_n_s_c_node, __pyx_n_s_new_doc, __pyx_n_s_root); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__165);
  __Pyx_GIVEREF(__pyx_tuple__165);
  __pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_copy_2, 822, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) __PYX_ERR(0, 822, __pyx_L1_error)

  /* "lxml/etree.pyx":841
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */
  __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_set, 841, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(0, 841, __pyx_L1_error)

  /* "lxml/etree.pyx":851
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
 */
  __pyx_tuple__168 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_element); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_append, 851, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 851, __pyx_L1_error)

  /* "lxml/etree.pyx":860
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
 */
  __pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_addnext, 860, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) __PYX_ERR(0, 860, __pyx_L1_error)

  /* "lxml/etree.pyx":878
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
 */
  __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_addprevious, 878, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 878, __pyx_L1_error)

  /* "lxml/etree.pyx":897
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
 */
  __pyx_tuple__172 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_elements, __pyx_n_s_element); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);
  __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_extend, 897, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 897, __pyx_L1_error)

  /* "lxml/etree.pyx":910
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
 */
  __pyx_tuple__174 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_keep_tail, __pyx_n_s_c_attr, __pyx_n_s_c_attr_next, __pyx_n_s_c_node, __pyx_n_s_c_node_next); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_clear, 910, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 910, __pyx_L1_error)
  __pyx_tuple__176 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);

  /* "lxml/etree.pyx":942
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
 */
  __pyx_tuple__177 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_element, __pyx_n_s_c_node, __pyx_n_s_c_next, __pyx_n_s_c_source_doc); if (unlikely(!__pyx_tuple__177)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__177);
  __Pyx_GIVEREF(__pyx_tuple__177);
  __pyx_codeobj__178 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_insert, 942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__178)) __PYX_ERR(0, 942, __pyx_L1_error)

  /* "lxml/etree.pyx":965
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
 */
  __pyx_tuple__179 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_element, __pyx_n_s_c_node, __pyx_n_s_c_next); if (unlikely(!__pyx_tuple__179)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__179);
  __Pyx_GIVEREF(__pyx_tuple__179);
  __pyx_codeobj__180 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_remove, 965, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__180)) __PYX_ERR(0, 965, __pyx_L1_error)

  /* "lxml/etree.pyx":985
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
 */
  __pyx_tuple__181 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_old_element, __pyx_n_s_new_element, __pyx_n_s_c_old_node, __pyx_n_s_c_old_next, __pyx_n_s_c_new_node, __pyx_n_s_c_new_next, __pyx_n_s_c_source_doc); if (unlikely(!__pyx_tuple__181)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__181);
  __Pyx_GIVEREF(__pyx_tuple__181);
  __pyx_codeobj__182 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_replace, 985, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__182)) __PYX_ERR(0, 985, __pyx_L1_error)

  /* "lxml/etree.pyx":1236
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_reversed_2, 1236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(0, 1236, __pyx_L1_error)

  /* "lxml/etree.pyx":1240
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
 */
  __pyx_tuple__184 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_child, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_c_start, __pyx_n_s_c_stop, __pyx_n_s_c_child, __pyx_n_s_c_start_node); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_index, 1240, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __pyx_tuple__186 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);

  /* "lxml/etree.pyx":1327
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */
  __pyx_tuple__187 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default); if (unlikely(!__pyx_tuple__187)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__187);
  __Pyx_GIVEREF(__pyx_tuple__187);
  __pyx_codeobj__188 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_get, 1327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__188)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __pyx_tuple__189 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__189)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__189);
  __Pyx_GIVEREF(__pyx_tuple__189);

  /* "lxml/etree.pyx":1335
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
 */
  __pyx_codeobj__190 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_keys, 1335, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__190)) __PYX_ERR(0, 1335, __pyx_L1_error)

  /* "lxml/etree.pyx":1344
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
 */
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_values, 1344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 1344, __pyx_L1_error)

  /* "lxml/etree.pyx":1353
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
 */
  __pyx_codeobj__192 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_items, 1353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__192)) __PYX_ERR(0, 1353, __pyx_L1_error)

  /* "lxml/etree.pyx":1362
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
 */
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getchildren, 1362, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(0, 1362, __pyx_L1_error)

  /* "lxml/etree.pyx":1375
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
 */
  __pyx_tuple__194 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_c_node); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getparent, 1375, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(0, 1375, __pyx_L1_error)

  /* "lxml/etree.pyx":1387
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
 */
  __pyx_codeobj__196 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getnext, 1387, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) __PYX_ERR(0, 1387, __pyx_L1_error)

  /* "lxml/etree.pyx":1399
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
 */
  __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getprevious, 1399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) __PYX_ERR(0, 1399, __pyx_L1_error)

  /* "lxml/etree.pyx":1411
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
 */
  __pyx_tuple__198 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_preceding, __pyx_n_s_tags); if (unlikely(!__pyx_tuple__198)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__198);
  __Pyx_GIVEREF(__pyx_tuple__198);
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_itersiblings, 1411, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(0, 1411, __pyx_L1_error)

  /* "lxml/etree.pyx":1434
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
 */
  __pyx_tuple__200 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_tags); if (unlikely(!__pyx_tuple__200)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__200);
  __Pyx_GIVEREF(__pyx_tuple__200);
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterancestors, 1434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(0, 1434, __pyx_L1_error)

  /* "lxml/etree.pyx":1448
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
 */
  __pyx_codeobj__202 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterdescendants, 1448, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__202)) __PYX_ERR(0, 1448, __pyx_L1_error)

  /* "lxml/etree.pyx":1463
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
 */
  __pyx_tuple__203 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_reversed, __pyx_n_s_tags); if (unlikely(!__pyx_tuple__203)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__203);
  __Pyx_GIVEREF(__pyx_tuple__203);
  __pyx_codeobj__204 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__203, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterchildren, 1463, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__204)) __PYX_ERR(0, 1463, __pyx_L1_error)

  /* "lxml/etree.pyx":1478
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
 */
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getroottree, 1478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(0, 1478, __pyx_L1_error)

  /* "lxml/etree.pyx":1490
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
 */
  __pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getiterator, 1490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) __PYX_ERR(0, 1490, __pyx_L1_error)

  /* "lxml/etree.pyx":1512
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */
  __pyx_codeobj__207 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iter, 1512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__207)) __PYX_ERR(0, 1512, __pyx_L1_error)

  /* "lxml/etree.pyx":1536
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
 */
  __pyx_tuple__208 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_with_tail, __pyx_n_s_tags); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__208);
  __Pyx_GIVEREF(__pyx_tuple__208);
  __pyx_codeobj__209 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_itertext, 1536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(0, 1536, __pyx_L1_error)

  /* "lxml/etree.pyx":1551
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_tuple__210 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_tag_2, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 1551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);
  __pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_makeelement, 1551, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(0, 1551, __pyx_L1_error)

  /* "lxml/etree.pyx":1560
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */
  __pyx_tuple__212 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_namespaces); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(0, 1560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__212);
  __Pyx_GIVEREF(__pyx_tuple__212);
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_find, 1560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(0, 1560, __pyx_L1_error)

  /* "lxml/etree.pyx":1573
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */
  __pyx_tuple__214 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_default, __pyx_n_s_namespaces); if (unlikely(!__pyx_tuple__214)) __PYX_ERR(0, 1573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__214);
  __Pyx_GIVEREF(__pyx_tuple__214);
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_findtext, 1573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(0, 1573, __pyx_L1_error)

  /* "lxml/etree.pyx":1586
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */
  __pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_findall, 1586, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) __PYX_ERR(0, 1586, __pyx_L1_error)

  /* "lxml/etree.pyx":1599
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterfind, 1599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(0, 1599, __pyx_L1_error)

  /* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_tuple__218 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_path_2, __pyx_n_s_namespaces, __pyx_n_s_extensions, __pyx_n_s_smart_strings, __pyx_n_s_variables_2, __pyx_n_s_evaluator); if (unlikely(!__pyx_tuple__218)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__218);
  __Pyx_GIVEREF(__pyx_tuple__218);
  __pyx_codeobj__219 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_xpath, 1612, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__219)) __PYX_ERR(0, 1612, __pyx_L1_error)

  /* "lxml/etree.pyx":1623
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
 */
  __pyx_tuple__220 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_translator, __pyx_n_s_CSSSelector); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);
  __pyx_codeobj__221 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_cssselect, 1623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__221)) __PYX_ERR(0, 1623, __pyx_L1_error)

  /* "lxml/etree.pyx":1673
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
 */
  __pyx_codeobj__222 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_set, 1673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__222)) __PYX_ERR(0, 1673, __pyx_L1_error)

  /* "lxml/etree.pyx":1677
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
 */
  __pyx_tuple__223 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__223)) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__223);
  __Pyx_GIVEREF(__pyx_tuple__223);
  __pyx_codeobj__224 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__223, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_append, 1677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__224)) __PYX_ERR(0, 1677, __pyx_L1_error)

  /* "lxml/etree.pyx":1681
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
 */
  __pyx_tuple__225 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_value); if (unlikely(!__pyx_tuple__225)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__225);
  __Pyx_GIVEREF(__pyx_tuple__225);
  __pyx_codeobj__226 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__225, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_insert, 1681, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__226)) __PYX_ERR(0, 1681, __pyx_L1_error)

  /* "lxml/etree.pyx":1720
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
 */
  __pyx_codeobj__227 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_get, 1720, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__227)) __PYX_ERR(0, 1720, __pyx_L1_error)

  /* "lxml/etree.pyx":1724
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
 */
  __pyx_codeobj__228 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_keys, 1724, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__228)) __PYX_ERR(0, 1724, __pyx_L1_error)

  /* "lxml/etree.pyx":1728
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
 */
  __pyx_codeobj__229 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_items, 1728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__229)) __PYX_ERR(0, 1728, __pyx_L1_error)

  /* "lxml/etree.pyx":1732
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
 */
  __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_values, 1732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) __PYX_ERR(0, 1732, __pyx_L1_error)

  /* "lxml/etree.pyx":1768
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */
  __pyx_codeobj__231 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_get, 1768, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__231)) __PYX_ERR(0, 1768, __pyx_L1_error)

  /* "lxml/etree.pyx":1912
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__232 = PyTuple_Pack(6, __pyx_n_s_self, __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__232)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__232);
  __Pyx_GIVEREF(__pyx_tuple__232);
  __pyx_codeobj__233 = (PyObject*)__Pyx_PyCode_New(3, 0, 1, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__232, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_parse, 1912, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__233)) __PYX_ERR(0, 1912, __pyx_L1_error)

  /* "lxml/etree.pyx":1928
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
 */
  __pyx_tuple__234 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_root); if (unlikely(!__pyx_tuple__234)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);
  __pyx_codeobj__235 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_setroot, 1928, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__235)) __PYX_ERR(0, 1928, __pyx_L1_error)

  /* "lxml/etree.pyx":1939
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
 */
  __pyx_codeobj__236 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getroot, 1939, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__236)) __PYX_ERR(0, 1939, __pyx_L1_error)

  /* "lxml/etree.pyx":1946
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 */
  __pyx_codeobj__237 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_copy_2, 1946, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__237)) __PYX_ERR(0, 1946, __pyx_L1_error)

  /* "lxml/etree.pyx":1949
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
 */
  __pyx_tuple__238 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_memo, __pyx_n_s_root, __pyx_n_s_doc_2, __pyx_n_s_c_doc); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);
  __pyx_codeobj__239 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__238, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_deepcopy, 1949, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__239)) __PYX_ERR(0, 1949, __pyx_L1_error)

  /* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 */
  __pyx_tuple__240 = PyTuple_Pack(20, __pyx_n_s_self, __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_doctype, __pyx_n_s_compression, __pyx_n_s_exclusive, __pyx_n_s_inclusive_ns_prefixes, __pyx_n_s_with_comments, __pyx_n_s_strip_text, __pyx_n_s_docstring, __pyx_n_s_write_declaration, __pyx_n_s_is_standalone, __pyx_n_s_f, __pyx_n_s_target, __pyx_n_s_warnings); if (unlikely(!__pyx_tuple__240)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__240);
  __Pyx_GIVEREF(__pyx_tuple__240);
  __pyx_codeobj__241 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__240, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_write, 1989, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__241)) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":2099
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
 */
  __pyx_tuple__242 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_element, __pyx_n_s_doc_2, __pyx_n_s_root, __pyx_n_s_c_doc, __pyx_n_s_c_path, __pyx_n_s_path); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(0, 2099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);
  __pyx_codeobj__243 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__242, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getpath, 2099, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__243)) __PYX_ERR(0, 2099, __pyx_L1_error)

  /* "lxml/etree.pyx":2137
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
 */
  __pyx_tuple__244 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_element, __pyx_n_s_root, __pyx_n_s_count, __pyx_n_s_path, __pyx_n_s_c_element, __pyx_n_s_c_name, __pyx_n_s_c_href, __pyx_n_s_tag, __pyx_n_s_c_node); if (unlikely(!__pyx_tuple__244)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__244);
  __Pyx_GIVEREF(__pyx_tuple__244);
  __pyx_codeobj__245 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__244, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getelementpath, 2137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__245)) __PYX_ERR(0, 2137, __pyx_L1_error)

  /* "lxml/etree.pyx":2201
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
 */
  __pyx_tuple__246 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_tags, __pyx_n_s_root); if (unlikely(!__pyx_tuple__246)) __PYX_ERR(0, 2201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__246);
  __Pyx_GIVEREF(__pyx_tuple__246);
  __pyx_codeobj__247 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__246, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_getiterator, 2201, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__247)) __PYX_ERR(0, 2201, __pyx_L1_error)

  /* "lxml/etree.pyx":2225
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */
  __pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__246, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iter, 2225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) __PYX_ERR(0, 2225, __pyx_L1_error)

  /* "lxml/etree.pyx":2243
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */
  __pyx_tuple__249 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_namespaces, __pyx_n_s_root, __pyx_n_s_warn); if (unlikely(!__pyx_tuple__249)) __PYX_ERR(0, 2243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__249);
  __Pyx_GIVEREF(__pyx_tuple__249);
  __pyx_codeobj__250 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_find, 2243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__250)) __PYX_ERR(0, 2243, __pyx_L1_error)

  /* "lxml/etree.pyx":2267
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */
  __pyx_tuple__251 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_path, __pyx_n_s_default, __pyx_n_s_namespaces, __pyx_n_s_root, __pyx_n_s_warn); if (unlikely(!__pyx_tuple__251)) __PYX_ERR(0, 2267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__251);
  __Pyx_GIVEREF(__pyx_tuple__251);
  __pyx_codeobj__252 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__251, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_findtext, 2267, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__252)) __PYX_ERR(0, 2267, __pyx_L1_error)

  /* "lxml/etree.pyx":2291
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */
  __pyx_codeobj__253 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_findall, 2291, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__253)) __PYX_ERR(0, 2291, __pyx_L1_error)

  /* "lxml/etree.pyx":2315
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */
  __pyx_codeobj__254 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterfind, 2315, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__254)) __PYX_ERR(0, 2315, __pyx_L1_error)

  /* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_codeobj__255 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_xpath, 2339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__255)) __PYX_ERR(0, 2339, __pyx_L1_error)

  /* "lxml/etree.pyx":2364
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */
  __pyx_tuple__256 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_xslt, __pyx_n_s_extensions, __pyx_n_s_access_control, __pyx_n_s_kw, __pyx_n_s_style); if (unlikely(!__pyx_tuple__256)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__256);
  __Pyx_GIVEREF(__pyx_tuple__256);
  __pyx_codeobj__257 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__256, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_xslt_3, 2364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__257)) __PYX_ERR(0, 2364, __pyx_L1_error)

  /* "lxml/etree.pyx":2383
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
 */
  __pyx_tuple__258 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_relaxng, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__258)) __PYX_ERR(0, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__258);
  __Pyx_GIVEREF(__pyx_tuple__258);
  __pyx_codeobj__259 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_relaxng, 2383, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__259)) __PYX_ERR(0, 2383, __pyx_L1_error)

  /* "lxml/etree.pyx":2401
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
 */
  __pyx_tuple__260 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_xmlschema, __pyx_n_s_schema); if (unlikely(!__pyx_tuple__260)) __PYX_ERR(0, 2401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__260);
  __Pyx_GIVEREF(__pyx_tuple__260);
  __pyx_codeobj__261 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__260, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_xmlschema, 2401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__261)) __PYX_ERR(0, 2401, __pyx_L1_error)

  /* "lxml/etree.pyx":2419
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
 */
  __pyx_codeobj__262 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_xinclude, 2419, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__262)) __PYX_ERR(0, 2419, __pyx_L1_error)

  /* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 */
  __pyx_tuple__263 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_file, __pyx_n_s_exclusive, __pyx_n_s_with_comments, __pyx_n_s_compression, __pyx_n_s_inclusive_ns_prefixes); if (unlikely(!__pyx_tuple__263)) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__263);
  __Pyx_GIVEREF(__pyx_tuple__263);
  __pyx_codeobj__264 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__263, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_write_c14n, 2434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__264)) __PYX_ERR(0, 2434, __pyx_L1_error)

  /* "lxml/etree.pyx":2501
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 */
  __pyx_tuple__265 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_sequence_or_dict, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__265)) __PYX_ERR(0, 2501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__265);
  __Pyx_GIVEREF(__pyx_tuple__265);
  __pyx_codeobj__266 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__265, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_update, 2501, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__266)) __PYX_ERR(0, 2501, __pyx_L1_error)

  /* "lxml/etree.pyx":2508
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 */
  __pyx_tuple__267 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default, __pyx_n_s_result); if (unlikely(!__pyx_tuple__267)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__267);
  __Pyx_GIVEREF(__pyx_tuple__267);
  __pyx_codeobj__268 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_pop, 2508, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__268)) __PYX_ERR(0, 2508, __pyx_L1_error)

  /* "lxml/etree.pyx":2521
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 */
  __pyx_tuple__269 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_c_attrs); if (unlikely(!__pyx_tuple__269)) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__269);
  __Pyx_GIVEREF(__pyx_tuple__269);
  __pyx_codeobj__270 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__269, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_clear, 2521, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__270)) __PYX_ERR(0, 2521, __pyx_L1_error)

  /* "lxml/etree.pyx":2533
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_codeobj__271 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_copy_2, 2533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__271)) __PYX_ERR(0, 2533, __pyx_L1_error)

  /* "lxml/etree.pyx":2537
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_codeobj__272 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_deepcopy, 2537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__272)) __PYX_ERR(0, 2537, __pyx_L1_error)

  /* "lxml/etree.pyx":2567
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
 */
  __pyx_codeobj__273 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_get, 2567, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__273)) __PYX_ERR(0, 2567, __pyx_L1_error)

  /* "lxml/etree.pyx":2571
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
 */
  __pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_keys, 2571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) __PYX_ERR(0, 2571, __pyx_L1_error)

  /* "lxml/etree.pyx":2579
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */
  __pyx_codeobj__275 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iterkeys, 2579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__275)) __PYX_ERR(0, 2579, __pyx_L1_error)

  /* "lxml/etree.pyx":2583
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
 */
  __pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_values, 2583, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) __PYX_ERR(0, 2583, __pyx_L1_error)

  /* "lxml/etree.pyx":2587
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
 */
  __pyx_codeobj__277 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_itervalues, 2587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__277)) __PYX_ERR(0, 2587, __pyx_L1_error)

  /* "lxml/etree.pyx":2591
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
 */
  __pyx_codeobj__278 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_items, 2591, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__278)) __PYX_ERR(0, 2591, __pyx_L1_error)

  /* "lxml/etree.pyx":2595
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_codeobj__279 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iteritems, 2595, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__279)) __PYX_ERR(0, 2595, __pyx_L1_error)

  /* "lxml/etree.pyx":2599
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
 */
  __pyx_codeobj__280 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_has_key, 2599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__280)) __PYX_ERR(0, 2599, __pyx_L1_error)

  /* "lxml/etree.pyx":3082
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_tuple__281 = PyTuple_Pack(4, __pyx_n_s_tag_2, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__281)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);
  __pyx_codeobj__282 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__281, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_Element_2, 3082, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__282)) __PYX_ERR(0, 3082, __pyx_L1_error)

  /* "lxml/etree.pyx":3096
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
 */
  __pyx_tuple__283 = 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__283)) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__283);
  __Pyx_GIVEREF(__pyx_tuple__283);
  __pyx_codeobj__284 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_Comment, 3096, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__284)) __PYX_ERR(0, 3096, __pyx_L1_error)

  /* "lxml/etree.pyx":3120
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
 */
  __pyx_tuple__285 = 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__285)) __PYX_ERR(0, 3120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__285);
  __Pyx_GIVEREF(__pyx_tuple__285);
  __pyx_codeobj__286 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_ProcessingInstruction, 3120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__286)) __PYX_ERR(0, 3120, __pyx_L1_error)

  /* "lxml/etree.pyx":3173
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
 */
  __pyx_tuple__287 = 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__287)) __PYX_ERR(0, 3173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__287);
  __Pyx_GIVEREF(__pyx_tuple__287);
  __pyx_codeobj__288 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__287, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_Entity, 3173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__288)) __PYX_ERR(0, 3173, __pyx_L1_error)

  /* "lxml/etree.pyx":3199
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */
  __pyx_tuple__289 = 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__289)) __PYX_ERR(0, 3199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__289);
  __Pyx_GIVEREF(__pyx_tuple__289);
  __pyx_codeobj__290 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_SubElement, 3199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__290)) __PYX_ERR(0, 3199, __pyx_L1_error)

  /* "lxml/etree.pyx":3209
 * 
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """ElementTree(element=None, file=None, parser=None)
 * 
 */
  __pyx_tuple__291 = 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__291)) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__291);
  __Pyx_GIVEREF(__pyx_tuple__291);
  __pyx_codeobj__292 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_ElementTree, 3209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__292)) __PYX_ERR(0, 3209, __pyx_L1_error)

  /* "lxml/etree.pyx":3235
 * 
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__293 = 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__293)) __PYX_ERR(0, 3235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__293);
  __Pyx_GIVEREF(__pyx_tuple__293);
  __pyx_codeobj__294 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_HTML, 3235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__294)) __PYX_ERR(0, 3235, __pyx_L1_error)

  /* "lxml/etree.pyx":3261
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
 */
  __pyx_codeobj__295 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_XML, 3261, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__295)) __PYX_ERR(0, 3261, __pyx_L1_error)

  /* "lxml/etree.pyx":3292
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
 */
  __pyx_codeobj__296 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_fromstring, 3292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__296)) __PYX_ERR(0, 3292, __pyx_L1_error)

  /* "lxml/etree.pyx":3313
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
 */
  __pyx_tuple__297 = 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__297)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__297);
  __Pyx_GIVEREF(__pyx_tuple__297);
  __pyx_codeobj__298 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__297, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_fromstringlist, 3313, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__298)) __PYX_ERR(0, 3313, __pyx_L1_error)

  /* "lxml/etree.pyx":3334
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
 */
  __pyx_tuple__299 = PyTuple_Pack(1, __pyx_n_s_element); if (unlikely(!__pyx_tuple__299)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__299);
  __Pyx_GIVEREF(__pyx_tuple__299);
  __pyx_codeobj__300 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__299, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_iselement, 3334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__300)) __PYX_ERR(0, 3334, __pyx_L1_error)

  /* "lxml/etree.pyx":3342
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
 */
  __pyx_tuple__301 = PyTuple_Pack(5, __pyx_n_s_tree, __pyx_n_s_space, __pyx_n_s_level, __pyx_n_s_root, __pyx_n_s_indent); if (unlikely(!__pyx_tuple__301)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__301);
  __Pyx_GIVEREF(__pyx_tuple__301);
  __pyx_codeobj__302 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__301, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_indent, 3342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__302)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __pyx_tuple__303 = PyTuple_Pack(1, ((PyObject*)__pyx_kp_u__52)); if (unlikely(!__pyx_tuple__303)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__303);
  __Pyx_GIVEREF(__pyx_tuple__303);

  /* "lxml/etree.pyx":3393
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
 */
  __pyx_tuple__304 = 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__304)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);
  __pyx_codeobj__305 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__304, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_dump, 3393, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__305)) __PYX_ERR(0, 3393, __pyx_L1_error)

  /* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_tuple__306 = PyTuple_Pack(16, __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_inclusive_ns_prefixes, __pyx_n_s_with_comments, __pyx_n_s_strip_text, __pyx_n_s_write_declaration, __pyx_n_s_is_standalone, __pyx_n_s_out, __pyx_n_s_target); if (unlikely(!__pyx_tuple__306)) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__307 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_tostring, 3405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__307)) __PYX_ERR(0, 3405, __pyx_L1_error)

  /* "lxml/etree.pyx":3518
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
 */
  __pyx_tuple__308 = PyTuple_Pack(3, __pyx_n_s_element_or_tree, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__308)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_tostringlist, 3518, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) __PYX_ERR(0, 3518, __pyx_L1_error)

  /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_tuple__310 = 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__310)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_tounicode, 3530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) __PYX_ERR(0, 3530, __pyx_L1_error)

  /* "lxml/etree.pyx":3564
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__312 = 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__312)) __PYX_ERR(0, 3564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_parse, 3564, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) __PYX_ERR(0, 3564, __pyx_L1_error)

  /* "lxml/etree.pyx":3596
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
 */
  __pyx_tuple__314 = PyTuple_Pack(5, __pyx_n_s_capsule, __pyx_n_s_parser, __pyx_n_s_c_doc, __pyx_n_s_is_owned, __pyx_n_s_doc_2); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);
  __pyx_codeobj__315 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__314, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_adopt_external_document, 3596, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__315)) __PYX_ERR(0, 3596, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */
  __pyx_codeobj__316 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_deepcopy, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__316)) __PYX_ERR(8, 160, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */
  __pyx_codeobj__317 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_copy_2, 164, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__317)) __PYX_ERR(8, 164, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
 */
  __pyx_tuple__318 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_reversed, __pyx_n_s_children, __pyx_n_s_el); if (unlikely(!__pyx_tuple__318)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__318);
  __Pyx_GIVEREF(__pyx_tuple__318);
  __pyx_codeobj__319 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__318, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_iterchildren, 187, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__319)) __PYX_ERR(8, 187, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
 */
  __pyx_codeobj__320 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_getchildren, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__320)) __PYX_ERR(8, 199, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
 */
  __pyx_tuple__321 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_c_parent); if (unlikely(!__pyx_tuple__321)) __PYX_ERR(8, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__321);
  __Pyx_GIVEREF(__pyx_tuple__321);
  __pyx_codeobj__322 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__321, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_getparent, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__322)) __PYX_ERR(8, 214, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
 */
  __pyx_codeobj__323 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_getnext, 225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__323)) __PYX_ERR(8, 225, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
 */
  __pyx_codeobj__324 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_getprevious, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__324)) __PYX_ERR(8, 235, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
 */
  __pyx_codeobj__325 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_get, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__325)) __PYX_ERR(8, 304, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
 */
  __pyx_codeobj__326 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_keys, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__326)) __PYX_ERR(8, 310, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */
  __pyx_codeobj__327 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_values, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__327)) __PYX_ERR(8, 317, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */
  __pyx_codeobj__328 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_items, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__328)) __PYX_ERR(8, 324, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */
  __pyx_tuple__329 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other_element); if (unlikely(!__pyx_tuple__329)) __PYX_ERR(8, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__329);
  __Pyx_GIVEREF(__pyx_tuple__329);
  __pyx_codeobj__330 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_append, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__330)) __PYX_ERR(8, 390, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
 */
  __pyx_codeobj__331 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_extend, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__331)) __PYX_ERR(8, 407, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */
  __pyx_codeobj__332 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_append, 487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__332)) __PYX_ERR(8, 487, __pyx_L1_error)

  /* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
 */
  __pyx_codeobj__333 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_readonlytree_pxi, __pyx_n_s_extend, 499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__333)) __PYX_ERR(8, 499, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
 */
  __pyx_tuple__334 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_lookup); if (unlikely(!__pyx_tuple__334)) __PYX_ERR(9, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__334);
  __Pyx_GIVEREF(__pyx_tuple__334);
  __pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_classlookup_pxi, __pyx_n_s_set_fallback, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) __PYX_ERR(9, 248, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
 */
  __pyx_tuple__336 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_doc_2, __pyx_n_s_namespace, __pyx_n_s_name_2); if (unlikely(!__pyx_tuple__336)) __PYX_ERR(9, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__336);
  __Pyx_GIVEREF(__pyx_tuple__336);
  __pyx_codeobj__337 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__336, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_classlookup_pxi, __pyx_n_s_lookup, 430, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__337)) __PYX_ERR(9, 430, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
 */
  __pyx_tuple__338 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_doc_2, __pyx_n_s_element); if (unlikely(!__pyx_tuple__338)) __PYX_ERR(9, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__338);
  __Pyx_GIVEREF(__pyx_tuple__338);
  __pyx_codeobj__339 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_classlookup_pxi, __pyx_n_s_lookup, 512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__339)) __PYX_ERR(9, 512, __pyx_L1_error)

  /* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
 */
  __pyx_tuple__340 = PyTuple_Pack(1, __pyx_n_s_lookup); if (unlikely(!__pyx_tuple__340)) __PYX_ERR(9, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__340);
  __Pyx_GIVEREF(__pyx_tuple__340);
  __pyx_codeobj__341 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__340, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_classlookup_pxi, __pyx_n_s_set_element_class_lookup, 549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__341)) __PYX_ERR(9, 549, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
 */
  __pyx_tuple__342 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_class_dict_iterable, __pyx_n_s_name_2, __pyx_n_s_item); if (unlikely(!__pyx_tuple__342)) __PYX_ERR(12, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__342);
  __Pyx_GIVEREF(__pyx_tuple__342);
  __pyx_codeobj__343 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_update, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__343)) __PYX_ERR(12, 29, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":74
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
 */
  __pyx_codeobj__344 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_items, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__344)) __PYX_ERR(12, 74, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":77
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
 */
  __pyx_codeobj__345 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_iteritems, 77, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__345)) __PYX_ERR(12, 77, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":80
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
 */
  __pyx_codeobj__346 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_clear, 80, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__346)) __PYX_ERR(12, 80, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
 */
  __pyx_tuple__347 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_name_2, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__347)) __PYX_ERR(12, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__347);
  __Pyx_GIVEREF(__pyx_tuple__347);
  __pyx_codeobj__348 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__347, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_deco, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__348)) __PYX_ERR(12, 99, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
 */
  __pyx_tuple__349 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_ns_uri, __pyx_n_s_ns_utf, __pyx_n_s_registry); if (unlikely(!__pyx_tuple__349)) __PYX_ERR(12, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__349);
  __Pyx_GIVEREF(__pyx_tuple__349);
  __pyx_codeobj__350 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__349, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_get_namespace, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__350)) __PYX_ERR(12, 147, __pyx_L1_error)

  /* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
 */
  __pyx_tuple__351 = PyTuple_Pack(3, __pyx_n_s_ns_uri, __pyx_n_s_ns_utf, __pyx_n_s_registry); if (unlikely(!__pyx_tuple__351)) __PYX_ERR(12, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__351);
  __Pyx_GIVEREF(__pyx_tuple__351);
  __pyx_codeobj__352 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__351, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_nsclasses_pxi, __pyx_n_s_FunctionNamespace, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__352)) __PYX_ERR(12, 207, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
 */
  __pyx_tuple__353 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_system_url, __pyx_n_s_public_id, __pyx_n_s_context); if (unlikely(!__pyx_tuple__353)) __PYX_ERR(13, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__353);
  __Pyx_GIVEREF(__pyx_tuple__353);
  __pyx_codeobj__354 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__353, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__354)) __PYX_ERR(13, 25, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
 */
  __pyx_tuple__355 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_context, __pyx_n_s_doc_ref); if (unlikely(!__pyx_tuple__355)) __PYX_ERR(13, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__355);
  __Pyx_GIVEREF(__pyx_tuple__355);
  __pyx_codeobj__356 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__355, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve_empty, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__356)) __PYX_ERR(13, 36, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
 */
  __pyx_tuple__357 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_string_2, __pyx_n_s_context, __pyx_n_s_base_url, __pyx_n_s_doc_ref); if (unlikely(!__pyx_tuple__357)) __PYX_ERR(13, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__357);
  __Pyx_GIVEREF(__pyx_tuple__357);
  __pyx_codeobj__358 = (PyObject*)__Pyx_PyCode_New(3, 0, 1, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__357, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve_string, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__358)) __PYX_ERR(13, 48, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
 */
  __pyx_tuple__359 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_context, __pyx_n_s_doc_ref); if (unlikely(!__pyx_tuple__359)) __PYX_ERR(13, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__359);
  __Pyx_GIVEREF(__pyx_tuple__359);
  __pyx_codeobj__360 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__359, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve_filename, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__360)) __PYX_ERR(13, 69, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """resolve_file(self, f, context, base_url=None, close=True)
 * 
 */
  __pyx_tuple__361 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_context, __pyx_n_s_base_url, __pyx_n_s_close, __pyx_n_s_doc_ref); if (unlikely(!__pyx_tuple__361)) __PYX_ERR(13, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__361);
  __Pyx_GIVEREF(__pyx_tuple__361);
  __pyx_codeobj__362 = (PyObject*)__Pyx_PyCode_New(3, 0, 2, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__361, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve_file, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__362)) __PYX_ERR(13, 83, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
 */
  __pyx_tuple__363 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_resolver); if (unlikely(!__pyx_tuple__363)) __PYX_ERR(13, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__363);
  __Pyx_GIVEREF(__pyx_tuple__363);
  __pyx_codeobj__364 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_add, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__364)) __PYX_ERR(13, 120, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */
  __pyx_codeobj__365 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_remove, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__365)) __PYX_ERR(13, 133, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
 */
  __pyx_codeobj__366 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_copy, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__366)) __PYX_ERR(13, 143, __pyx_L1_error)

  /* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 */
  __pyx_tuple__367 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_system_url, __pyx_n_s_public_id, __pyx_n_s_context, __pyx_n_s_resolver, __pyx_n_s_result); if (unlikely(!__pyx_tuple__367)) __PYX_ERR(13, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__367);
  __Pyx_GIVEREF(__pyx_tuple__367);
  __pyx_codeobj__368 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__367, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_docloader_pxi, __pyx_n_s_resolve, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__368)) __PYX_ERR(13, 147, __pyx_L1_error)

  /* "src/lxml/parser.pxi":12
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
 */
  __pyx_tuple__369 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_code, __pyx_n_s_line_2, __pyx_n_s_column_2, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__369)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__369);
  __Pyx_GIVEREF(__pyx_tuple__369);
  __pyx_codeobj__370 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__369, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_init, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__370)) __PYX_ERR(2, 12, __pyx_L1_error)

  /* "src/lxml/parser.pxi":18
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
 */
  __pyx_codeobj__371 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_position, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__371)) __PYX_ERR(2, 18, __pyx_L1_error)

  /* "src/lxml/parser.pxi":22
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 */
  __pyx_tuple__372 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_new_pos, __pyx_n_s_column_2); if (unlikely(!__pyx_tuple__372)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__372);
  __Pyx_GIVEREF(__pyx_tuple__372);
  __pyx_codeobj__373 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__372, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_position, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__373)) __PYX_ERR(2, 22, __pyx_L1_error)

  /* "src/lxml/parser.pxi":999
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */
  __pyx_codeobj__374 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_set_element_class_lookup, 999, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__374)) __PYX_ERR(2, 999, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1026
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
 */
  __pyx_codeobj__375 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_copy, 1026, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__375)) __PYX_ERR(2, 1026, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1033
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_codeobj__376 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_makeelement, 1033, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__376)) __PYX_ERR(2, 1033, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1331
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
 */
  __pyx_tuple__377 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__377)) __PYX_ERR(2, 1331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__377);
  __Pyx_GIVEREF(__pyx_tuple__377);
  __pyx_codeobj__378 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_feed, 1331, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__378)) __PYX_ERR(2, 1331, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1455
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */
  __pyx_codeobj__379 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_close, 1455, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__379)) __PYX_ERR(2, 1455, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1667
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */
  __pyx_codeobj__380 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_read_events, 1667, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__380)) __PYX_ERR(2, 1667, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1719
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
 */
  __pyx_tuple__381 = PyTuple_Pack(1, __pyx_n_s_parser); if (unlikely(!__pyx_tuple__381)) __PYX_ERR(2, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__381);
  __Pyx_GIVEREF(__pyx_tuple__381);
  __pyx_codeobj__382 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__381, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_set_default_parser, 1719, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__382)) __PYX_ERR(2, 1719, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1735
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __pyx_codeobj__383 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_get_default_parser, 1735, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__383)) __PYX_ERR(2, 1735, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1840
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */
  __pyx_codeobj__384 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parser_pxi, __pyx_n_s_read_events, 1840, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__384)) __PYX_ERR(2, 1840, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
 */
  __pyx_tuple__385 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_message); if (unlikely(!__pyx_tuple__385)) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__385);
  __Pyx_GIVEREF(__pyx_tuple__385);
  __pyx_codeobj__386 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__385, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__386)) __PYX_ERR(3, 10, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */
  __pyx_codeobj__387 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_close, 821, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__387)) __PYX_ERR(3, 821, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
 */
  __pyx_codeobj__388 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_data, 834, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__388)) __PYX_ERR(3, 834, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
 */
  __pyx_tuple__389 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_attrs, __pyx_n_s_nsmap); if (unlikely(!__pyx_tuple__389)) __PYX_ERR(3, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__389);
  __Pyx_GIVEREF(__pyx_tuple__389);
  __pyx_codeobj__390 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__389, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_start, 842, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__390)) __PYX_ERR(3, 842, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
 */
  __pyx_tuple__391 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_element); if (unlikely(!__pyx_tuple__391)) __PYX_ERR(3, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__391);
  __Pyx_GIVEREF(__pyx_tuple__391);
  __pyx_codeobj__392 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__391, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_end, 851, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__392)) __PYX_ERR(3, 851, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
 */
  __pyx_tuple__393 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_target, __pyx_n_s_data); if (unlikely(!__pyx_tuple__393)) __PYX_ERR(3, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__393);
  __Pyx_GIVEREF(__pyx_tuple__393);
  __pyx_codeobj__394 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_pi, 861, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__394)) __PYX_ERR(3, 861, __pyx_L1_error)

  /* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
 */
  __pyx_tuple__395 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_comment); if (unlikely(!__pyx_tuple__395)) __PYX_ERR(3, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__395);
  __Pyx_GIVEREF(__pyx_tuple__395);
  __pyx_codeobj__396 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__395, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_saxparser_pxi, __pyx_n_s_comment, 869, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__396)) __PYX_ERR(3, 869, __pyx_L1_error)

  /* "src/lxml/parsertarget.pxi":14
 *     # 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__397 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__397)) __PYX_ERR(4, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__397);
  __Pyx_GIVEREF(__pyx_tuple__397);
  __pyx_codeobj__398 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__397, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_parsertarget_pxi, __pyx_n_s_init, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__398)) __PYX_ERR(4, 14, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":582
 * cdef object getwriter
 * from codecs import getwriter
 * cdef object utf8_writer = getwriter('utf8')             # <<<<<<<<<<<<<<
 * 
 * cdef object contextmanager
 */
  __pyx_tuple__399 = PyTuple_Pack(1, __pyx_n_u_utf8); if (unlikely(!__pyx_tuple__399)) __PYX_ERR(10, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__399);
  __Pyx_GIVEREF(__pyx_tuple__399);

  /* "src/lxml/serializer.pxi":589
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 */
  __pyx_tuple__400 = PyTuple_Pack(4, __pyx_n_s_file, __pyx_n_s_compression, __pyx_n_s_zf, __pyx_n_s_f); if (unlikely(!__pyx_tuple__400)) __PYX_ERR(10, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__400);
  __Pyx_GIVEREF(__pyx_tuple__400);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__400, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_open_utf8_file, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(10, 589, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":862
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
 */
  __pyx_tuple__401 = PyTuple_Pack(7, __pyx_n_s_xml_data, __pyx_n_s_out, __pyx_n_s_from_file, __pyx_n_s_options, __pyx_n_s_sio, __pyx_n_s_target, __pyx_n_s_parser); if (unlikely(!__pyx_tuple__401)) __PYX_ERR(10, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__401);
  __Pyx_GIVEREF(__pyx_tuple__401);
  __pyx_codeobj__402 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__401, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_canonicalize, 862, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__402)) __PYX_ERR(10, 862, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1005
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 */
  __pyx_tuple__403 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_ns_stack, __pyx_n_s_namespaces); if (unlikely(!__pyx_tuple__403)) __PYX_ERR(10, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__403);
  __Pyx_GIVEREF(__pyx_tuple__403);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__403, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_iter_namespaces, 1005, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(10, 1005, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1054
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
 */
  __pyx_codeobj__404 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_data, 1054, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__404)) __PYX_ERR(10, 1054, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1072
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */
  __pyx_tuple__405 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_uri); if (unlikely(!__pyx_tuple__405)) __PYX_ERR(10, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__405);
  __Pyx_GIVEREF(__pyx_tuple__405);
  __pyx_codeobj__406 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__405, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_start_ns_2, 1072, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__406)) __PYX_ERR(10, 1072, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1080
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 */
  __pyx_tuple__407 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_attrs, __pyx_n_s_new_namespaces); if (unlikely(!__pyx_tuple__407)) __PYX_ERR(10, 1080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__407);
  __Pyx_GIVEREF(__pyx_tuple__407);
  __pyx_codeobj__408 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__407, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_start, 1080, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__408)) __PYX_ERR(10, 1080, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1165
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 */
  __pyx_tuple__409 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_tag); if (unlikely(!__pyx_tuple__409)) __PYX_ERR(10, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__409);
  __Pyx_GIVEREF(__pyx_tuple__409);
  __pyx_codeobj__410 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__409, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_end, 1165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__410)) __PYX_ERR(10, 1165, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1177
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
 */
  __pyx_tuple__411 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_text); if (unlikely(!__pyx_tuple__411)) __PYX_ERR(10, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__411);
  __Pyx_GIVEREF(__pyx_tuple__411);
  __pyx_codeobj__412 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__411, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_comment, 1177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__412)) __PYX_ERR(10, 1177, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1190
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */
  __pyx_codeobj__413 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_pi, 1190, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__413)) __PYX_ERR(10, 1190, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1202
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_codeobj__414 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_close, 1202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__414)) __PYX_ERR(10, 1202, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1344
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 */
  __pyx_codeobj__415 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_enter, 1344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__415)) __PYX_ERR(10, 1344, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1351
 *         return self.writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 */
  __pyx_tuple__416 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_val, __pyx_n_s_exc_tb, __pyx_n_s_old_writer, __pyx_n_s_raise_on_error); if (unlikely(!__pyx_tuple__416)) __PYX_ERR(10, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__416);
  __Pyx_GIVEREF(__pyx_tuple__416);
  __pyx_codeobj__417 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__416, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_exit, 1351, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__417)) __PYX_ERR(10, 1351, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1359
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 */
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aenter, 1359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(10, 1359, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1370
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 */
  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__416, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aexit, 1370, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(10, 1370, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1427
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
 */
  __pyx_tuple__418 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_version, __pyx_n_s_standalone, __pyx_n_s_doctype, __pyx_n_s_c_version, __pyx_n_s_c_standalone); if (unlikely(!__pyx_tuple__418)) __PYX_ERR(10, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__418);
  __Pyx_GIVEREF(__pyx_tuple__418);
  __pyx_codeobj__419 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__418, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write_declaration, 1427, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__419)) __PYX_ERR(10, 1427, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1456
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
 */
  __pyx_tuple__420 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_doctype); if (unlikely(!__pyx_tuple__420)) __PYX_ERR(10, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__420);
  __Pyx_GIVEREF(__pyx_tuple__420);
  __pyx_codeobj__421 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__420, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write_doctype, 1456, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__421)) __PYX_ERR(10, 1456, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1473
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
 */
  __pyx_tuple__422 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_method, __pyx_n_s_c_method); if (unlikely(!__pyx_tuple__422)) __PYX_ERR(10, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__422);
  __Pyx_GIVEREF(__pyx_tuple__422);
  __pyx_codeobj__423 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__422, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_method, 1473, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__423)) __PYX_ERR(10, 1473, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1483
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
 */
  __pyx_tuple__424 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_method, __pyx_n_s_extra, __pyx_n_s_attributes, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_ns, __pyx_n_s_reversed_nsmap, __pyx_n_s_prefix, __pyx_n_s_c_method); if (unlikely(!__pyx_tuple__424)) __PYX_ERR(10, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__424);
  __Pyx_GIVEREF(__pyx_tuple__424);
  __pyx_codeobj__425 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__424, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_element, 1483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__425)) __PYX_ERR(10, 1483, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1620
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
 */
  __pyx_tuple__426 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_with_tail, __pyx_n_s_pretty_print, __pyx_n_s_method, __pyx_n_s_args, __pyx_n_s_c_method, __pyx_n_s_content, __pyx_n_s_bstring, __pyx_n_s_ns, __pyx_n_s_name_2, __pyx_n_s__56); if (unlikely(!__pyx_tuple__426)) __PYX_ERR(10, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__426);
  __Pyx_GIVEREF(__pyx_tuple__426);
  __pyx_codeobj__427 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__426, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write, 1620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__427)) __PYX_ERR(10, 1620, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1667
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
 */
  __pyx_codeobj__428 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_flush, 1667, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__428)) __PYX_ERR(10, 1667, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1714
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */
  __pyx_codeobj__429 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write, 1714, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__429)) __PYX_ERR(10, 1714, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1717
 *         self._data.append(data)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_codeobj__430 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_close, 1717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__430)) __PYX_ERR(10, 1717, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1746
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
 */
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_flush, 1746, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(10, 1746, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1752
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 */
  __pyx_tuple__431 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_version, __pyx_n_s_standalone, __pyx_n_s_doctype, __pyx_n_s_data); if (unlikely(!__pyx_tuple__431)) __PYX_ERR(10, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__431);
  __Pyx_GIVEREF(__pyx_tuple__431);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__431, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write_declaration, 1752, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(10, 1752, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1758
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 */
  __pyx_tuple__432 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_doctype, __pyx_n_s_data); if (unlikely(!__pyx_tuple__432)) __PYX_ERR(10, 1758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__432);
  __Pyx_GIVEREF(__pyx_tuple__432);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__432, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write_doctype, 1758, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(10, 1758, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1764
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 */
  __pyx_tuple__433 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_with_tail, __pyx_n_s_pretty_print, __pyx_n_s_method, __pyx_n_s_args, __pyx_n_s_data); if (unlikely(!__pyx_tuple__433)) __PYX_ERR(10, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__433);
  __Pyx_GIVEREF(__pyx_tuple__433);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__433, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_write, 1764, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(10, 1764, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1770
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
 */
  __pyx_tuple__434 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_method); if (unlikely(!__pyx_tuple__434)) __PYX_ERR(10, 1770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__434);
  __Pyx_GIVEREF(__pyx_tuple__434);
  __pyx_codeobj__435 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__434, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_method, 1770, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__435)) __PYX_ERR(10, 1770, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1773
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
 */
  __pyx_tuple__436 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_tag, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_method, __pyx_n_s_extra, __pyx_n_s_element_writer); if (unlikely(!__pyx_tuple__436)) __PYX_ERR(10, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__436);
  __Pyx_GIVEREF(__pyx_tuple__436);
  __pyx_codeobj__437 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__436, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_element, 1773, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__437)) __PYX_ERR(10, 1773, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1777
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 */
  __pyx_tuple__438 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_raise_on_error, __pyx_n_s_data); if (unlikely(!__pyx_tuple__438)) __PYX_ERR(10, 1777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__438);
  __Pyx_GIVEREF(__pyx_tuple__438);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__438, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_close_2, 1777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(10, 1777, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1797
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 */
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aenter, 1797, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(10, 1797, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1803
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 */
  __pyx_tuple__439 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_data); if (unlikely(!__pyx_tuple__439)) __PYX_ERR(10, 1803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__439);
  __Pyx_GIVEREF(__pyx_tuple__439);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__439, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aexit, 1803, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(10, 1803, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1825
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
 */
  __pyx_codeobj__440 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_enter, 1825, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__440)) __PYX_ERR(10, 1825, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1829
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
 */
  __pyx_tuple__441 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_val, __pyx_n_s_exc_tb); if (unlikely(!__pyx_tuple__441)) __PYX_ERR(10, 1829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__441);
  __Pyx_GIVEREF(__pyx_tuple__441);
  __pyx_codeobj__442 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__441, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_exit, 1829, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__442)) __PYX_ERR(10, 1829, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1851
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 */
  __pyx_codeobj__443 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_enter, 1851, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__443)) __PYX_ERR(10, 1851, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1857
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 */
  __pyx_codeobj__444 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__441, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_exit, 1857, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__444)) __PYX_ERR(10, 1857, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1865
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
 */
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aenter, 1865, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(10, 1865, __pyx_L1_error)

  /* "src/lxml/serializer.pxi":1869
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
 */
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_serializer_pxi, __pyx_n_s_aexit, 1869, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(10, 1869, __pyx_L1_error)

  /* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */
  __pyx_codeobj__445 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_iterparse_pxi, __pyx_n_s_set_element_class_lookup, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__445)) __PYX_ERR(14, 147, __pyx_L1_error)

  /* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_codeobj__446 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_iterparse_pxi, __pyx_n_s_makeelement, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__446)) __PYX_ERR(14, 156, __pyx_L1_error)

  /* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
 */
  __pyx_codeobj__447 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_iterparse_pxi, __pyx_n_s_skip_subtree, 373, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__447)) __PYX_ERR(14, 373, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__448 = 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__448)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__448);
  __Pyx_GIVEREF(__pyx_tuple__448);
  __pyx_codeobj__449 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_XMLID, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__449)) __PYX_ERR(15, 3, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__450 = PyTuple_Pack(4, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_root); if (unlikely(!__pyx_tuple__450)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__450);
  __Pyx_GIVEREF(__pyx_tuple__450);
  __pyx_codeobj__451 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__450, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_XMLDTDID, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__451)) __PYX_ERR(15, 24, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
 */
  __pyx_tuple__452 = 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__452)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__452);
  __Pyx_GIVEREF(__pyx_tuple__452);
  __pyx_codeobj__453 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__452, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_parseid, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__453)) __PYX_ERR(15, 44, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
 */
  __pyx_codeobj__454 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_copy, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__454)) __PYX_ERR(15, 78, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
 */
  __pyx_tuple__455 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_id_name); if (unlikely(!__pyx_tuple__455)) __PYX_ERR(15, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__455);
  __Pyx_GIVEREF(__pyx_tuple__455);
  __pyx_codeobj__456 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__455, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_get, 95, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__456)) __PYX_ERR(15, 95, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
 */
  __pyx_codeobj__457 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__455, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_has_key, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__457)) __PYX_ERR(15, 105, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */
  __pyx_codeobj__458 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_keys, 111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__458)) __PYX_ERR(15, 111, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_codeobj__459 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_iterkeys, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__459)) __PYX_ERR(15, 121, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_codeobj__460 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_items, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__460)) __PYX_ERR(15, 129, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_codeobj__461 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_iteritems, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__461)) __PYX_ERR(15, 134, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
 */
  __pyx_tuple__462 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_values, __pyx_n_s_item, __pyx_n_s_value); if (unlikely(!__pyx_tuple__462)) __PYX_ERR(15, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__462);
  __Pyx_GIVEREF(__pyx_tuple__462);
  __pyx_codeobj__463 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__462, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_values, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__463)) __PYX_ERR(15, 139, __pyx_L1_error)

  /* "src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
 */
  __pyx_codeobj__464 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xmlid_pxi, __pyx_n_s_itervalues, 149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__464)) __PYX_ERR(15, 149, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
 */
  __pyx_tuple__465 = PyTuple_Pack(7, __pyx_n_s_tree_or_element, __pyx_n_s_top_nsmap, __pyx_n_s_keep_ns_prefixes, __pyx_n_s_element, __pyx_n_s_c_element, __pyx_n_s_doc_2, __pyx_n_s_prefix); if (unlikely(!__pyx_tuple__465)) __PYX_ERR(17, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__465);
  __Pyx_GIVEREF(__pyx_tuple__465);
  __pyx_codeobj__466 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__465, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_cleanup_pxi, __pyx_n_s_cleanup_namespaces, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__466)) __PYX_ERR(17, 3, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
 */
  __pyx_tuple__467 = 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__467)) __PYX_ERR(17, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__467);
  __Pyx_GIVEREF(__pyx_tuple__467);
  __pyx_codeobj__468 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__467, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_cleanup_pxi, __pyx_n_s_strip_attributes, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__468)) __PYX_ERR(17, 33, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */
  __pyx_tuple__469 = PyTuple_Pack(6, __pyx_n_s_tree_or_element, __pyx_n_s_with_tail, __pyx_n_s_tag_names, __pyx_n_s_matcher, __pyx_n_s_doc_2, __pyx_n_s_element); if (unlikely(!__pyx_tuple__469)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__469);
  __Pyx_GIVEREF(__pyx_tuple__469);
  __pyx_codeobj__470 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__469, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_cleanup_pxi, __pyx_n_s_strip_elements, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__470)) __PYX_ERR(17, 74, __pyx_L1_error)

  /* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
 */
  __pyx_tuple__471 = PyTuple_Pack(5, __pyx_n_s_tree_or_element, __pyx_n_s_tag_names, __pyx_n_s_matcher, __pyx_n_s_doc_2, __pyx_n_s_element); if (unlikely(!__pyx_tuple__471)) __PYX_ERR(17, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__471);
  __Pyx_GIVEREF(__pyx_tuple__471);
  __pyx_codeobj__472 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__471, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_cleanup_pxi, __pyx_n_s_strip_tags, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__472)) __PYX_ERR(17, 145, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":369
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
 */
  __pyx_tuple__473 = PyTuple_Pack(26, __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, __pyx_kp_b_Forbidden_variable, __pyx_kp_b_Unknown_error); if (unlikely(!__pyx_tuple__473)) __PYX_ERR(11, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__473);
  __Pyx_GIVEREF(__pyx_tuple__473);

  /* "src/lxml/extensions.pxi":427
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
 */
  __pyx_tuple__474 = 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__474)) __PYX_ERR(11, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__474);
  __Pyx_GIVEREF(__pyx_tuple__474);
  __pyx_codeobj__475 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__474, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_extensions_pxi, __pyx_n_s_Extension, 427, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__475)) __PYX_ERR(11, 427, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":499
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */
  __pyx_tuple__476 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_ctxt, __pyx_n_s_s_4, __pyx_n_s_rexp, __pyx_n_s_flags, __pyx_n_s_rexpc); if (unlikely(!__pyx_tuple__476)) __PYX_ERR(11, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__476);
  __Pyx_GIVEREF(__pyx_tuple__476);
  __pyx_codeobj__477 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__476, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_extensions_pxi, __pyx_n_s_test, 499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__477)) __PYX_ERR(11, 499, __pyx_L1_error)
  __pyx_tuple__478 = PyTuple_Pack(1, __pyx_kp_u__12); if (unlikely(!__pyx_tuple__478)) __PYX_ERR(11, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__478);
  __Pyx_GIVEREF(__pyx_tuple__478);

  /* "src/lxml/extensions.pxi":508
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */
  __pyx_tuple__479 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_ctxt, __pyx_n_s_s_4, __pyx_n_s_rexp, __pyx_n_s_flags, __pyx_n_s_result_list, __pyx_n_s_rexpc, __pyx_n_s_results, __pyx_n_s_result, __pyx_n_s_root, __pyx_n_s_s_match, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__479)) __PYX_ERR(11, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__479);
  __Pyx_GIVEREF(__pyx_tuple__479);
  __pyx_codeobj__480 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__479, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_extensions_pxi, __pyx_n_s_match, 508, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__480)) __PYX_ERR(11, 508, __pyx_L1_error)

  /* "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)
 */
  __pyx_tuple__481 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_ctxt, __pyx_n_s_s_4, __pyx_n_s_rexp, __pyx_n_s_flags, __pyx_n_s_replacement, __pyx_n_s_rexpc, __pyx_n_s_count); if (unlikely(!__pyx_tuple__481)) __PYX_ERR(11, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__481);
  __Pyx_GIVEREF(__pyx_tuple__481);
  __pyx_codeobj__482 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__481, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_extensions_pxi, __pyx_n_s_replace, 533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__482)) __PYX_ERR(11, 533, __pyx_L1_error)

  /* "src/lxml/extensions.pxi":725
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */
  __pyx_codeobj__483 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_extensions_pxi, __pyx_n_s_getparent, 725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__483)) __PYX_ERR(11, 725, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
 */
  __pyx_codeobj__484 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__405, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xpath_pxi, __pyx_n_s_register_namespace, 251, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__484)) __PYX_ERR(18, 251, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
 */
  __pyx_tuple__485 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_namespaces, __pyx_n_s_prefix, __pyx_n_s_uri); if (unlikely(!__pyx_tuple__485)) __PYX_ERR(18, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__485);
  __Pyx_GIVEREF(__pyx_tuple__485);
  __pyx_codeobj__486 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__485, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xpath_pxi, __pyx_n_s_register_namespaces, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__486)) __PYX_ERR(18, 257, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */
  __pyx_tuple__487 = 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__487)) __PYX_ERR(18, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__487);
  __Pyx_GIVEREF(__pyx_tuple__487);
  __pyx_codeobj__488 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__487, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xpath_pxi, __pyx_n_s_XPathEvaluator, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__488)) __PYX_ERR(18, 352, __pyx_L1_error)

  /* "src/lxml/xpath.pxi":448
 * 
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 */
  __pyx_tuple__490 = PyTuple_Pack(1, __pyx_kp_b__489); if (unlikely(!__pyx_tuple__490)) __PYX_ERR(18, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__490);
  __Pyx_GIVEREF(__pyx_tuple__490);

  /* "src/lxml/xpath.pxi":449
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * cdef object _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
 */
  __pyx_tuple__492 = PyTuple_Pack(1, __pyx_kp_b__491); if (unlikely(!__pyx_tuple__492)) __PYX_ERR(18, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__492);
  __Pyx_GIVEREF(__pyx_tuple__492);

  /* "src/lxml/xslt.pxi":437
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
 */
  __pyx_tuple__493 = PyTuple_Pack(1, __pyx_n_s_strval); if (unlikely(!__pyx_tuple__493)) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__493);
  __Pyx_GIVEREF(__pyx_tuple__493);
  __pyx_codeobj__494 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__493, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_strparam, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__494)) __PYX_ERR(5, 437, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":451
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
 */
  __pyx_tuple__495 = PyTuple_Pack(1, __pyx_n_s_max_depth); if (unlikely(!__pyx_tuple__495)) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__495);
  __Pyx_GIVEREF(__pyx_tuple__495);
  __pyx_codeobj__496 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__495, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_set_global_max_depth, 451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__496)) __PYX_ERR(5, 451, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":471
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
 */
  __pyx_tuple__497 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result_tree); if (unlikely(!__pyx_tuple__497)) __PYX_ERR(5, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__497);
  __Pyx_GIVEREF(__pyx_tuple__497);
  __pyx_codeobj__498 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__497, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_tostring, 471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__498)) __PYX_ERR(5, 471, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":480
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */
  __pyx_codeobj__499 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_deepcopy, 480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__499)) __PYX_ERR(5, 480, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":483
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */
  __pyx_codeobj__500 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_copy_2, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__500)) __PYX_ERR(5, 483, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":711
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
 */
  __pyx_tuple__501 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_file, __pyx_n_s_compression, __pyx_n_s_writer, __pyx_n_s_doc_2, __pyx_n_s_r, __pyx_n_s_rclose, __pyx_n_s_c_compression, __pyx_n_s_c_encoding, __pyx_n_s_c_buffer); if (unlikely(!__pyx_tuple__501)) __PYX_ERR(5, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__501);
  __Pyx_GIVEREF(__pyx_tuple__501);
  __pyx_codeobj__502 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__501, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_write_output, 711, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__502)) __PYX_ERR(5, 711, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":860
 * # XSLT PI support
 * 
 * cdef object _RE_PI_HREF = re.compile(r'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')             # <<<<<<<<<<<<<<
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 */
  __pyx_tuple__503 = PyTuple_Pack(1, __pyx_kp_u_s_href_s_s); if (unlikely(!__pyx_tuple__503)) __PYX_ERR(5, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__503);
  __Pyx_GIVEREF(__pyx_tuple__503);

  /* "src/lxml/xslt.pxi":874
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
 */
  __pyx_tuple__504 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_parser, __pyx_n_s_result_doc, __pyx_n_s_result_node, __pyx_n_s_href_utf, __pyx_n_s_c_href, __pyx_n_s_c_attr, __pyx_n_s_hrefs, __pyx_n_s_root); if (unlikely(!__pyx_tuple__504)) __PYX_ERR(5, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__504);
  __Pyx_GIVEREF(__pyx_tuple__504);
  __pyx_codeobj__505 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__504, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_parseXSL, 874, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__505)) __PYX_ERR(5, 874, __pyx_L1_error)

  /* "src/lxml/xslt.pxi":931
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */
  __pyx_tuple__506 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_value, __pyx_n_s_attrib, __pyx_n_s_text); if (unlikely(!__pyx_tuple__506)) __PYX_ERR(5, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__506);
  __Pyx_GIVEREF(__pyx_tuple__506);
  __pyx_codeobj__507 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__506, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xslt_pxi, __pyx_n_s_set, 931, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__507)) __PYX_ERR(5, 931, __pyx_L1_error)

  /* "src/lxml/xsltext.pxi":6
 *     """Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         """execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
 */
  __pyx_tuple__508 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_context, __pyx_n_s_self_node, __pyx_n_s_input_node, __pyx_n_s_output_parent); if (unlikely(!__pyx_tuple__508)) __PYX_ERR(19, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__508);
  __Pyx_GIVEREF(__pyx_tuple__508);
  __pyx_codeobj__509 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__508, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xsltext_pxi, __pyx_n_s_execute, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__509)) __PYX_ERR(19, 6, __pyx_L1_error)

  /* "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):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_tuple__510 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_context, __pyx_n_s_node, __pyx_n_s_output_parent, __pyx_n_s_elements_only, __pyx_n_s_remove_blank_text, __pyx_n_s_c_parent, __pyx_n_s_c_node, __pyx_n_s_c_context_node); if (unlikely(!__pyx_tuple__510)) __PYX_ERR(19, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__510);
  __Pyx_GIVEREF(__pyx_tuple__510);
  __pyx_codeobj__511 = (PyObject*)__Pyx_PyCode_New(4, 0, 2, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__510, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xsltext_pxi, __pyx_n_s_apply_templates, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__511)) __PYX_ERR(19, 22, __pyx_L1_error)

  /* "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):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_tuple__512 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_context, __pyx_n_s_output_parent, __pyx_n_s_elements_only, __pyx_n_s_remove_blank_text, __pyx_n_s_c_parent, __pyx_n_s_c_ctxt, __pyx_n_s_c_old_output_parent); if (unlikely(!__pyx_tuple__512)) __PYX_ERR(19, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__512);
  __Pyx_GIVEREF(__pyx_tuple__512);
  __pyx_codeobj__513 = (PyObject*)__Pyx_PyCode_New(3, 0, 2, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__512, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_xsltext_pxi, __pyx_n_s_process_children, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__513)) __PYX_ERR(19, 74, __pyx_L1_error)

  /* "lxml/etree.pyx":3677
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
 */
  __pyx_tuple__514 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_etree); if (unlikely(!__pyx_tuple__514)) __PYX_ERR(0, 3677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__514);
  __Pyx_GIVEREF(__pyx_tuple__514);
  __pyx_codeobj__515 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__514, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_validate, 3677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__515)) __PYX_ERR(0, 3677, __pyx_L1_error)

  /* "lxml/etree.pyx":3686
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
 */
  __pyx_codeobj__516 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__514, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_assertValid, 3686, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__516)) __PYX_ERR(0, 3686, __pyx_L1_error)

  /* "lxml/etree.pyx":3696
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
 */
  __pyx_codeobj__517 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__514, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_assert, 3696, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__517)) __PYX_ERR(0, 3696, __pyx_L1_error)

  /* "lxml/etree.pyx":3705
 *                 "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,
 */
  __pyx_tuple__518 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_domain, __pyx_n_s_type, __pyx_n_s_level, __pyx_n_s_line_2, __pyx_n_s_message, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__518)) __PYX_ERR(0, 3705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__518);
  __Pyx_GIVEREF(__pyx_tuple__518);
  __pyx_codeobj__519 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__518, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_append_log_message, 3705, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__519)) __PYX_ERR(0, 3705, __pyx_L1_error)

  /* "lxml/etree.pyx":3710
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */
  __pyx_codeobj__520 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_etree_pyx, __pyx_n_s_clear_error_log, 3710, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__520)) __PYX_ERR(0, 3710, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 */
  __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_itervalues, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(20, 163, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":170
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
 */
  __pyx_codeobj__521 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_values, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__521)) __PYX_ERR(20, 170, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 */
  __pyx_tuple__522 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_c_node, __pyx_n_s_node); if (unlikely(!__pyx_tuple__522)) __PYX_ERR(20, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__522);
  __Pyx_GIVEREF(__pyx_tuple__522);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__522, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_iterattributes, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(20, 223, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":233
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
 */
  __pyx_codeobj__523 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_attributes, 233, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__523)) __PYX_ERR(20, 233, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":326
 *        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:
 */
  __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__522, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_iterelements, 326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(20, 326, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":336
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
 */
  __pyx_codeobj__524 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_elements, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__524)) __PYX_ERR(20, 336, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":339
 *         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:
 */
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__522, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_iterentities, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(20, 339, __pyx_L1_error)

  /* "src/lxml/dtd.pxi":349
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
 */
  __pyx_codeobj__525 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_dtd_pxi, __pyx_n_s_entities, 349, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__525)) __PYX_ERR(20, 349, __pyx_L1_error)

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
 */
  __pyx_tuple__526 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_src, __pyx_n_s_base_url, __pyx_n_s_rng_str); if (unlikely(!__pyx_tuple__526)) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__526);
  __Pyx_GIVEREF(__pyx_tuple__526);
  __pyx_codeobj__527 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__526, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_relaxng_pxi, __pyx_n_s_from_rnc_string, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__527)) __PYX_ERR(21, 154, __pyx_L1_error)

  /* "src/lxml/xmlschema.pxi":21
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     "boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_tuple__528 = PyTuple_Pack(1, __pyx_kp_u_boolean_xs_attribute_default_or); if (unlikely(!__pyx_tuple__528)) __PYX_ERR(22, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__528);
  __Pyx_GIVEREF(__pyx_tuple__528);

  /* "src/lxml/debug.pxi":6
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
 */
  __pyx_codeobj__529 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_debug_pxi, __pyx_n_s_bytes_used, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__529)) __PYX_ERR(25, 6, __pyx_L1_error)

  /* "src/lxml/debug.pxi":15
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
 */
  __pyx_codeobj__530 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_debug_pxi, __pyx_n_s_blocks_used, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__530)) __PYX_ERR(25, 15, __pyx_L1_error)

  /* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
 */
  __pyx_tuple__531 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_c_dict); if (unlikely(!__pyx_tuple__531)) __PYX_ERR(25, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__531);
  __Pyx_GIVEREF(__pyx_tuple__531);
  __pyx_codeobj__532 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__531, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_debug_pxi, __pyx_n_s_dict_size, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__532)) __PYX_ERR(25, 24, __pyx_L1_error)

  /* "src/lxml/debug.pxi":35
 *         return tree.xmlDictSize(c_dict)
 * 
 *     def dump(self, output_file=None, byte_count=None):             # <<<<<<<<<<<<<<
 *         """dump(self, output_file=None, byte_count=None)
 * 
 */
  __pyx_tuple__533 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_output_file, __pyx_n_s_byte_count, __pyx_n_s_c_count, __pyx_n_s_f); if (unlikely(!__pyx_tuple__533)) __PYX_ERR(25, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__533);
  __Pyx_GIVEREF(__pyx_tuple__533);
  __pyx_codeobj__534 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__533, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_debug_pxi, __pyx_n_s_dump, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__534)) __PYX_ERR(25, 35, __pyx_L1_error)

  /* "src/lxml/debug.pxi":65
 *             stdio.fclose(f)
 * 
 *     def show(self, output_file=None, block_count=None):             # <<<<<<<<<<<<<<
 *         """show(self, output_file=None, block_count=None)
 * 
 */
  __pyx_tuple__535 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_output_file, __pyx_n_s_block_count, __pyx_n_s_f); if (unlikely(!__pyx_tuple__535)) __PYX_ERR(25, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__535);
  __Pyx_GIVEREF(__pyx_tuple__535);
  __pyx_codeobj__536 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__535, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_debug_pxi, __pyx_n_s_show, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__536)) __PYX_ERR(25, 65, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
  __pyx_umethod_PyBytes_Type_replace.type = (PyObject*)&PyBytes_Type;
  __pyx_umethod_PyBytes_Type_replace.method_name = &__pyx_n_s_replace;
  __pyx_umethod_PyBytes_Type_split.type = (PyObject*)&PyBytes_Type;
  __pyx_umethod_PyBytes_Type_split.method_name = &__pyx_n_s_split;
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get;
  __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_items.method_name = &__pyx_n_s_items;
  __pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_values.method_name = &__pyx_n_s_values;
  __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
  __pyx_umethod_PyList_Type_pop.method_name = &__pyx_n_s_pop;
  __pyx_umethod_PySet_Type_update.type = (PyObject*)&PySet_Type;
  __pyx_umethod_PySet_Type_update.method_name = &__pyx_n_s_update;
  __pyx_umethod_PyUnicode_Type_strip.type = (PyObject*)&PyUnicode_Type;
  __pyx_umethod_PyUnicode_Type_strip.method_name = &__pyx_n_s_strip;
  if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_32768 = PyInt_FromLong(32768L); if (unlikely(!__pyx_int_32768)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_4 = PyInt_FromLong(-4); if (unlikely(!__pyx_int_neg_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_100 = PyInt_FromLong(-100); if (unlikely(!__pyx_int_neg_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_200 = PyInt_FromLong(-200); if (unlikely(!__pyx_int_neg_200)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_300 = PyInt_FromLong(-300); if (unlikely(!__pyx_int_neg_300)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_globals ### */

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_module ### */

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __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_OrderedDict = 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_partial = 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_MutableMapping = 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__DEFAULT_NAMESPACE_PREFIXES_ITEMS = 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___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_invalid_public_id_characters = 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__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_inspect_getargspec = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_GzipFile = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_io_open = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_gzip = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_getwriter = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_utf8_writer = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_contextmanager = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__open_utf8_file = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__looks_like_prefix_name = 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__rnc2rng = 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);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("deepcopyNodeToDocument", (void (*)(void))deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("elementTreeFactory", (void (*)(void))elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("newElementTree", (void (*)(void))newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("adoptExternalDocument", (void (*)(void))adoptExternalDocument, "struct LxmlElementTree *(xmlDoc *, PyObject *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("elementFactory", (void (*)(void))elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("makeElement", (void (*)(void))makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("makeSubElement", (void (*)(void))makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setElementClassLookupFunction", (void (*)(void))setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("lookupDefaultElementClass", (void (*)(void))lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("lookupNamespaceElementClass", (void (*)(void))lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("callLookupFallback", (void (*)(void))callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("tagMatches", (void (*)(void))tagMatches, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("documentOrRaise", (void (*)(void))documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("rootNodeOrRaise", (void (*)(void))rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hasText", (void (*)(void))hasText, "int (xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hasTail", (void (*)(void))hasTail, "int (xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("textOf", (void (*)(void))textOf, "PyObject *(xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("tailOf", (void (*)(void))tailOf, "PyObject *(xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setNodeText", (void (*)(void))setNodeText, "int (xmlNode *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setTailText", (void (*)(void))setTailText, "int (xmlNode *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("attributeValue", (void (*)(void))attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("attributeValueFromNsName", (void (*)(void))attributeValueFromNsName, "PyObject *(xmlNode *, const xmlChar *, const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getAttributeValue", (void (*)(void))getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("iterattributes", (void (*)(void))iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("collectAttributes", (void (*)(void))collectAttributes, "PyObject *(xmlNode *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setAttributeValue", (void (*)(void))setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("delAttribute", (void (*)(void))delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("delAttributeFromNsName", (void (*)(void))delAttributeFromNsName, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("hasChild", (void (*)(void))hasChild, "int (xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findChild", (void (*)(void))findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findChildForwards", (void (*)(void))findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findChildBackwards", (void (*)(void))findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("nextElement", (void (*)(void))nextElement, "xmlNode *(xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("previousElement", (void (*)(void))previousElement, "xmlNode *(xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("appendChild", (void (*)(void))appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("appendChildToElement", (void (*)(void))appendChildToElement, "int (struct LxmlElement *, struct LxmlElement *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("pyunicode", (void (*)(void))pyunicode, "PyObject *(const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("utf8", (void (*)(void))utf8, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getNsTag", (void (*)(void))getNsTag, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getNsTagWithEmptyNs", (void (*)(void))getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("namespacedName", (void (*)(void))namespacedName, "PyObject *(xmlNode *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("namespacedNameFromNsName", (void (*)(void))namespacedNameFromNsName, "PyObject *(const xmlChar *, const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("iteratorStoreNext", (void (*)(void))iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("initTagMatch", (void (*)(void))initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findOrBuildNodeNsPrefix", (void (*)(void))findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_Error = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Error_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_Error)) __PYX_ERR(0, 207, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Error_spec, __pyx_ptype_4lxml_5etree_Error) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_Error = &__pyx_type_4lxml_5etree_Error;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_Error) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base((&((PyTypeObject*)PyExc_Exception)[0])) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_Error->tp_dealloc = (&((PyTypeObject*)PyExc_Exception)[0])->tp_dealloc;
  __pyx_ptype_4lxml_5etree_Error->tp_base = (&((PyTypeObject*)PyExc_Exception)[0]);
  __pyx_ptype_4lxml_5etree_Error->tp_new = (&((PyTypeObject*)PyExc_Exception)[0])->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_Error) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_Error->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_Error->tp_dictoffset && __pyx_ptype_4lxml_5etree_Error->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_Error->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Error, (PyObject *) __pyx_ptype_4lxml_5etree_Error) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_LxmlError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_LxmlError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_LxmlError)) __PYX_ERR(0, 211, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_LxmlError_spec, __pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_LxmlError = &__pyx_type_4lxml_5etree_LxmlError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_LxmlError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_Error) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc = __pyx_ptype_4lxml_5etree_Error->tp_dealloc;
  __pyx_ptype_4lxml_5etree_LxmlError->tp_base = __pyx_ptype_4lxml_5etree_Error;
  __pyx_ptype_4lxml_5etree_LxmlError->tp_new = __pyx_ptype_4lxml_5etree_Error->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_LxmlError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_LxmlError->tp_dictoffset && __pyx_ptype_4lxml_5etree_LxmlError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_LxmlError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LxmlError, (PyObject *) __pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_C14NError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_C14NError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_C14NError)) __PYX_ERR(0, 230, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_C14NError_spec, __pyx_ptype_4lxml_5etree_C14NError) < 0) __PYX_ERR(0, 230, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_C14NError = &__pyx_type_4lxml_5etree_C14NError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_C14NError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(0, 230, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_C14NError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_C14NError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_C14NError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_C14NError) < 0) __PYX_ERR(0, 230, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_C14NError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_C14NError->tp_dictoffset && __pyx_ptype_4lxml_5etree_C14NError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_C14NError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_C14NError, (PyObject *) __pyx_ptype_4lxml_5etree_C14NError) < 0) __PYX_ERR(0, 230, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__TempStore = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__TempStore_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__TempStore)) __PYX_ERR(0, 304, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__TempStore_spec, __pyx_ptype_4lxml_5etree__TempStore) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__TempStore = &__pyx_type_4lxml_5etree__TempStore;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__TempStore) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__TempStore->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__TempStore->tp_dictoffset && __pyx_ptype_4lxml_5etree__TempStore->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__TempStore->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__TempStore, __pyx_vtabptr_4lxml_5etree__TempStore) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__TempStore) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ExceptionContext = &__pyx_vtable_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ExceptionContext.clear = (int (*)(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 = (int (*)(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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ExceptionContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ExceptionContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ExceptionContext)) __PYX_ERR(0, 320, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ExceptionContext_spec, __pyx_ptype_4lxml_5etree__ExceptionContext) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ExceptionContext = &__pyx_type_4lxml_5etree__ExceptionContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ExceptionContext) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ExceptionContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ExceptionContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ExceptionContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ExceptionContext->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ExceptionContext, __pyx_vtabptr_4lxml_5etree__ExceptionContext) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ExceptionContext) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__LogEntry = &__pyx_vtable_4lxml_5etree__LogEntry;
  __pyx_vtable_4lxml_5etree__LogEntry._setError = (int (*)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError const *))__pyx_f_4lxml_5etree_9_LogEntry__setError;
  __pyx_vtable_4lxml_5etree__LogEntry._setGeneric = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, long, PyObject *, PyObject *))__pyx_f_4lxml_5etree_9_LogEntry__setGeneric;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__LogEntry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__LogEntry_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__LogEntry)) __PYX_ERR(1, 38, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__LogEntry_spec, __pyx_ptype_4lxml_5etree__LogEntry) < 0) __PYX_ERR(1, 38, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__LogEntry = &__pyx_type_4lxml_5etree__LogEntry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__LogEntry) < 0) __PYX_ERR(1, 38, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__LogEntry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__LogEntry->tp_dictoffset && __pyx_ptype_4lxml_5etree__LogEntry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__LogEntry->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__LogEntry, __pyx_vtabptr_4lxml_5etree__LogEntry) < 0) __PYX_ERR(1, 38, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__LogEntry) < 0) __PYX_ERR(1, 38, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LogEntry, (PyObject *) __pyx_ptype_4lxml_5etree__LogEntry) < 0) __PYX_ERR(1, 38, __pyx_L1_error)
  __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 = (int (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError const *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receiveGeneric = (int (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, long, 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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__BaseErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseErrorLog_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__BaseErrorLog)) __PYX_ERR(1, 187, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseErrorLog_spec, __pyx_ptype_4lxml_5etree__BaseErrorLog) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__BaseErrorLog = &__pyx_type_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__BaseErrorLog) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__BaseErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__BaseErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree__BaseErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__BaseErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_vtabptr_4lxml_5etree__BaseErrorLog) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__BaseErrorLog) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree__BaseErrorLog) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ListErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ListErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ListErrorLog)) __PYX_ERR(1, 277, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ListErrorLog_spec, __pyx_ptype_4lxml_5etree__ListErrorLog) < 0) __PYX_ERR(1, 277, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ListErrorLog = &__pyx_type_4lxml_5etree__ListErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ListErrorLog->tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ListErrorLog) < 0) __PYX_ERR(1, 277, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ListErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ListErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree__ListErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ListErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_vtabptr_4lxml_5etree__ListErrorLog) < 0) __PYX_ERR(1, 277, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ListErrorLog) < 0) __PYX_ERR(1, 277, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ListErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree__ListErrorLog) < 0) __PYX_ERR(1, 277, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ErrorLogContext = &__pyx_vtable_4lxml_5etree__ErrorLogContext;
  __pyx_vtable_4lxml_5etree__ErrorLogContext.push_error_log = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *))__pyx_f_4lxml_5etree_16_ErrorLogContext_push_error_log;
  __pyx_vtable_4lxml_5etree__ErrorLogContext.pop_error_log = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLogContext *))__pyx_f_4lxml_5etree_16_ErrorLogContext_pop_error_log;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ErrorLogContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ErrorLogContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ErrorLogContext)) __PYX_ERR(1, 395, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ErrorLogContext_spec, __pyx_ptype_4lxml_5etree__ErrorLogContext) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ErrorLogContext = &__pyx_type_4lxml_5etree__ErrorLogContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ErrorLogContext) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ErrorLogContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ErrorLogContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ErrorLogContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ErrorLogContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ErrorLogContext, __pyx_vtabptr_4lxml_5etree__ErrorLogContext) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ErrorLogContext) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ErrorLog)) __PYX_ERR(1, 432, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ErrorLog_spec, __pyx_ptype_4lxml_5etree__ErrorLog) < 0) __PYX_ERR(1, 432, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ErrorLog = &__pyx_type_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ErrorLog->tp_base = __pyx_ptype_4lxml_5etree__ListErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ErrorLog) < 0) __PYX_ERR(1, 432, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree__ErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_vtabptr_4lxml_5etree__ErrorLog) < 0) __PYX_ERR(1, 432, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ErrorLog) < 0) __PYX_ERR(1, 432, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree__ErrorLog) < 0) __PYX_ERR(1, 432, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__DomainErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DomainErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__DomainErrorLog)) __PYX_ERR(1, 485, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DomainErrorLog_spec, __pyx_ptype_4lxml_5etree__DomainErrorLog) < 0) __PYX_ERR(1, 485, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__DomainErrorLog = &__pyx_type_4lxml_5etree__DomainErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__DomainErrorLog->tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__DomainErrorLog) < 0) __PYX_ERR(1, 485, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__DomainErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__DomainErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree__DomainErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__DomainErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__DomainErrorLog, __pyx_vtabptr_4lxml_5etree__DomainErrorLog) < 0) __PYX_ERR(1, 485, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__DomainErrorLog) < 0) __PYX_ERR(1, 485, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DomainErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree__DomainErrorLog) < 0) __PYX_ERR(1, 485, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__RotatingErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__RotatingErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__RotatingErrorLog)) __PYX_ERR(1, 494, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__RotatingErrorLog_spec, __pyx_ptype_4lxml_5etree__RotatingErrorLog) < 0) __PYX_ERR(1, 494, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__RotatingErrorLog = &__pyx_type_4lxml_5etree__RotatingErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__RotatingErrorLog) < 0) __PYX_ERR(1, 494, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__RotatingErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_vtabptr_4lxml_5etree__RotatingErrorLog) < 0) __PYX_ERR(1, 494, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__RotatingErrorLog) < 0) __PYX_ERR(1, 494, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RotatingErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree__RotatingErrorLog) < 0) __PYX_ERR(1, 494, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_PyErrorLog = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PyErrorLog_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_PyErrorLog)) __PYX_ERR(1, 512, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PyErrorLog_spec, __pyx_ptype_4lxml_5etree_PyErrorLog) < 0) __PYX_ERR(1, 512, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_PyErrorLog = &__pyx_type_4lxml_5etree_PyErrorLog;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_PyErrorLog->tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_PyErrorLog) < 0) __PYX_ERR(1, 512, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_PyErrorLog->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_PyErrorLog->tp_dictoffset && __pyx_ptype_4lxml_5etree_PyErrorLog->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_PyErrorLog->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_vtabptr_4lxml_5etree_PyErrorLog) < 0) __PYX_ERR(1, 512, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_PyErrorLog) < 0) __PYX_ERR(1, 512, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PyErrorLog, (PyObject *) __pyx_ptype_4lxml_5etree_PyErrorLog) < 0) __PYX_ERR(1, 512, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__Document = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlDocumentType_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__Document)) __PYX_ERR(0, 369, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlDocumentType_spec, __pyx_ptype_4lxml_5etree__Document) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Document = &LxmlDocumentType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Document) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Document->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Document->tp_dictoffset && __pyx_ptype_4lxml_5etree__Document->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Document->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__Document, __pyx_vtabptr_4lxml_5etree__Document) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__Document) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Document, (PyObject *) __pyx_ptype_4lxml_5etree__Document) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_DocInfo = &__pyx_vtable_4lxml_5etree_DocInfo;
  __pyx_vtable_4lxml_5etree_DocInfo._get_c_dtd = (xmlDtd *(*)(struct __pyx_obj_4lxml_5etree_DocInfo *))__pyx_f_4lxml_5etree_7DocInfo__get_c_dtd;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_DocInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DocInfo_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_DocInfo)) __PYX_ERR(0, 543, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DocInfo_spec, __pyx_ptype_4lxml_5etree_DocInfo) < 0) __PYX_ERR(0, 543, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DocInfo = &__pyx_type_4lxml_5etree_DocInfo;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DocInfo) < 0) __PYX_ERR(0, 543, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DocInfo->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DocInfo->tp_dictoffset && __pyx_ptype_4lxml_5etree_DocInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DocInfo->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_DocInfo, __pyx_vtabptr_4lxml_5etree_DocInfo) < 0) __PYX_ERR(0, 543, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_DocInfo) < 0) __PYX_ERR(0, 543, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DocInfo, (PyObject *) __pyx_ptype_4lxml_5etree_DocInfo) < 0) __PYX_ERR(0, 543, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__Element = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementType_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__Element)) __PYX_ERR(0, 718, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementType_spec, __pyx_ptype_4lxml_5etree__Element) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Element = &LxmlElementType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Element) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Element->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Element->tp_dictoffset && __pyx_ptype_4lxml_5etree__Element->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Element->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__delitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__Element, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 718, __pyx_L1_error)
    if (__Pyx_IS_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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_Element_3, (PyObject *) __pyx_ptype_4lxml_5etree__Element) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Element); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree___ContentOnlyElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___ContentOnlyElement_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree___ContentOnlyElement)) __PYX_ERR(0, 1669, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___ContentOnlyElement_spec, __pyx_ptype_4lxml_5etree___ContentOnlyElement) < 0) __PYX_ERR(0, 1669, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___ContentOnlyElement = &__pyx_type_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_base = __pyx_ptype_4lxml_5etree__Element;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___ContentOnlyElement) < 0) __PYX_ERR(0, 1669, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_dictoffset && __pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___ContentOnlyElement->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1669, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1669, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1669, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree___ContentOnlyElement, __pyx_vtabptr_4lxml_5etree___ContentOnlyElement) < 0) __PYX_ERR(0, 1669, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree___ContentOnlyElement) < 0) __PYX_ERR(0, 1669, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__Comment = &__pyx_vtable_4lxml_5etree__Comment;
  __pyx_vtable_4lxml_5etree__Comment.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__Comment = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Comment_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__Comment)) __PYX_ERR(0, 1736, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Comment_spec, __pyx_ptype_4lxml_5etree__Comment) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Comment = &__pyx_type_4lxml_5etree__Comment;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__Comment->tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Comment) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Comment->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Comment->tp_dictoffset && __pyx_ptype_4lxml_5etree__Comment->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Comment->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__Comment, __pyx_vtabptr_4lxml_5etree__Comment) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__Comment) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Comment_2, (PyObject *) __pyx_ptype_4lxml_5etree__Comment) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ProcessingInstruction = &__pyx_vtable_4lxml_5etree__ProcessingInstruction;
  __pyx_vtable_4lxml_5etree__ProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ProcessingInstruction = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ProcessingInstruction_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ProcessingInstruction)) __PYX_ERR(0, 1744, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ProcessingInstruction_spec, __pyx_ptype_4lxml_5etree__ProcessingInstruction) < 0) __PYX_ERR(0, 1744, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ProcessingInstruction = &__pyx_type_4lxml_5etree__ProcessingInstruction;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ProcessingInstruction) < 0) __PYX_ERR(0, 1744, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_dictoffset && __pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ProcessingInstruction->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ProcessingInstruction, __pyx_vtabptr_4lxml_5etree__ProcessingInstruction) < 0) __PYX_ERR(0, 1744, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ProcessingInstruction) < 0) __PYX_ERR(0, 1744, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ProcessingInstruction_2, (PyObject *) __pyx_ptype_4lxml_5etree__ProcessingInstruction) < 0) __PYX_ERR(0, 1744, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__Entity = &__pyx_vtable_4lxml_5etree__Entity;
  __pyx_vtable_4lxml_5etree__Entity.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__Entity = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Entity_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__Entity)) __PYX_ERR(0, 1794, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Entity_spec, __pyx_ptype_4lxml_5etree__Entity) < 0) __PYX_ERR(0, 1794, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Entity = &__pyx_type_4lxml_5etree__Entity;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__Entity->tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Entity) < 0) __PYX_ERR(0, 1794, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Entity->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Entity->tp_dictoffset && __pyx_ptype_4lxml_5etree__Entity->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Entity->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__Entity, __pyx_vtabptr_4lxml_5etree__Entity) < 0) __PYX_ERR(0, 1794, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__Entity) < 0) __PYX_ERR(0, 1794, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Entity_2, (PyObject *) __pyx_ptype_4lxml_5etree__Entity) < 0) __PYX_ERR(0, 1794, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_QName = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_QName_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_QName)) __PYX_ERR(0, 1823, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_QName_spec, __pyx_ptype_4lxml_5etree_QName) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_QName = &__pyx_type_4lxml_5etree_QName;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_QName) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_QName->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_QName->tp_dictoffset && __pyx_ptype_4lxml_5etree_QName->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_QName->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_QName, (PyObject *) __pyx_ptype_4lxml_5etree_QName) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ElementTree = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementTreeType_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ElementTree)) __PYX_ERR(0, 1892, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementTreeType_spec, __pyx_ptype_4lxml_5etree__ElementTree) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ElementTree = &LxmlElementTreeType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ElementTree) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ElementTree->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ElementTree->tp_dictoffset && __pyx_ptype_4lxml_5etree__ElementTree->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ElementTree->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ElementTree, __pyx_vtabptr_4lxml_5etree__ElementTree) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ElementTree) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTree_2, (PyObject *) __pyx_ptype_4lxml_5etree__ElementTree) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__Attrib = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Attrib_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__Attrib)) __PYX_ERR(0, 2484, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Attrib_spec, __pyx_ptype_4lxml_5etree__Attrib) < 0) __PYX_ERR(0, 2484, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Attrib = &__pyx_type_4lxml_5etree__Attrib;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Attrib) < 0) __PYX_ERR(0, 2484, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Attrib->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Attrib->tp_dictoffset && __pyx_ptype_4lxml_5etree__Attrib->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Attrib->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Attrib, (PyObject *) __pyx_ptype_4lxml_5etree__Attrib) < 0) __PYX_ERR(0, 2484, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__AttribIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AttribIterator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__AttribIterator)) __PYX_ERR(0, 2625, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AttribIterator_spec, __pyx_ptype_4lxml_5etree__AttribIterator) < 0) __PYX_ERR(0, 2625, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__AttribIterator = &__pyx_type_4lxml_5etree__AttribIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__AttribIterator) < 0) __PYX_ERR(0, 2625, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__AttribIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__AttribIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree__AttribIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__AttribIterator->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ElementTagMatcher = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementTagMatcherType_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ElementTagMatcher)) __PYX_ERR(0, 2666, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementTagMatcherType_spec, __pyx_ptype_4lxml_5etree__ElementTagMatcher) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ElementTagMatcher = &LxmlElementTagMatcherType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ElementTagMatcher) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_dictoffset && __pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ElementTagMatcher->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ElementTagMatcher, __pyx_vtabptr_4lxml_5etree__ElementTagMatcher) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ElementTagMatcher) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTagMatcher, (PyObject *) __pyx_ptype_4lxml_5etree__ElementTagMatcher) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ElementTagMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ElementIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementIteratorType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ElementIterator)) __PYX_ERR(0, 2697, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementIteratorType_spec, __pyx_ptype_4lxml_5etree__ElementIterator) < 0) __PYX_ERR(0, 2697, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ElementIterator = &LxmlElementIteratorType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ElementIterator->tp_base = __pyx_ptype_4lxml_5etree__ElementTagMatcher;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ElementIterator) < 0) __PYX_ERR(0, 2697, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ElementIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ElementIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree__ElementIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ElementIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ElementIterator, __pyx_vtabptr_4lxml_5etree__ElementIterator) < 0) __PYX_ERR(0, 2697, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ElementIterator) < 0) __PYX_ERR(0, 2697, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementIterator, (PyObject *) __pyx_ptype_4lxml_5etree__ElementIterator) < 0) __PYX_ERR(0, 2697, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__MultiTagMatcher = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MultiTagMatcher_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__MultiTagMatcher)) __PYX_ERR(0, 2734, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MultiTagMatcher_spec, __pyx_ptype_4lxml_5etree__MultiTagMatcher) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__MultiTagMatcher = &__pyx_type_4lxml_5etree__MultiTagMatcher;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__MultiTagMatcher) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_dictoffset && __pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__MultiTagMatcher->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__MultiTagMatcher, __pyx_vtabptr_4lxml_5etree__MultiTagMatcher) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__MultiTagMatcher) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ElementMatchIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ElementMatchIterator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ElementMatchIterator)) __PYX_ERR(0, 2873, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ElementMatchIterator_spec, __pyx_ptype_4lxml_5etree__ElementMatchIterator) < 0) __PYX_ERR(0, 2873, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ElementMatchIterator = &__pyx_type_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ElementMatchIterator) < 0) __PYX_ERR(0, 2873, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ElementMatchIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ElementMatchIterator, __pyx_vtabptr_4lxml_5etree__ElementMatchIterator) < 0) __PYX_ERR(0, 2873, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ElementMatchIterator) < 0) __PYX_ERR(0, 2873, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementMatchIterator, (PyObject *) __pyx_ptype_4lxml_5etree__ElementMatchIterator) < 0) __PYX_ERR(0, 2873, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ElementChildIterator = &__pyx_vtable_4lxml_5etree_ElementChildIterator;
  __pyx_vtable_4lxml_5etree_ElementChildIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ElementChildIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementChildIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ElementChildIterator)) __PYX_ERR(0, 2902, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementChildIterator_spec, __pyx_ptype_4lxml_5etree_ElementChildIterator) < 0) __PYX_ERR(0, 2902, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementChildIterator = &__pyx_type_4lxml_5etree_ElementChildIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ElementChildIterator->tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementChildIterator) < 0) __PYX_ERR(0, 2902, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementChildIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementChildIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementChildIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementChildIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ElementChildIterator, __pyx_vtabptr_4lxml_5etree_ElementChildIterator) < 0) __PYX_ERR(0, 2902, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ElementChildIterator) < 0) __PYX_ERR(0, 2902, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementChildIterator, (PyObject *) __pyx_ptype_4lxml_5etree_ElementChildIterator) < 0) __PYX_ERR(0, 2902, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_SiblingsIterator = &__pyx_vtable_4lxml_5etree_SiblingsIterator;
  __pyx_vtable_4lxml_5etree_SiblingsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_SiblingsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SiblingsIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_SiblingsIterator)) __PYX_ERR(0, 2922, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SiblingsIterator_spec, __pyx_ptype_4lxml_5etree_SiblingsIterator) < 0) __PYX_ERR(0, 2922, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_SiblingsIterator = &__pyx_type_4lxml_5etree_SiblingsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_SiblingsIterator->tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_SiblingsIterator) < 0) __PYX_ERR(0, 2922, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_SiblingsIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_SiblingsIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree_SiblingsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_SiblingsIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_SiblingsIterator, __pyx_vtabptr_4lxml_5etree_SiblingsIterator) < 0) __PYX_ERR(0, 2922, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_SiblingsIterator) < 0) __PYX_ERR(0, 2922, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SiblingsIterator, (PyObject *) __pyx_ptype_4lxml_5etree_SiblingsIterator) < 0) __PYX_ERR(0, 2922, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_AncestorsIterator = &__pyx_vtable_4lxml_5etree_AncestorsIterator;
  __pyx_vtable_4lxml_5etree_AncestorsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ElementMatchIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_AncestorsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_AncestorsIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_AncestorsIterator)) __PYX_ERR(0, 2937, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_AncestorsIterator_spec, __pyx_ptype_4lxml_5etree_AncestorsIterator) < 0) __PYX_ERR(0, 2937, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_AncestorsIterator = &__pyx_type_4lxml_5etree_AncestorsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_AncestorsIterator->tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_AncestorsIterator) < 0) __PYX_ERR(0, 2937, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_AncestorsIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_AncestorsIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree_AncestorsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_AncestorsIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_AncestorsIterator, __pyx_vtabptr_4lxml_5etree_AncestorsIterator) < 0) __PYX_ERR(0, 2937, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_AncestorsIterator) < 0) __PYX_ERR(0, 2937, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AncestorsIterator, (PyObject *) __pyx_ptype_4lxml_5etree_AncestorsIterator) < 0) __PYX_ERR(0, 2937, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)) __PYX_ERR(0, 2947, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementDepthFirstIterator_spec, __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = &__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator, __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementDepthFirstIterator, (PyObject *) __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_ElementTextIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementTextIterator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_ElementTextIterator)) __PYX_ERR(0, 3024, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementTextIterator_spec, __pyx_ptype_4lxml_5etree_ElementTextIterator) < 0) __PYX_ERR(0, 3024, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementTextIterator = &__pyx_type_4lxml_5etree_ElementTextIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementTextIterator) < 0) __PYX_ERR(0, 3024, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementTextIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementTextIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementTextIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementTextIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTextIterator, (PyObject *) __pyx_ptype_4lxml_5etree_ElementTextIterator) < 0) __PYX_ERR(0, 3024, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_CDATA = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CDATA_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_CDATA)) __PYX_ERR(0, 3151, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CDATA_spec, __pyx_ptype_4lxml_5etree_CDATA) < 0) __PYX_ERR(0, 3151, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_CDATA = &__pyx_type_4lxml_5etree_CDATA;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_CDATA) < 0) __PYX_ERR(0, 3151, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_CDATA->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_CDATA->tp_dictoffset && __pyx_ptype_4lxml_5etree_CDATA->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_CDATA->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CDATA, (PyObject *) __pyx_ptype_4lxml_5etree_CDATA) < 0) __PYX_ERR(0, 3151, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ReadOnlyProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyProxy_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ReadOnlyProxy)) __PYX_ERR(8, 4, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyProxy_spec, __pyx_ptype_4lxml_5etree__ReadOnlyProxy) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ReadOnlyProxy = &__pyx_type_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ReadOnlyProxy) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ReadOnlyProxy->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(8, 4, __pyx_L1_error)
    if (__Pyx_IS_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_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(8, 4, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ReadOnlyProxy) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy)) __PYX_ERR(8, 248, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyPIProxy_spec, __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < 0) __PYX_ERR(8, 248, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = &__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < 0) __PYX_ERR(8, 248, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy) < 0) __PYX_ERR(8, 248, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy) < 0) __PYX_ERR(8, 248, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy)) __PYX_ERR(8, 257, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyEntityProxy_spec, __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < 0) __PYX_ERR(8, 257, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < 0) __PYX_ERR(8, 257, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy) < 0) __PYX_ERR(8, 257, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy) < 0) __PYX_ERR(8, 257, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy)) __PYX_ERR(8, 275, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ReadOnlyElementProxy_spec, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < 0) __PYX_ERR(8, 275, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = &__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < 0) __PYX_ERR(8, 275, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy) < 0) __PYX_ERR(8, 275, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy) < 0) __PYX_ERR(8, 275, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)) __PYX_ERR(8, 376, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__OpaqueNodeWrapper_spec, __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper) < 0) __PYX_ERR(8, 376, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = &__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper) < 0) __PYX_ERR(8, 376, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_dictoffset && __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper)) __PYX_ERR(8, 383, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__OpaqueDocumentWrapper_spec, __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < 0) __PYX_ERR(8, 383, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_base = __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < 0) __PYX_ERR(8, 383, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_dictoffset && __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper) < 0) __PYX_ERR(8, 383, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper) < 0) __PYX_ERR(8, 383, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy)) __PYX_ERR(8, 427, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyProxy_spec, __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < 0) __PYX_ERR(8, 427, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < 0) __PYX_ERR(8, 427, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy) < 0) __PYX_ERR(8, 427, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy) < 0) __PYX_ERR(8, 427, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy)) __PYX_ERR(8, 450, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy_spec, __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) __PYX_ERR(8, 450, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) __PYX_ERR(8, 450, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) __PYX_ERR(8, 450, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) __PYX_ERR(8, 450, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy)) __PYX_ERR(8, 467, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy_spec, __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) __PYX_ERR(8, 467, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) __PYX_ERR(8, 467, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) __PYX_ERR(8, 467, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) __PYX_ERR(8, 467, __pyx_L1_error)
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)) __PYX_ERR(8, 483, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AppendOnlyElementProxy_spec, __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < 0) __PYX_ERR(8, 483, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = &__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < 0) __PYX_ERR(8, 483, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_dictoffset && __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy) < 0) __PYX_ERR(8, 483, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy) < 0) __PYX_ERR(8, 483, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Element); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ElementBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementBaseType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ElementBase)) __PYX_ERR(9, 6, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementBaseType_spec, __pyx_ptype_4lxml_5etree_ElementBase) < 0) __PYX_ERR(9, 6, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementBase = &LxmlElementBaseType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ElementBase->tp_base = __pyx_ptype_4lxml_5etree__Element;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementBase) < 0) __PYX_ERR(9, 6, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementBase->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementBase->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementBase->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_ElementBase, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(9, 6, __pyx_L1_error)
    if (__Pyx_IS_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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementBase, (PyObject *) __pyx_ptype_4lxml_5etree_ElementBase) < 0) __PYX_ERR(9, 6, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_CommentBase = &__pyx_vtable_4lxml_5etree_CommentBase;
  __pyx_vtable_4lxml_5etree_CommentBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Comment;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_CommentBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CommentBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_CommentBase)) __PYX_ERR(9, 97, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CommentBase_spec, __pyx_ptype_4lxml_5etree_CommentBase) < 0) __PYX_ERR(9, 97, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_CommentBase = &__pyx_type_4lxml_5etree_CommentBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_CommentBase->tp_base = __pyx_ptype_4lxml_5etree__Comment;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_CommentBase) < 0) __PYX_ERR(9, 97, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_CommentBase->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_CommentBase->tp_dictoffset && __pyx_ptype_4lxml_5etree_CommentBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_CommentBase->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_CommentBase, __pyx_vtabptr_4lxml_5etree_CommentBase) < 0) __PYX_ERR(9, 97, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_CommentBase) < 0) __PYX_ERR(9, 97, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CommentBase, (PyObject *) __pyx_ptype_4lxml_5etree_CommentBase) < 0) __PYX_ERR(9, 97, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_PIBase = &__pyx_vtable_4lxml_5etree_PIBase;
  __pyx_vtable_4lxml_5etree_PIBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_PIBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PIBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_PIBase)) __PYX_ERR(9, 126, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PIBase_spec, __pyx_ptype_4lxml_5etree_PIBase) < 0) __PYX_ERR(9, 126, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_PIBase = &__pyx_type_4lxml_5etree_PIBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_PIBase->tp_base = __pyx_ptype_4lxml_5etree__ProcessingInstruction;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_PIBase) < 0) __PYX_ERR(9, 126, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_PIBase->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_PIBase->tp_dictoffset && __pyx_ptype_4lxml_5etree_PIBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_PIBase->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_PIBase, __pyx_vtabptr_4lxml_5etree_PIBase) < 0) __PYX_ERR(9, 126, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_PIBase) < 0) __PYX_ERR(9, 126, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PIBase, (PyObject *) __pyx_ptype_4lxml_5etree_PIBase) < 0) __PYX_ERR(9, 126, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_EntityBase = &__pyx_vtable_4lxml_5etree_EntityBase;
  __pyx_vtable_4lxml_5etree_EntityBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Entity;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_EntityBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_EntityBase_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_EntityBase)) __PYX_ERR(9, 157, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_EntityBase_spec, __pyx_ptype_4lxml_5etree_EntityBase) < 0) __PYX_ERR(9, 157, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_EntityBase = &__pyx_type_4lxml_5etree_EntityBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_EntityBase->tp_base = __pyx_ptype_4lxml_5etree__Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_EntityBase) < 0) __PYX_ERR(9, 157, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_EntityBase->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_EntityBase->tp_dictoffset && __pyx_ptype_4lxml_5etree_EntityBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_EntityBase->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_EntityBase, __pyx_vtabptr_4lxml_5etree_EntityBase) < 0) __PYX_ERR(9, 157, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_EntityBase) < 0) __PYX_ERR(9, 157, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_EntityBase, (PyObject *) __pyx_ptype_4lxml_5etree_EntityBase) < 0) __PYX_ERR(9, 157, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_ElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlElementClassLookupType_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_ElementClassLookup)) __PYX_ERR(9, 213, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlElementClassLookupType_spec, __pyx_ptype_4lxml_5etree_ElementClassLookup) < 0) __PYX_ERR(9, 213, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementClassLookup = &LxmlElementClassLookupType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementClassLookup) < 0) __PYX_ERR(9, 213, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_ElementClassLookup) < 0) __PYX_ERR(9, 213, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_ElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &LxmlFallbackElementClassLookupType_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)) __PYX_ERR(9, 221, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&LxmlFallbackElementClassLookupType_spec, __pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < 0) __PYX_ERR(9, 221, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup = &LxmlFallbackElementClassLookupType;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < 0) __PYX_ERR(9, 221, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_FallbackElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_FallbackElementClassLookup, __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup) < 0) __PYX_ERR(9, 221, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < 0) __PYX_ERR(9, 221, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FallbackElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_FallbackElementClassLookup) < 0) __PYX_ERR(9, 221, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_ElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup)) __PYX_ERR(9, 263, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementDefaultClassLookup_spec, __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < 0) __PYX_ERR(9, 263, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = &__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < 0) __PYX_ERR(9, 263, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementDefaultClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup) < 0) __PYX_ERR(9, 263, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup)) __PYX_ERR(9, 342, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup_spec, __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < 0) __PYX_ERR(9, 342, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < 0) __PYX_ERR(9, 342, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup, __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup) < 0) __PYX_ERR(9, 342, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < 0) __PYX_ERR(9, 342, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AttributeBasedElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup) < 0) __PYX_ERR(9, 342, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)) __PYX_ERR(9, 394, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup_spec, __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < 0) __PYX_ERR(9, 394, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < 0) __PYX_ERR(9, 394, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup, __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup) < 0) __PYX_ERR(9, 394, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < 0) __PYX_ERR(9, 394, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ParserBasedElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup) < 0) __PYX_ERR(9, 394, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup = &__pyx_vtable_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtable_4lxml_5etree_CustomElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_CustomElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_CustomElementClassLookup)) __PYX_ERR(9, 411, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_CustomElementClassLookup_spec, __pyx_ptype_4lxml_5etree_CustomElementClassLookup) < 0) __PYX_ERR(9, 411, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup = &__pyx_type_4lxml_5etree_CustomElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < 0) __PYX_ERR(9, 411, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_CustomElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_CustomElementClassLookup, __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup) < 0) __PYX_ERR(9, 411, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_CustomElementClassLookup) < 0) __PYX_ERR(9, 411, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CustomElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_CustomElementClassLookup) < 0) __PYX_ERR(9, 411, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup = &__pyx_vtable_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtable_4lxml_5etree_PythonElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_PythonElementClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_PythonElementClassLookup)) __PYX_ERR(9, 466, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_PythonElementClassLookup_spec, __pyx_ptype_4lxml_5etree_PythonElementClassLookup) < 0) __PYX_ERR(9, 466, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup = &__pyx_type_4lxml_5etree_PythonElementClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < 0) __PYX_ERR(9, 466, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_PythonElementClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_PythonElementClassLookup, __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup) < 0) __PYX_ERR(9, 466, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_PythonElementClassLookup) < 0) __PYX_ERR(9, 466, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PythonElementClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_PythonElementClassLookup) < 0) __PYX_ERR(9, 466, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_LxmlRegistryError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_LxmlRegistryError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_LxmlRegistryError)) __PYX_ERR(12, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_LxmlRegistryError_spec, __pyx_ptype_4lxml_5etree_LxmlRegistryError) < 0) __PYX_ERR(12, 3, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_LxmlRegistryError = &__pyx_type_4lxml_5etree_LxmlRegistryError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_LxmlRegistryError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(12, 3, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_LxmlRegistryError) < 0) __PYX_ERR(12, 3, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_dictoffset && __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LxmlRegistryError, (PyObject *) __pyx_ptype_4lxml_5etree_LxmlRegistryError) < 0) __PYX_ERR(12, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlRegistryError); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_NamespaceRegistryError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_NamespaceRegistryError)) __PYX_ERR(12, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_NamespaceRegistryError_spec, __pyx_ptype_4lxml_5etree_NamespaceRegistryError) < 0) __PYX_ERR(12, 7, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError = &__pyx_type_4lxml_5etree_NamespaceRegistryError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_NamespaceRegistryError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlRegistryError) < 0) __PYX_ERR(12, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_base = __pyx_ptype_4lxml_5etree_LxmlRegistryError;
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_new = __pyx_ptype_4lxml_5etree_LxmlRegistryError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_NamespaceRegistryError) < 0) __PYX_ERR(12, 7, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_dictoffset && __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_NamespaceRegistryError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_NamespaceRegistryError, (PyObject *) __pyx_ptype_4lxml_5etree_NamespaceRegistryError) < 0) __PYX_ERR(12, 7, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__NamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__NamespaceRegistry_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__NamespaceRegistry)) __PYX_ERR(12, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__NamespaceRegistry_spec, __pyx_ptype_4lxml_5etree__NamespaceRegistry) < 0) __PYX_ERR(12, 13, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__NamespaceRegistry = &__pyx_type_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__NamespaceRegistry) < 0) __PYX_ERR(12, 13, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_dictoffset && __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_vtabptr_4lxml_5etree__NamespaceRegistry) < 0) __PYX_ERR(12, 13, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__NamespaceRegistry) < 0) __PYX_ERR(12, 13, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry = &__pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry)) __PYX_ERR(12, 106, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ClassNamespaceRegistry_spec, __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < 0) __PYX_ERR(12, 106, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = &__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < 0) __PYX_ERR(12, 106, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_dictoffset && __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry) < 0) __PYX_ERR(12, 106, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry) < 0) __PYX_ERR(12, 106, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup)) __PYX_ERR(12, 120, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup_spec, __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < 0) __PYX_ERR(12, 120, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < 0) __PYX_ERR(12, 120, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_dictoffset && __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup, __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup) < 0) __PYX_ERR(12, 120, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < 0) __PYX_ERR(12, 120, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementNamespaceClassLookup, (PyObject *) __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup) < 0) __PYX_ERR(12, 120, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry)) __PYX_ERR(12, 237, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FunctionNamespaceRegistry_spec, __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < 0) __PYX_ERR(12, 237, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < 0) __PYX_ERR(12, 237, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_dictoffset && __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry) < 0) __PYX_ERR(12, 237, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry) < 0) __PYX_ERR(12, 237, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)) __PYX_ERR(12, 252, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry_spec, __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) __PYX_ERR(12, 252, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_base = __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) __PYX_ERR(12, 252, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_dictoffset && __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry, __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) __PYX_ERR(12, 252, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) __PYX_ERR(12, 252, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__InputDocument = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__InputDocument_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__InputDocument)) __PYX_ERR(13, 12, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__InputDocument_spec, __pyx_ptype_4lxml_5etree__InputDocument) < 0) __PYX_ERR(13, 12, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__InputDocument = &__pyx_type_4lxml_5etree__InputDocument;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__InputDocument) < 0) __PYX_ERR(13, 12, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__InputDocument->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__InputDocument->tp_dictoffset && __pyx_ptype_4lxml_5etree__InputDocument->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__InputDocument->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_Resolver = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Resolver_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_Resolver)) __PYX_ERR(13, 23, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Resolver_spec, __pyx_ptype_4lxml_5etree_Resolver) < 0) __PYX_ERR(13, 23, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_Resolver = &__pyx_type_4lxml_5etree_Resolver;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_Resolver) < 0) __PYX_ERR(13, 23, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_Resolver->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_Resolver->tp_dictoffset && __pyx_ptype_4lxml_5etree_Resolver->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_Resolver->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Resolver, (PyObject *) __pyx_ptype_4lxml_5etree_Resolver) < 0) __PYX_ERR(13, 23, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ResolverRegistry = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ResolverRegistry_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ResolverRegistry)) __PYX_ERR(13, 113, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ResolverRegistry_spec, __pyx_ptype_4lxml_5etree__ResolverRegistry) < 0) __PYX_ERR(13, 113, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ResolverRegistry = &__pyx_type_4lxml_5etree__ResolverRegistry;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ResolverRegistry) < 0) __PYX_ERR(13, 113, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ResolverRegistry->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ResolverRegistry->tp_dictoffset && __pyx_ptype_4lxml_5etree__ResolverRegistry->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ResolverRegistry->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_vtabptr_4lxml_5etree__ResolverRegistry) < 0) __PYX_ERR(13, 113, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ResolverRegistry) < 0) __PYX_ERR(13, 113, __pyx_L1_error)
  #endif
  __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 = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_16_ResolverContext_clear;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ExceptionContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ResolverContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ResolverContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ResolverContext)) __PYX_ERR(13, 162, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ResolverContext_spec, __pyx_ptype_4lxml_5etree__ResolverContext) < 0) __PYX_ERR(13, 162, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ResolverContext = &__pyx_type_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ResolverContext->tp_base = __pyx_ptype_4lxml_5etree__ExceptionContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ResolverContext) < 0) __PYX_ERR(13, 162, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ResolverContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ResolverContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ResolverContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ResolverContext->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ResolverContext, __pyx_vtabptr_4lxml_5etree__ResolverContext) < 0) __PYX_ERR(13, 162, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ResolverContext) < 0) __PYX_ERR(13, 162, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ParserError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ParserError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ParserError)) __PYX_ERR(2, 34, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ParserError_spec, __pyx_ptype_4lxml_5etree_ParserError) < 0) __PYX_ERR(2, 34, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ParserError = &__pyx_type_4lxml_5etree_ParserError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_ParserError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(2, 34, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ParserError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_ParserError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_ParserError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ParserError) < 0) __PYX_ERR(2, 34, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ParserError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ParserError->tp_dictoffset && __pyx_ptype_4lxml_5etree_ParserError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ParserError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ParserError, (PyObject *) __pyx_ptype_4lxml_5etree_ParserError) < 0) __PYX_ERR(2, 34, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext = &__pyx_vtable_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initMainParserContext = (int (*)(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 = (int (*)(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 = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initParserDict = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initXPathParserDict = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initDocDict = (int (*)(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 = (int (*)(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 = (int (*)(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 = (int (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ParserDictionaryContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserDictionaryContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ParserDictionaryContext)) __PYX_ERR(2, 41, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserDictionaryContext_spec, __pyx_ptype_4lxml_5etree__ParserDictionaryContext) < 0) __PYX_ERR(2, 41, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ParserDictionaryContext = &__pyx_type_4lxml_5etree__ParserDictionaryContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ParserDictionaryContext) < 0) __PYX_ERR(2, 41, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ParserDictionaryContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ParserDictionaryContext, __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext) < 0) __PYX_ERR(2, 41, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ParserDictionaryContext) < 0) __PYX_ERR(2, 41, __pyx_L1_error)
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__FileReaderContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FileReaderContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__FileReaderContext)) __PYX_ERR(2, 283, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FileReaderContext_spec, __pyx_ptype_4lxml_5etree__FileReaderContext) < 0) __PYX_ERR(2, 283, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__FileReaderContext = &__pyx_type_4lxml_5etree__FileReaderContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__FileReaderContext) < 0) __PYX_ERR(2, 283, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__FileReaderContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__FileReaderContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__FileReaderContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__FileReaderContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__FileReaderContext, __pyx_vtabptr_4lxml_5etree__FileReaderContext) < 0) __PYX_ERR(2, 283, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__FileReaderContext) < 0) __PYX_ERR(2, 283, __pyx_L1_error)
  #endif
  __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 *, struct __pyx_opt_args_4lxml_5etree_14_ParserContext_prepare *__pyx_optional_args))__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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ResolverContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ParserContext)) __PYX_ERR(2, 535, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserContext_spec, __pyx_ptype_4lxml_5etree__ParserContext) < 0) __PYX_ERR(2, 535, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ParserContext = &__pyx_type_4lxml_5etree__ParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ParserContext->tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ParserContext) < 0) __PYX_ERR(2, 535, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ParserContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ParserContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ParserContext->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ParserContext, __pyx_vtabptr_4lxml_5etree__ParserContext) < 0) __PYX_ERR(2, 535, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ParserContext) < 0) __PYX_ERR(2, 535, __pyx_L1_error)
  #endif
  __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._configureSaxContext = (int (*)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *))__pyx_f_4lxml_5etree_11_BaseParser__configureSaxContext;
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__BaseParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseParser_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__BaseParser)) __PYX_ERR(2, 814, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseParser_spec, __pyx_ptype_4lxml_5etree__BaseParser) < 0) __PYX_ERR(2, 814, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__BaseParser = &__pyx_type_4lxml_5etree__BaseParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__BaseParser) < 0) __PYX_ERR(2, 814, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__BaseParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__BaseParser->tp_dictoffset && __pyx_ptype_4lxml_5etree__BaseParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__BaseParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__BaseParser, __pyx_vtabptr_4lxml_5etree__BaseParser) < 0) __PYX_ERR(2, 814, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__BaseParser) < 0) __PYX_ERR(2, 814, __pyx_L1_error)
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__BaseParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__FeedParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FeedParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__FeedParser)) __PYX_ERR(2, 1319, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FeedParser_spec, __pyx_ptype_4lxml_5etree__FeedParser) < 0) __PYX_ERR(2, 1319, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__FeedParser = &__pyx_type_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__FeedParser->tp_base = __pyx_ptype_4lxml_5etree__BaseParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__FeedParser) < 0) __PYX_ERR(2, 1319, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__FeedParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__FeedParser->tp_dictoffset && __pyx_ptype_4lxml_5etree__FeedParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__FeedParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__FeedParser, __pyx_vtabptr_4lxml_5etree__FeedParser) < 0) __PYX_ERR(2, 1319, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__FeedParser) < 0) __PYX_ERR(2, 1319, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FeedParser, (PyObject *) __pyx_ptype_4lxml_5etree__FeedParser) < 0) __PYX_ERR(2, 1319, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XMLParser = &__pyx_vtable_4lxml_5etree_XMLParser;
  __pyx_vtable_4lxml_5etree_XMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__FeedParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLParser)) __PYX_ERR(2, 1552, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLParser_spec, __pyx_ptype_4lxml_5etree_XMLParser) < 0) __PYX_ERR(2, 1552, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLParser = &__pyx_type_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLParser->tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLParser) < 0) __PYX_ERR(2, 1552, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLParser->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_XMLParser, __pyx_vtabptr_4lxml_5etree_XMLParser) < 0) __PYX_ERR(2, 1552, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XMLParser) < 0) __PYX_ERR(2, 1552, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLParser, (PyObject *) __pyx_ptype_4lxml_5etree_XMLParser) < 0) __PYX_ERR(2, 1552, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XMLPullParser = &__pyx_vtable_4lxml_5etree_XMLPullParser;
  __pyx_vtable_4lxml_5etree_XMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLPullParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLPullParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLPullParser)) __PYX_ERR(2, 1642, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLPullParser_spec, __pyx_ptype_4lxml_5etree_XMLPullParser) < 0) __PYX_ERR(2, 1642, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLPullParser = &__pyx_type_4lxml_5etree_XMLPullParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLPullParser->tp_base = __pyx_ptype_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLPullParser) < 0) __PYX_ERR(2, 1642, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLPullParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLPullParser->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLPullParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLPullParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_XMLPullParser, __pyx_vtabptr_4lxml_5etree_XMLPullParser) < 0) __PYX_ERR(2, 1642, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XMLPullParser) < 0) __PYX_ERR(2, 1642, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLPullParser, (PyObject *) __pyx_ptype_4lxml_5etree_XMLPullParser) < 0) __PYX_ERR(2, 1642, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser = &__pyx_vtable_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtable_4lxml_5etree_ETCompatXMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ETCompatXMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ETCompatXMLParser)) __PYX_ERR(2, 1671, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ETCompatXMLParser_spec, __pyx_ptype_4lxml_5etree_ETCompatXMLParser) < 0) __PYX_ERR(2, 1671, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser = &__pyx_type_4lxml_5etree_ETCompatXMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_base = __pyx_ptype_4lxml_5etree_XMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < 0) __PYX_ERR(2, 1671, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_dictoffset && __pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ETCompatXMLParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ETCompatXMLParser, __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser) < 0) __PYX_ERR(2, 1671, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ETCompatXMLParser) < 0) __PYX_ERR(2, 1671, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ETCompatXMLParser, (PyObject *) __pyx_ptype_4lxml_5etree_ETCompatXMLParser) < 0) __PYX_ERR(2, 1671, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_HTMLParser = &__pyx_vtable_4lxml_5etree_HTMLParser;
  __pyx_vtable_4lxml_5etree_HTMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__FeedParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_HTMLParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_HTMLParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_HTMLParser)) __PYX_ERR(2, 1750, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_HTMLParser_spec, __pyx_ptype_4lxml_5etree_HTMLParser) < 0) __PYX_ERR(2, 1750, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_HTMLParser = &__pyx_type_4lxml_5etree_HTMLParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_HTMLParser->tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_HTMLParser) < 0) __PYX_ERR(2, 1750, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_HTMLParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_HTMLParser->tp_dictoffset && __pyx_ptype_4lxml_5etree_HTMLParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_HTMLParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_HTMLParser, __pyx_vtabptr_4lxml_5etree_HTMLParser) < 0) __PYX_ERR(2, 1750, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_HTMLParser) < 0) __PYX_ERR(2, 1750, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTMLParser, (PyObject *) __pyx_ptype_4lxml_5etree_HTMLParser) < 0) __PYX_ERR(2, 1750, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_HTMLPullParser = &__pyx_vtable_4lxml_5etree_HTMLPullParser;
  __pyx_vtable_4lxml_5etree_HTMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_HTMLParser;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_HTMLParser); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_HTMLPullParser = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_HTMLPullParser_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_HTMLPullParser)) __PYX_ERR(2, 1815, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_HTMLPullParser_spec, __pyx_ptype_4lxml_5etree_HTMLPullParser) < 0) __PYX_ERR(2, 1815, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_HTMLPullParser = &__pyx_type_4lxml_5etree_HTMLPullParser;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_HTMLPullParser->tp_base = __pyx_ptype_4lxml_5etree_HTMLParser;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_HTMLPullParser) < 0) __PYX_ERR(2, 1815, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_HTMLPullParser->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_HTMLPullParser->tp_dictoffset && __pyx_ptype_4lxml_5etree_HTMLPullParser->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_HTMLPullParser->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_HTMLPullParser, __pyx_vtabptr_4lxml_5etree_HTMLPullParser) < 0) __PYX_ERR(2, 1815, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_HTMLPullParser) < 0) __PYX_ERR(2, 1815, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTMLPullParser, (PyObject *) __pyx_ptype_4lxml_5etree_HTMLPullParser) < 0) __PYX_ERR(2, 1815, __pyx_L1_error)
  __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;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStartNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStartNs;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEndNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEndNs;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__SaxParserTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__SaxParserTarget_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__SaxParserTarget)) __PYX_ERR(3, 53, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__SaxParserTarget_spec, __pyx_ptype_4lxml_5etree__SaxParserTarget) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__SaxParserTarget = &__pyx_type_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__SaxParserTarget) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_dictoffset && __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__SaxParserTarget, __pyx_vtabptr_4lxml_5etree__SaxParserTarget) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__SaxParserTarget) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SaxParserTarget, (PyObject *) __pyx_ptype_4lxml_5etree__SaxParserTarget) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ParserContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__SaxParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__SaxParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__SaxParserContext)) __PYX_ERR(3, 77, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__SaxParserContext_spec, __pyx_ptype_4lxml_5etree__SaxParserContext) < 0) __PYX_ERR(3, 77, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__SaxParserContext = &__pyx_type_4lxml_5etree__SaxParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__SaxParserContext->tp_base = __pyx_ptype_4lxml_5etree__ParserContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__SaxParserContext) < 0) __PYX_ERR(3, 77, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__SaxParserContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__SaxParserContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__SaxParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__SaxParserContext->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__SaxParserContext, __pyx_vtabptr_4lxml_5etree__SaxParserContext) < 0) __PYX_ERR(3, 77, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__SaxParserContext) < 0) __PYX_ERR(3, 77, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ParseEventsIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParseEventsIterator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ParseEventsIterator)) __PYX_ERR(3, 253, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParseEventsIterator_spec, __pyx_ptype_4lxml_5etree__ParseEventsIterator) < 0) __PYX_ERR(3, 253, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ParseEventsIterator = &__pyx_type_4lxml_5etree__ParseEventsIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ParseEventsIterator) < 0) __PYX_ERR(3, 253, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_dictoffset && __pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ParseEventsIterator->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__SaxParserTarget); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_TreeBuilder = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_TreeBuilder_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_TreeBuilder)) __PYX_ERR(3, 708, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_TreeBuilder_spec, __pyx_ptype_4lxml_5etree_TreeBuilder) < 0) __PYX_ERR(3, 708, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_TreeBuilder = &__pyx_type_4lxml_5etree_TreeBuilder;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_TreeBuilder->tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_TreeBuilder) < 0) __PYX_ERR(3, 708, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_TreeBuilder->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_TreeBuilder->tp_dictoffset && __pyx_ptype_4lxml_5etree_TreeBuilder->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_TreeBuilder->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_vtabptr_4lxml_5etree_TreeBuilder) < 0) __PYX_ERR(3, 708, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_TreeBuilder) < 0) __PYX_ERR(3, 708, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TreeBuilder, (PyObject *) __pyx_ptype_4lxml_5etree_TreeBuilder) < 0) __PYX_ERR(3, 708, __pyx_L1_error)
  __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_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStartNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStartNs;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEndNs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEndNs;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__SaxParserTarget); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__PythonSaxParserTarget_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__PythonSaxParserTarget)) __PYX_ERR(4, 20, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__PythonSaxParserTarget_spec, __pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget = &__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_dictoffset && __pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__PythonSaxParserTarget->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__PythonSaxParserTarget, __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__PythonSaxParserTarget) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  #endif
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__SaxParserContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__TargetParserContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__TargetParserContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__TargetParserContext)) __PYX_ERR(4, 123, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__TargetParserContext_spec, __pyx_ptype_4lxml_5etree__TargetParserContext) < 0) __PYX_ERR(4, 123, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__TargetParserContext = &__pyx_type_4lxml_5etree__TargetParserContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__TargetParserContext->tp_base = __pyx_ptype_4lxml_5etree__SaxParserContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__TargetParserContext) < 0) __PYX_ERR(4, 123, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__TargetParserContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__TargetParserContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__TargetParserContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__TargetParserContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__TargetParserContext, __pyx_vtabptr_4lxml_5etree__TargetParserContext) < 0) __PYX_ERR(4, 123, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__TargetParserContext) < 0) __PYX_ERR(4, 123, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_SerialisationError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SerialisationError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_SerialisationError)) __PYX_ERR(10, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SerialisationError_spec, __pyx_ptype_4lxml_5etree_SerialisationError) < 0) __PYX_ERR(10, 7, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_SerialisationError = &__pyx_type_4lxml_5etree_SerialisationError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SerialisationError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(10, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_SerialisationError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_SerialisationError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_SerialisationError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_SerialisationError) < 0) __PYX_ERR(10, 7, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_SerialisationError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_SerialisationError->tp_dictoffset && __pyx_ptype_4lxml_5etree_SerialisationError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_SerialisationError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SerialisationError, (PyObject *) __pyx_ptype_4lxml_5etree_SerialisationError) < 0) __PYX_ERR(10, 7, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__FilelikeWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FilelikeWriter_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__FilelikeWriter)) __PYX_ERR(10, 609, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FilelikeWriter_spec, __pyx_ptype_4lxml_5etree__FilelikeWriter) < 0) __PYX_ERR(10, 609, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__FilelikeWriter = &__pyx_type_4lxml_5etree__FilelikeWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__FilelikeWriter) < 0) __PYX_ERR(10, 609, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__FilelikeWriter->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__FilelikeWriter->tp_dictoffset && __pyx_ptype_4lxml_5etree__FilelikeWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__FilelikeWriter->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__FilelikeWriter, __pyx_vtabptr_4lxml_5etree__FilelikeWriter) < 0) __PYX_ERR(10, 609, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__FilelikeWriter) < 0) __PYX_ERR(10, 609, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree_C14NWriterTarget = &__pyx_vtable_4lxml_5etree_C14NWriterTarget;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._resolve_prefix_name = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *))__pyx_f_4lxml_5etree_16C14NWriterTarget__resolve_prefix_name;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._qname = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__qname *__pyx_optional_args))__pyx_f_4lxml_5etree_16C14NWriterTarget__qname;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._flush = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *))__pyx_f_4lxml_5etree_16C14NWriterTarget__flush;
  __pyx_vtable_4lxml_5etree_C14NWriterTarget._start = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_C14NWriterTarget *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_4lxml_5etree_16C14NWriterTarget__start *__pyx_optional_args))__pyx_f_4lxml_5etree_16C14NWriterTarget__start;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_C14NWriterTarget = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_C14NWriterTarget_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_C14NWriterTarget)) __PYX_ERR(10, 932, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_C14NWriterTarget_spec, __pyx_ptype_4lxml_5etree_C14NWriterTarget) < 0) __PYX_ERR(10, 932, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_C14NWriterTarget = &__pyx_type_4lxml_5etree_C14NWriterTarget;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_C14NWriterTarget) < 0) __PYX_ERR(10, 932, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_dictoffset && __pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_C14NWriterTarget->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_vtabptr_4lxml_5etree_C14NWriterTarget) < 0) __PYX_ERR(10, 932, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_C14NWriterTarget) < 0) __PYX_ERR(10, 932, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_C14NWriterTarget, (PyObject *) __pyx_ptype_4lxml_5etree_C14NWriterTarget) < 0) __PYX_ERR(10, 932, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_xmlfile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_xmlfile_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_xmlfile)) __PYX_ERR(10, 1290, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_xmlfile_spec, __pyx_ptype_4lxml_5etree_xmlfile) < 0) __PYX_ERR(10, 1290, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_xmlfile = &__pyx_type_4lxml_5etree_xmlfile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_xmlfile) < 0) __PYX_ERR(10, 1290, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_xmlfile->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_xmlfile->tp_dictoffset && __pyx_ptype_4lxml_5etree_xmlfile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_xmlfile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_xmlfile, (PyObject *) __pyx_ptype_4lxml_5etree_xmlfile) < 0) __PYX_ERR(10, 1290, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_xmlfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_htmlfile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_htmlfile_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_htmlfile)) __PYX_ERR(10, 1379, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_htmlfile_spec, __pyx_ptype_4lxml_5etree_htmlfile) < 0) __PYX_ERR(10, 1379, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_htmlfile = &__pyx_type_4lxml_5etree_htmlfile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_htmlfile->tp_base = __pyx_ptype_4lxml_5etree_xmlfile;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_htmlfile) < 0) __PYX_ERR(10, 1379, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_htmlfile->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_htmlfile->tp_dictoffset && __pyx_ptype_4lxml_5etree_htmlfile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_htmlfile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_htmlfile, (PyObject *) __pyx_ptype_4lxml_5etree_htmlfile) < 0) __PYX_ERR(10, 1379, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__IncrementalFileWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__IncrementalFileWriter_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__IncrementalFileWriter)) __PYX_ERR(10, 1400, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__IncrementalFileWriter_spec, __pyx_ptype_4lxml_5etree__IncrementalFileWriter) < 0) __PYX_ERR(10, 1400, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__IncrementalFileWriter = &__pyx_type_4lxml_5etree__IncrementalFileWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__IncrementalFileWriter) < 0) __PYX_ERR(10, 1400, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_dictoffset && __pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__IncrementalFileWriter->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter) < 0) __PYX_ERR(10, 1400, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__IncrementalFileWriter) < 0) __PYX_ERR(10, 1400, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__AsyncDataWriter = &__pyx_vtable_4lxml_5etree__AsyncDataWriter;
  __pyx_vtable_4lxml_5etree__AsyncDataWriter.collect = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AsyncDataWriter *))__pyx_f_4lxml_5etree_16_AsyncDataWriter_collect;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__AsyncDataWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncDataWriter_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__AsyncDataWriter)) __PYX_ERR(10, 1704, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncDataWriter_spec, __pyx_ptype_4lxml_5etree__AsyncDataWriter) < 0) __PYX_ERR(10, 1704, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__AsyncDataWriter = &__pyx_type_4lxml_5etree__AsyncDataWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__AsyncDataWriter) < 0) __PYX_ERR(10, 1704, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_dictoffset && __pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__AsyncDataWriter->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_vtabptr_4lxml_5etree__AsyncDataWriter) < 0) __PYX_ERR(10, 1704, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__AsyncDataWriter) < 0) __PYX_ERR(10, 1704, __pyx_L1_error)
  #endif
  __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter = &__pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter;
  __pyx_vtable_4lxml_5etree__AsyncIncrementalFileWriter._flush = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AsyncIncrementalFileWriter *))__pyx_f_4lxml_5etree_27_AsyncIncrementalFileWriter__flush;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter)) __PYX_ERR(10, 1723, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter_spec, __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < 0) __PYX_ERR(10, 1723, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter = &__pyx_type_4lxml_5etree__AsyncIncrementalFileWriter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < 0) __PYX_ERR(10, 1723, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_dictoffset && __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_vtabptr_4lxml_5etree__AsyncIncrementalFileWriter) < 0) __PYX_ERR(10, 1723, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter) < 0) __PYX_ERR(10, 1723, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__AsyncFileWriterElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__AsyncFileWriterElement_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__AsyncFileWriterElement)) __PYX_ERR(10, 1788, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__AsyncFileWriterElement_spec, __pyx_ptype_4lxml_5etree__AsyncFileWriterElement) < 0) __PYX_ERR(10, 1788, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__AsyncFileWriterElement = &__pyx_type_4lxml_5etree__AsyncFileWriterElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__AsyncFileWriterElement) < 0) __PYX_ERR(10, 1788, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_dictoffset && __pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__AsyncFileWriterElement->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__FileWriterElement = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__FileWriterElement_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__FileWriterElement)) __PYX_ERR(10, 1813, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__FileWriterElement_spec, __pyx_ptype_4lxml_5etree__FileWriterElement) < 0) __PYX_ERR(10, 1813, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__FileWriterElement = &__pyx_type_4lxml_5etree__FileWriterElement;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__FileWriterElement) < 0) __PYX_ERR(10, 1813, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__FileWriterElement->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__FileWriterElement->tp_dictoffset && __pyx_ptype_4lxml_5etree__FileWriterElement->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__FileWriterElement->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__MethodChanger = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MethodChanger_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__MethodChanger)) __PYX_ERR(10, 1837, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MethodChanger_spec, __pyx_ptype_4lxml_5etree__MethodChanger) < 0) __PYX_ERR(10, 1837, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__MethodChanger = &__pyx_type_4lxml_5etree__MethodChanger;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__MethodChanger) < 0) __PYX_ERR(10, 1837, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__MethodChanger->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__MethodChanger->tp_dictoffset && __pyx_ptype_4lxml_5etree__MethodChanger->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__MethodChanger->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_iterparse = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_iterparse_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_iterparse)) __PYX_ERR(14, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_iterparse_spec, __pyx_ptype_4lxml_5etree_iterparse) < 0) __PYX_ERR(14, 5, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_iterparse = &__pyx_type_4lxml_5etree_iterparse;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_iterparse) < 0) __PYX_ERR(14, 5, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_iterparse->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_iterparse->tp_dictoffset && __pyx_ptype_4lxml_5etree_iterparse->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_iterparse->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_iterparse, __pyx_vtabptr_4lxml_5etree_iterparse) < 0) __PYX_ERR(14, 5, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_iterparse) < 0) __PYX_ERR(14, 5, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_iterparse, (PyObject *) __pyx_ptype_4lxml_5etree_iterparse) < 0) __PYX_ERR(14, 5, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_iterwalk = &__pyx_vtable_4lxml_5etree_iterwalk;
  __pyx_vtable_4lxml_5etree_iterwalk._process_non_elements = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlDocument *, xmlNode *))__pyx_f_4lxml_5etree_8iterwalk__process_non_elements;
  __pyx_vtable_4lxml_5etree_iterwalk._next_event = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *))__pyx_f_4lxml_5etree_8iterwalk__next_event;
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_iterwalk = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_iterwalk_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_iterwalk)) __PYX_ERR(14, 239, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_iterwalk_spec, __pyx_ptype_4lxml_5etree_iterwalk) < 0) __PYX_ERR(14, 239, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_iterwalk = &__pyx_type_4lxml_5etree_iterwalk;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_iterwalk) < 0) __PYX_ERR(14, 239, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_iterwalk->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_iterwalk->tp_dictoffset && __pyx_ptype_4lxml_5etree_iterwalk->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_iterwalk->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_iterwalk, __pyx_vtabptr_4lxml_5etree_iterwalk) < 0) __PYX_ERR(14, 239, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_iterwalk) < 0) __PYX_ERR(14, 239, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_iterwalk, (PyObject *) __pyx_ptype_4lxml_5etree_iterwalk) < 0) __PYX_ERR(14, 239, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__IDDict = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__IDDict_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__IDDict)) __PYX_ERR(15, 58, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__IDDict_spec, __pyx_ptype_4lxml_5etree__IDDict) < 0) __PYX_ERR(15, 58, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__IDDict = &__pyx_type_4lxml_5etree__IDDict;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__IDDict) < 0) __PYX_ERR(15, 58, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__IDDict->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__IDDict->tp_dictoffset && __pyx_ptype_4lxml_5etree__IDDict->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__IDDict->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__IDDict, __pyx_vtabptr_4lxml_5etree__IDDict) < 0) __PYX_ERR(15, 58, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__IDDict) < 0) __PYX_ERR(15, 58, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IDDict, (PyObject *) __pyx_ptype_4lxml_5etree__IDDict) < 0) __PYX_ERR(15, 58, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XIncludeError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XIncludeError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XIncludeError)) __PYX_ERR(16, 6, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XIncludeError_spec, __pyx_ptype_4lxml_5etree_XIncludeError) < 0) __PYX_ERR(16, 6, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XIncludeError = &__pyx_type_4lxml_5etree_XIncludeError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XIncludeError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(16, 6, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XIncludeError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XIncludeError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_XIncludeError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XIncludeError) < 0) __PYX_ERR(16, 6, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XIncludeError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XIncludeError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XIncludeError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XIncludeError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XIncludeError, (PyObject *) __pyx_ptype_4lxml_5etree_XIncludeError) < 0) __PYX_ERR(16, 6, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_XInclude = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XInclude_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_XInclude)) __PYX_ERR(16, 11, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XInclude_spec, __pyx_ptype_4lxml_5etree_XInclude) < 0) __PYX_ERR(16, 11, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XInclude = &__pyx_type_4lxml_5etree_XInclude;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XInclude) < 0) __PYX_ERR(16, 11, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XInclude->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XInclude->tp_dictoffset && __pyx_ptype_4lxml_5etree_XInclude->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XInclude->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XInclude, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(16, 11, __pyx_L1_error)
    if (__Pyx_IS_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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_XInclude, (PyObject *) __pyx_ptype_4lxml_5etree_XInclude) < 0) __PYX_ERR(16, 11, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathError)) __PYX_ERR(11, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathError_spec, __pyx_ptype_4lxml_5etree_XPathError) < 0) __PYX_ERR(11, 3, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathError = &__pyx_type_4lxml_5etree_XPathError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(11, 3, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XPathError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_XPathError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathError) < 0) __PYX_ERR(11, 3, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathError, (PyObject *) __pyx_ptype_4lxml_5etree_XPathError) < 0) __PYX_ERR(11, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XPathError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathEvalError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathEvalError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathEvalError)) __PYX_ERR(11, 7, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathEvalError_spec, __pyx_ptype_4lxml_5etree_XPathEvalError) < 0) __PYX_ERR(11, 7, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathEvalError = &__pyx_type_4lxml_5etree_XPathEvalError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathEvalError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XPathError) < 0) __PYX_ERR(11, 7, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathEvalError->tp_dealloc = __pyx_ptype_4lxml_5etree_XPathError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XPathEvalError->tp_base = __pyx_ptype_4lxml_5etree_XPathError;
  __pyx_ptype_4lxml_5etree_XPathEvalError->tp_new = __pyx_ptype_4lxml_5etree_XPathError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathEvalError) < 0) __PYX_ERR(11, 7, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathEvalError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathEvalError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathEvalError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathEvalError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathEvalError, (PyObject *) __pyx_ptype_4lxml_5etree_XPathEvalError) < 0) __PYX_ERR(11, 7, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XPathEvalError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathFunctionError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathFunctionError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathFunctionError)) __PYX_ERR(11, 11, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathFunctionError_spec, __pyx_ptype_4lxml_5etree_XPathFunctionError) < 0) __PYX_ERR(11, 11, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathFunctionError = &__pyx_type_4lxml_5etree_XPathFunctionError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathFunctionError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XPathEvalError) < 0) __PYX_ERR(11, 11, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_dealloc = __pyx_ptype_4lxml_5etree_XPathEvalError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_base = __pyx_ptype_4lxml_5etree_XPathEvalError;
  __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_new = __pyx_ptype_4lxml_5etree_XPathEvalError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathFunctionError) < 0) __PYX_ERR(11, 11, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathFunctionError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathFunctionError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathFunctionError, (PyObject *) __pyx_ptype_4lxml_5etree_XPathFunctionError) < 0) __PYX_ERR(11, 11, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XPathEvalError); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathResultError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathResultError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathResultError)) __PYX_ERR(11, 15, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathResultError_spec, __pyx_ptype_4lxml_5etree_XPathResultError) < 0) __PYX_ERR(11, 15, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathResultError = &__pyx_type_4lxml_5etree_XPathResultError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XPathResultError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XPathEvalError) < 0) __PYX_ERR(11, 15, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathResultError->tp_dealloc = __pyx_ptype_4lxml_5etree_XPathEvalError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XPathResultError->tp_base = __pyx_ptype_4lxml_5etree_XPathEvalError;
  __pyx_ptype_4lxml_5etree_XPathResultError->tp_new = __pyx_ptype_4lxml_5etree_XPathEvalError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathResultError) < 0) __PYX_ERR(11, 15, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathResultError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathResultError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathResultError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathResultError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathResultError, (PyObject *) __pyx_ptype_4lxml_5etree_XPathResultError) < 0) __PYX_ERR(11, 15, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ExsltRegExp = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ExsltRegExp_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ExsltRegExp)) __PYX_ERR(11, 457, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ExsltRegExp_spec, __pyx_ptype_4lxml_5etree__ExsltRegExp) < 0) __PYX_ERR(11, 457, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ExsltRegExp = &__pyx_type_4lxml_5etree__ExsltRegExp;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ExsltRegExp) < 0) __PYX_ERR(11, 457, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ExsltRegExp->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ExsltRegExp->tp_dictoffset && __pyx_ptype_4lxml_5etree__ExsltRegExp->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ExsltRegExp->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_vtabptr_4lxml_5etree__ExsltRegExp) < 0) __PYX_ERR(11, 457, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ExsltRegExp) < 0) __PYX_ERR(11, 457, __pyx_L1_error)
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__BaseContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__BaseContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__BaseContext)) __PYX_ERR(11, 29, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__BaseContext_spec, __pyx_ptype_4lxml_5etree__BaseContext) < 0) __PYX_ERR(11, 29, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__BaseContext = &__pyx_type_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__BaseContext) < 0) __PYX_ERR(11, 29, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__BaseContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__BaseContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__BaseContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__BaseContext->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__BaseContext, __pyx_vtabptr_4lxml_5etree__BaseContext) < 0) __PYX_ERR(11, 29, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__BaseContext) < 0) __PYX_ERR(11, 29, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(&PyUnicode_Type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ElementUnicodeResult_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__ElementUnicodeResult)) __PYX_ERR(11, 720, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ElementUnicodeResult_spec, __pyx_ptype_4lxml_5etree__ElementUnicodeResult) < 0) __PYX_ERR(11, 720, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult = &__pyx_type_4lxml_5etree__ElementUnicodeResult;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult) != sizeof(PyUnicodeObject)) {
    if (__Pyx_validate_extern_base((&PyUnicode_Type)) < 0) __PYX_ERR(11, 720, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_base = (&PyUnicode_Type);
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ElementUnicodeResult) < 0) __PYX_ERR(11, 720, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_dictoffset && __pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ElementUnicodeResult->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementUnicodeResult, (PyObject *) __pyx_ptype_4lxml_5etree__ElementUnicodeResult) < 0) __PYX_ERR(11, 720, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__BaseContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XPathContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XPathContext)) __PYX_ERR(18, 50, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathContext_spec, __pyx_ptype_4lxml_5etree__XPathContext) < 0) __PYX_ERR(18, 50, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XPathContext = &__pyx_type_4lxml_5etree__XPathContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XPathContext->tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XPathContext) < 0) __PYX_ERR(18, 50, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XPathContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XPathContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__XPathContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XPathContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XPathContext, __pyx_vtabptr_4lxml_5etree__XPathContext) < 0) __PYX_ERR(18, 50, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XPathContext) < 0) __PYX_ERR(18, 50, __pyx_L1_error)
  #endif
  __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._build_parse_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_parse_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._build_eval_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__build_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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__XPathEvaluatorBase = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XPathEvaluatorBase_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)) __PYX_ERR(18, 116, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XPathEvaluatorBase_spec, __pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < 0) __PYX_ERR(18, 116, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XPathEvaluatorBase = &__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < 0) __PYX_ERR(18, 116, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_dictoffset && __pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XPathEvaluatorBase->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XPathEvaluatorBase, __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase) < 0) __PYX_ERR(18, 116, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < 0) __PYX_ERR(18, 116, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathEvaluatorBase, (PyObject *) __pyx_ptype_4lxml_5etree__XPathEvaluatorBase) < 0) __PYX_ERR(18, 116, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator = &__pyx_vtable_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtable_4lxml_5etree_XPathElementEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathElementEvaluator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathElementEvaluator)) __PYX_ERR(18, 221, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathElementEvaluator_spec, __pyx_ptype_4lxml_5etree_XPathElementEvaluator) < 0) __PYX_ERR(18, 221, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator = &__pyx_type_4lxml_5etree_XPathElementEvaluator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < 0) __PYX_ERR(18, 221, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathElementEvaluator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(18, 221, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator) < 0) __PYX_ERR(18, 221, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XPathElementEvaluator) < 0) __PYX_ERR(18, 221, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathElementEvaluator, (PyObject *) __pyx_ptype_4lxml_5etree_XPathElementEvaluator) < 0) __PYX_ERR(18, 221, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator = &__pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)) __PYX_ERR(18, 298, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPathDocumentEvaluator_spec, __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < 0) __PYX_ERR(18, 298, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = &__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_base = __pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < 0) __PYX_ERR(18, 298, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(18, 298, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_XPathDocumentEvaluator, __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator) < 0) __PYX_ERR(18, 298, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < 0) __PYX_ERR(18, 298, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPathDocumentEvaluator, (PyObject *) __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator) < 0) __PYX_ERR(18, 298, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_XPath = &__pyx_vtable_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_XPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XPath = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XPath_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XPath)) __PYX_ERR(18, 377, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XPath_spec, __pyx_ptype_4lxml_5etree_XPath) < 0) __PYX_ERR(18, 377, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XPath = &__pyx_type_4lxml_5etree_XPath;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XPath->tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XPath) < 0) __PYX_ERR(18, 377, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XPath->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XPath->tp_dictoffset && __pyx_ptype_4lxml_5etree_XPath->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XPath->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XPath, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(18, 377, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_XPath, __pyx_vtabptr_4lxml_5etree_XPath) < 0) __PYX_ERR(18, 377, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XPath) < 0) __PYX_ERR(18, 377, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XPath, (PyObject *) __pyx_ptype_4lxml_5etree_XPath) < 0) __PYX_ERR(18, 377, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XPath); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_ETXPath = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_ETXPath_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_ETXPath)) __PYX_ERR(18, 451, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_ETXPath_spec, __pyx_ptype_4lxml_5etree_ETXPath) < 0) __PYX_ERR(18, 451, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_ETXPath = &__pyx_type_4lxml_5etree_ETXPath;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_ETXPath->tp_base = __pyx_ptype_4lxml_5etree_XPath;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_ETXPath) < 0) __PYX_ERR(18, 451, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_ETXPath->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_ETXPath->tp_dictoffset && __pyx_ptype_4lxml_5etree_ETXPath->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_ETXPath->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_ETXPath, __pyx_vtabptr_4lxml_5etree_ETXPath) < 0) __PYX_ERR(18, 451, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_ETXPath) < 0) __PYX_ERR(18, 451, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ETXPath, (PyObject *) __pyx_ptype_4lxml_5etree_ETXPath) < 0) __PYX_ERR(18, 451, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XSLTError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTError)) __PYX_ERR(5, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTError_spec, __pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTError = &__pyx_type_4lxml_5etree_XSLTError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XSLTError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XSLTError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_XSLTError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTError, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XSLTParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTParseError)) __PYX_ERR(5, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTParseError_spec, __pyx_ptype_4lxml_5etree_XSLTParseError) < 0) __PYX_ERR(5, 9, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTParseError = &__pyx_type_4lxml_5etree_XSLTParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XSLTParseError->tp_dealloc = __pyx_ptype_4lxml_5etree_XSLTError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XSLTParseError->tp_base = __pyx_ptype_4lxml_5etree_XSLTError;
  __pyx_ptype_4lxml_5etree_XSLTParseError->tp_new = __pyx_ptype_4lxml_5etree_XSLTError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTParseError) < 0) __PYX_ERR(5, 9, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTParseError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTParseError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTParseError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTParseError, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTParseError) < 0) __PYX_ERR(5, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XSLTApplyError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTApplyError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTApplyError)) __PYX_ERR(5, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTApplyError_spec, __pyx_ptype_4lxml_5etree_XSLTApplyError) < 0) __PYX_ERR(5, 13, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTApplyError = &__pyx_type_4lxml_5etree_XSLTApplyError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTApplyError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_dealloc = __pyx_ptype_4lxml_5etree_XSLTError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_base = __pyx_ptype_4lxml_5etree_XSLTError;
  __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_new = __pyx_ptype_4lxml_5etree_XSLTError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTApplyError) < 0) __PYX_ERR(5, 13, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTApplyError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTApplyError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTApplyError, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTApplyError) < 0) __PYX_ERR(5, 13, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XSLTError); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XSLTExtensionError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTExtensionError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTExtensionError)) __PYX_ERR(5, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTExtensionError_spec, __pyx_ptype_4lxml_5etree_XSLTExtensionError) < 0) __PYX_ERR(5, 21, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTExtensionError = &__pyx_type_4lxml_5etree_XSLTExtensionError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtensionError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XSLTError) < 0) __PYX_ERR(5, 21, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_dealloc = __pyx_ptype_4lxml_5etree_XSLTError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_base = __pyx_ptype_4lxml_5etree_XSLTError;
  __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_new = __pyx_ptype_4lxml_5etree_XSLTError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTExtensionError) < 0) __PYX_ERR(5, 21, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTExtensionError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTExtensionError, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTExtensionError) < 0) __PYX_ERR(5, 21, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ResolverContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XSLTResolverContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTResolverContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XSLTResolverContext)) __PYX_ERR(5, 48, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTResolverContext_spec, __pyx_ptype_4lxml_5etree__XSLTResolverContext) < 0) __PYX_ERR(5, 48, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XSLTResolverContext = &__pyx_type_4lxml_5etree__XSLTResolverContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XSLTResolverContext) < 0) __PYX_ERR(5, 48, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XSLTResolverContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XSLTResolverContext, __pyx_vtabptr_4lxml_5etree__XSLTResolverContext) < 0) __PYX_ERR(5, 48, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XSLTResolverContext) < 0) __PYX_ERR(5, 48, __pyx_L1_error)
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_XSLTAccessControl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTAccessControl_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTAccessControl)) __PYX_ERR(5, 168, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTAccessControl_spec, __pyx_ptype_4lxml_5etree_XSLTAccessControl) < 0) __PYX_ERR(5, 168, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTAccessControl = &__pyx_type_4lxml_5etree_XSLTAccessControl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTAccessControl) < 0) __PYX_ERR(5, 168, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_vtabptr_4lxml_5etree_XSLTAccessControl) < 0) __PYX_ERR(5, 168, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XSLTAccessControl) < 0) __PYX_ERR(5, 168, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTAccessControl, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTAccessControl) < 0) __PYX_ERR(5, 168, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__BaseContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XSLTContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTContext_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XSLTContext)) __PYX_ERR(5, 271, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTContext_spec, __pyx_ptype_4lxml_5etree__XSLTContext) < 0) __PYX_ERR(5, 271, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XSLTContext = &__pyx_type_4lxml_5etree__XSLTContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XSLTContext->tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XSLTContext) < 0) __PYX_ERR(5, 271, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XSLTContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XSLTContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__XSLTContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XSLTContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XSLTContext, __pyx_vtabptr_4lxml_5etree__XSLTContext) < 0) __PYX_ERR(5, 271, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XSLTContext) < 0) __PYX_ERR(5, 271, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)) __PYX_ERR(5, 324, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTQuotedStringParam_spec, __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam) < 0) __PYX_ERR(5, 324, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = &__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam) < 0) __PYX_ERR(5, 324, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_dictoffset && __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_XSLT = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLT_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_XSLT)) __PYX_ERR(5, 334, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLT_spec, __pyx_ptype_4lxml_5etree_XSLT) < 0) __PYX_ERR(5, 334, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLT = &__pyx_type_4lxml_5etree_XSLT;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLT) < 0) __PYX_ERR(5, 334, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLT->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLT->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLT->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLT->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(5, 334, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__.doc = __pyx_doc_4lxml_5etree_4XSLT_16__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_4XSLT_16__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_XSLT, __pyx_vtabptr_4lxml_5etree_XSLT) < 0) __PYX_ERR(5, 334, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XSLT) < 0) __PYX_ERR(5, 334, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLT, (PyObject *) __pyx_ptype_4lxml_5etree_XSLT) < 0) __PYX_ERR(5, 334, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__ElementTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XSLTResultTree = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTResultTree_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XSLTResultTree)) __PYX_ERR(5, 699, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XSLTResultTree->tp_as_buffer = &__pyx_tp_as_buffer__XSLTResultTree;
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTResultTree_spec, __pyx_ptype_4lxml_5etree__XSLTResultTree) < 0) __PYX_ERR(5, 699, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XSLTResultTree = &__pyx_type_4lxml_5etree__XSLTResultTree;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XSLTResultTree->tp_base = __pyx_ptype_4lxml_5etree__ElementTree;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XSLTResultTree) < 0) __PYX_ERR(5, 699, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XSLTResultTree->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XSLTResultTree->tp_dictoffset && __pyx_ptype_4lxml_5etree__XSLTResultTree->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XSLTResultTree->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XSLTResultTree, __pyx_vtabptr_4lxml_5etree__XSLTResultTree) < 0) __PYX_ERR(5, 699, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XSLTResultTree) < 0) __PYX_ERR(5, 699, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTResultTree, (PyObject *) __pyx_ptype_4lxml_5etree__XSLTResultTree) < 0) __PYX_ERR(5, 699, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction = &__pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree_PIBase;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_PIBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction)) __PYX_ERR(5, 873, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__XSLTProcessingInstruction_spec, __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < 0) __PYX_ERR(5, 873, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = &__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_base = __pyx_ptype_4lxml_5etree_PIBase;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < 0) __PYX_ERR(5, 873, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_dictoffset && __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction) < 0) __PYX_ERR(5, 873, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < 0) __PYX_ERR(5, 873, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTProcessingInstruction, (PyObject *) __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction) < 0) __PYX_ERR(5, 873, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree_XSLTExtension = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XSLTExtension_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree_XSLTExtension)) __PYX_ERR(19, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XSLTExtension_spec, __pyx_ptype_4lxml_5etree_XSLTExtension) < 0) __PYX_ERR(19, 3, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XSLTExtension = &__pyx_type_4lxml_5etree_XSLTExtension;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XSLTExtension) < 0) __PYX_ERR(19, 3, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XSLTExtension->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XSLTExtension->tp_dictoffset && __pyx_ptype_4lxml_5etree_XSLTExtension->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XSLTExtension->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_vtabptr_4lxml_5etree_XSLTExtension) < 0) __PYX_ERR(19, 3, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XSLTExtension) < 0) __PYX_ERR(19, 3, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XSLTExtension, (PyObject *) __pyx_ptype_4lxml_5etree_XSLTExtension) < 0) __PYX_ERR(19, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_DocumentInvalid = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DocumentInvalid_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_DocumentInvalid)) __PYX_ERR(0, 3663, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DocumentInvalid_spec, __pyx_ptype_4lxml_5etree_DocumentInvalid) < 0) __PYX_ERR(0, 3663, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DocumentInvalid = &__pyx_type_4lxml_5etree_DocumentInvalid;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DocumentInvalid) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(0, 3663, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DocumentInvalid) < 0) __PYX_ERR(0, 3663, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DocumentInvalid->tp_dictoffset && __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DocumentInvalid->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DocumentInvalid, (PyObject *) __pyx_ptype_4lxml_5etree_DocumentInvalid) < 0) __PYX_ERR(0, 3663, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__Validator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__Validator_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__Validator)) __PYX_ERR(0, 3671, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__Validator_spec, __pyx_ptype_4lxml_5etree__Validator) < 0) __PYX_ERR(0, 3671, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__Validator = &__pyx_type_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__Validator) < 0) __PYX_ERR(0, 3671, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__Validator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__Validator->tp_dictoffset && __pyx_ptype_4lxml_5etree__Validator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__Validator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__Validator, __pyx_vtabptr_4lxml_5etree__Validator) < 0) __PYX_ERR(0, 3671, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__Validator) < 0) __PYX_ERR(0, 3671, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Validator, (PyObject *) __pyx_ptype_4lxml_5etree__Validator) < 0) __PYX_ERR(0, 3671, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_DTDError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_DTDError)) __PYX_ERR(20, 4, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDError_spec, __pyx_ptype_4lxml_5etree_DTDError) < 0) __PYX_ERR(20, 4, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DTDError = &__pyx_type_4lxml_5etree_DTDError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(20, 4, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_DTDError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_DTDError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_DTDError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DTDError) < 0) __PYX_ERR(20, 4, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DTDError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DTDError->tp_dictoffset && __pyx_ptype_4lxml_5etree_DTDError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DTDError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DTDError, (PyObject *) __pyx_ptype_4lxml_5etree_DTDError) < 0) __PYX_ERR(20, 4, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_DTDError); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_DTDParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_DTDParseError)) __PYX_ERR(20, 8, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDParseError_spec, __pyx_ptype_4lxml_5etree_DTDParseError) < 0) __PYX_ERR(20, 8, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DTDParseError = &__pyx_type_4lxml_5etree_DTDParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_DTDError) < 0) __PYX_ERR(20, 8, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_DTDParseError->tp_dealloc = __pyx_ptype_4lxml_5etree_DTDError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_DTDParseError->tp_base = __pyx_ptype_4lxml_5etree_DTDError;
  __pyx_ptype_4lxml_5etree_DTDParseError->tp_new = __pyx_ptype_4lxml_5etree_DTDError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DTDParseError) < 0) __PYX_ERR(20, 8, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DTDParseError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DTDParseError->tp_dictoffset && __pyx_ptype_4lxml_5etree_DTDParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DTDParseError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DTDParseError, (PyObject *) __pyx_ptype_4lxml_5etree_DTDParseError) < 0) __PYX_ERR(20, 8, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_DTDError); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_DTDValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTDValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_DTDValidateError)) __PYX_ERR(20, 12, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTDValidateError_spec, __pyx_ptype_4lxml_5etree_DTDValidateError) < 0) __PYX_ERR(20, 12, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DTDValidateError = &__pyx_type_4lxml_5etree_DTDValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_DTDValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_DTDError) < 0) __PYX_ERR(20, 12, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_DTDValidateError->tp_dealloc = __pyx_ptype_4lxml_5etree_DTDError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_DTDValidateError->tp_base = __pyx_ptype_4lxml_5etree_DTDError;
  __pyx_ptype_4lxml_5etree_DTDValidateError->tp_new = __pyx_ptype_4lxml_5etree_DTDError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DTDValidateError) < 0) __PYX_ERR(20, 12, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DTDValidateError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DTDValidateError->tp_dictoffset && __pyx_ptype_4lxml_5etree_DTDValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DTDValidateError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DTDValidateError, (PyObject *) __pyx_ptype_4lxml_5etree_DTDValidateError) < 0) __PYX_ERR(20, 12, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__DTDElementContentDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDElementContentDecl_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__DTDElementContentDecl)) __PYX_ERR(20, 24, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDElementContentDecl_spec, __pyx_ptype_4lxml_5etree__DTDElementContentDecl) < 0) __PYX_ERR(20, 24, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__DTDElementContentDecl = &__pyx_type_4lxml_5etree__DTDElementContentDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__DTDElementContentDecl) < 0) __PYX_ERR(20, 24, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_dictoffset && __pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__DTDElementContentDecl->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__DTDAttributeDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDAttributeDecl_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__DTDAttributeDecl)) __PYX_ERR(20, 94, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDAttributeDecl_spec, __pyx_ptype_4lxml_5etree__DTDAttributeDecl) < 0) __PYX_ERR(20, 94, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__DTDAttributeDecl = &__pyx_type_4lxml_5etree__DTDAttributeDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__DTDAttributeDecl) < 0) __PYX_ERR(20, 94, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_dictoffset && __pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__DTDAttributeDecl->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__DTDElementDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDElementDecl_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__DTDElementDecl)) __PYX_ERR(20, 177, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDElementDecl_spec, __pyx_ptype_4lxml_5etree__DTDElementDecl) < 0) __PYX_ERR(20, 177, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__DTDElementDecl = &__pyx_type_4lxml_5etree__DTDElementDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__DTDElementDecl) < 0) __PYX_ERR(20, 177, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__DTDElementDecl->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__DTDElementDecl->tp_dictoffset && __pyx_ptype_4lxml_5etree__DTDElementDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__DTDElementDecl->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__DTDEntityDecl = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__DTDEntityDecl_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__DTDEntityDecl)) __PYX_ERR(20, 240, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__DTDEntityDecl_spec, __pyx_ptype_4lxml_5etree__DTDEntityDecl) < 0) __PYX_ERR(20, 240, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__DTDEntityDecl = &__pyx_type_4lxml_5etree__DTDEntityDecl;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__DTDEntityDecl) < 0) __PYX_ERR(20, 240, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_dictoffset && __pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__DTDEntityDecl->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __pyx_vtabptr_4lxml_5etree_DTD = &__pyx_vtable_4lxml_5etree_DTD;
  __pyx_vtable_4lxml_5etree_DTD.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_DTD = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_DTD_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_DTD)) __PYX_ERR(20, 270, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_DTD_spec, __pyx_ptype_4lxml_5etree_DTD) < 0) __PYX_ERR(20, 270, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_DTD = &__pyx_type_4lxml_5etree_DTD;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_DTD->tp_base = __pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_DTD) < 0) __PYX_ERR(20, 270, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_DTD->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_DTD->tp_dictoffset && __pyx_ptype_4lxml_5etree_DTD->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_DTD->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_DTD, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(20, 270, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_DTD, __pyx_vtabptr_4lxml_5etree_DTD) < 0) __PYX_ERR(20, 270, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_DTD) < 0) __PYX_ERR(20, 270, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DTD, (PyObject *) __pyx_ptype_4lxml_5etree_DTD) < 0) __PYX_ERR(20, 270, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_RelaxNGError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_RelaxNGError)) __PYX_ERR(21, 18, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGError_spec, __pyx_ptype_4lxml_5etree_RelaxNGError) < 0) __PYX_ERR(21, 18, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_RelaxNGError = &__pyx_type_4lxml_5etree_RelaxNGError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(21, 18, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_RelaxNGError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_RelaxNGError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_RelaxNGError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_RelaxNGError) < 0) __PYX_ERR(21, 18, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_RelaxNGError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_RelaxNGError->tp_dictoffset && __pyx_ptype_4lxml_5etree_RelaxNGError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_RelaxNGError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RelaxNGError, (PyObject *) __pyx_ptype_4lxml_5etree_RelaxNGError) < 0) __PYX_ERR(21, 18, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_RelaxNGParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_RelaxNGParseError)) __PYX_ERR(21, 22, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGParseError_spec, __pyx_ptype_4lxml_5etree_RelaxNGParseError) < 0) __PYX_ERR(21, 22, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_RelaxNGParseError = &__pyx_type_4lxml_5etree_RelaxNGParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_RelaxNGError) < 0) __PYX_ERR(21, 22, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_dealloc = __pyx_ptype_4lxml_5etree_RelaxNGError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_base = __pyx_ptype_4lxml_5etree_RelaxNGError;
  __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_new = __pyx_ptype_4lxml_5etree_RelaxNGError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_RelaxNGParseError) < 0) __PYX_ERR(21, 22, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_dictoffset && __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_RelaxNGParseError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RelaxNGParseError, (PyObject *) __pyx_ptype_4lxml_5etree_RelaxNGParseError) < 0) __PYX_ERR(21, 22, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_RelaxNGError); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNGValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_RelaxNGValidateError)) __PYX_ERR(21, 26, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNGValidateError_spec, __pyx_ptype_4lxml_5etree_RelaxNGValidateError) < 0) __PYX_ERR(21, 26, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError = &__pyx_type_4lxml_5etree_RelaxNGValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_RelaxNGValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_RelaxNGError) < 0) __PYX_ERR(21, 26, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_dealloc = __pyx_ptype_4lxml_5etree_RelaxNGError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_base = __pyx_ptype_4lxml_5etree_RelaxNGError;
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_new = __pyx_ptype_4lxml_5etree_RelaxNGError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_RelaxNGValidateError) < 0) __PYX_ERR(21, 26, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_dictoffset && __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_RelaxNGValidateError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RelaxNGValidateError, (PyObject *) __pyx_ptype_4lxml_5etree_RelaxNGValidateError) < 0) __PYX_ERR(21, 26, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_RelaxNG = &__pyx_vtable_4lxml_5etree_RelaxNG;
  __pyx_vtable_4lxml_5etree_RelaxNG.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_RelaxNG = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_RelaxNG_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_RelaxNG)) __PYX_ERR(21, 34, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_RelaxNG_spec, __pyx_ptype_4lxml_5etree_RelaxNG) < 0) __PYX_ERR(21, 34, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_RelaxNG = &__pyx_type_4lxml_5etree_RelaxNG;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_RelaxNG->tp_base = __pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_RelaxNG) < 0) __PYX_ERR(21, 34, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_RelaxNG->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_RelaxNG->tp_dictoffset && __pyx_ptype_4lxml_5etree_RelaxNG->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_RelaxNG->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNG, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(21, 34, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_RelaxNG, __pyx_vtabptr_4lxml_5etree_RelaxNG) < 0) __PYX_ERR(21, 34, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_RelaxNG) < 0) __PYX_ERR(21, 34, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RelaxNG, (PyObject *) __pyx_ptype_4lxml_5etree_RelaxNG) < 0) __PYX_ERR(21, 34, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLSchemaError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLSchemaError)) __PYX_ERR(22, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaError_spec, __pyx_ptype_4lxml_5etree_XMLSchemaError) < 0) __PYX_ERR(22, 5, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLSchemaError = &__pyx_type_4lxml_5etree_XMLSchemaError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(22, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLSchemaError) < 0) __PYX_ERR(22, 5, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLSchemaError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLSchemaError, (PyObject *) __pyx_ptype_4lxml_5etree_XMLSchemaError) < 0) __PYX_ERR(22, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XMLSchemaError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLSchemaParseError)) __PYX_ERR(22, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaParseError_spec, __pyx_ptype_4lxml_5etree_XMLSchemaParseError) < 0) __PYX_ERR(22, 9, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError = &__pyx_type_4lxml_5etree_XMLSchemaParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XMLSchemaError) < 0) __PYX_ERR(22, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_dealloc = __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_base = __pyx_ptype_4lxml_5etree_XMLSchemaError;
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_new = __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLSchemaParseError) < 0) __PYX_ERR(22, 9, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLSchemaParseError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLSchemaParseError, (PyObject *) __pyx_ptype_4lxml_5etree_XMLSchemaParseError) < 0) __PYX_ERR(22, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_XMLSchemaError); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchemaValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLSchemaValidateError)) __PYX_ERR(22, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchemaValidateError_spec, __pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < 0) __PYX_ERR(22, 13, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError = &__pyx_type_4lxml_5etree_XMLSchemaValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_XMLSchemaValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_XMLSchemaError) < 0) __PYX_ERR(22, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_dealloc = __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_base = __pyx_ptype_4lxml_5etree_XMLSchemaError;
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_new = __pyx_ptype_4lxml_5etree_XMLSchemaError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < 0) __PYX_ERR(22, 13, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLSchemaValidateError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLSchemaValidateError, (PyObject *) __pyx_ptype_4lxml_5etree_XMLSchemaValidateError) < 0) __PYX_ERR(22, 13, __pyx_L1_error)
  __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;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_XMLSchema = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_XMLSchema_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_XMLSchema)) __PYX_ERR(22, 26, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_XMLSchema_spec, __pyx_ptype_4lxml_5etree_XMLSchema) < 0) __PYX_ERR(22, 26, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_XMLSchema = &__pyx_type_4lxml_5etree_XMLSchema;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_XMLSchema->tp_base = __pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_XMLSchema) < 0) __PYX_ERR(22, 26, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_XMLSchema->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_XMLSchema->tp_dictoffset && __pyx_ptype_4lxml_5etree_XMLSchema->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_XMLSchema->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_XMLSchema, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(22, 26, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_XMLSchema, __pyx_vtabptr_4lxml_5etree_XMLSchema) < 0) __PYX_ERR(22, 26, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_XMLSchema) < 0) __PYX_ERR(22, 26, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_XMLSchema, (PyObject *) __pyx_ptype_4lxml_5etree_XMLSchema) < 0) __PYX_ERR(22, 26, __pyx_L1_error)
  __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 CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext)) __PYX_ERR(22, 160, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__ParserSchemaValidationContext_spec, __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < 0) __PYX_ERR(22, 160, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = &__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < 0) __PYX_ERR(22, 160, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_dictoffset && __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext, __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext) < 0) __PYX_ERR(22, 160, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext) < 0) __PYX_ERR(22, 160, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_LxmlError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_SchematronError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_SchematronError)) __PYX_ERR(23, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronError_spec, __pyx_ptype_4lxml_5etree_SchematronError) < 0) __PYX_ERR(23, 5, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_SchematronError = &__pyx_type_4lxml_5etree_SchematronError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_LxmlError) < 0) __PYX_ERR(23, 5, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_SchematronError->tp_dealloc = __pyx_ptype_4lxml_5etree_LxmlError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_SchematronError->tp_base = __pyx_ptype_4lxml_5etree_LxmlError;
  __pyx_ptype_4lxml_5etree_SchematronError->tp_new = __pyx_ptype_4lxml_5etree_LxmlError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_SchematronError) < 0) __PYX_ERR(23, 5, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_SchematronError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_SchematronError->tp_dictoffset && __pyx_ptype_4lxml_5etree_SchematronError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_SchematronError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SchematronError, (PyObject *) __pyx_ptype_4lxml_5etree_SchematronError) < 0) __PYX_ERR(23, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_SchematronError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_SchematronParseError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronParseError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_SchematronParseError)) __PYX_ERR(23, 9, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronParseError_spec, __pyx_ptype_4lxml_5etree_SchematronParseError) < 0) __PYX_ERR(23, 9, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_SchematronParseError = &__pyx_type_4lxml_5etree_SchematronParseError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronParseError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_SchematronError) < 0) __PYX_ERR(23, 9, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_SchematronParseError->tp_dealloc = __pyx_ptype_4lxml_5etree_SchematronError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_SchematronParseError->tp_base = __pyx_ptype_4lxml_5etree_SchematronError;
  __pyx_ptype_4lxml_5etree_SchematronParseError->tp_new = __pyx_ptype_4lxml_5etree_SchematronError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_SchematronParseError) < 0) __PYX_ERR(23, 9, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_SchematronParseError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_SchematronParseError->tp_dictoffset && __pyx_ptype_4lxml_5etree_SchematronParseError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_SchematronParseError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SchematronParseError, (PyObject *) __pyx_ptype_4lxml_5etree_SchematronParseError) < 0) __PYX_ERR(23, 9, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree_SchematronError); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_SchematronValidateError = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_SchematronValidateError_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_SchematronValidateError)) __PYX_ERR(23, 13, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_SchematronValidateError_spec, __pyx_ptype_4lxml_5etree_SchematronValidateError) < 0) __PYX_ERR(23, 13, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_SchematronValidateError = &__pyx_type_4lxml_5etree_SchematronValidateError;
  #endif
  if (sizeof(struct __pyx_obj_4lxml_5etree_SchematronValidateError) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base(__pyx_ptype_4lxml_5etree_SchematronError) < 0) __PYX_ERR(23, 13, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_dealloc = __pyx_ptype_4lxml_5etree_SchematronError->tp_dealloc;
  __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_base = __pyx_ptype_4lxml_5etree_SchematronError;
  __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_new = __pyx_ptype_4lxml_5etree_SchematronError->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_SchematronValidateError) < 0) __PYX_ERR(23, 13, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_SchematronValidateError->tp_dictoffset && __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_SchematronValidateError->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SchematronValidateError, (PyObject *) __pyx_ptype_4lxml_5etree_SchematronValidateError) < 0) __PYX_ERR(23, 13, __pyx_L1_error)
  __pyx_vtabptr_4lxml_5etree_Schematron = &__pyx_vtable_4lxml_5etree_Schematron;
  __pyx_vtable_4lxml_5etree_Schematron.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_4lxml_5etree__Validator); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_5etree_Schematron = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree_Schematron_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_ptype_4lxml_5etree_Schematron)) __PYX_ERR(23, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree_Schematron_spec, __pyx_ptype_4lxml_5etree_Schematron) < 0) __PYX_ERR(23, 21, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree_Schematron = &__pyx_type_4lxml_5etree_Schematron;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_4lxml_5etree_Schematron->tp_base = __pyx_ptype_4lxml_5etree__Validator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree_Schematron) < 0) __PYX_ERR(23, 21, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree_Schematron->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree_Schematron->tp_dictoffset && __pyx_ptype_4lxml_5etree_Schematron->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree_Schematron->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_4lxml_5etree_Schematron, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(23, 21, __pyx_L1_error)
    if (__Pyx_IS_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_ptype_4lxml_5etree_Schematron, __pyx_vtabptr_4lxml_5etree_Schematron) < 0) __PYX_ERR(23, 21, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_4lxml_5etree_Schematron) < 0) __PYX_ERR(23, 21, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Schematron, (PyObject *) __pyx_ptype_4lxml_5etree_Schematron) < 0) __PYX_ERR(23, 21, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree__MemDebug = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree__MemDebug_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree__MemDebug)) __PYX_ERR(25, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree__MemDebug_spec, __pyx_ptype_4lxml_5etree__MemDebug) < 0) __PYX_ERR(25, 3, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree__MemDebug = &__pyx_type_4lxml_5etree__MemDebug;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree__MemDebug) < 0) __PYX_ERR(25, 3, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree__MemDebug->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree__MemDebug->tp_dictoffset && __pyx_ptype_4lxml_5etree__MemDebug->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree__MemDebug->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file)) __PYX_ERR(10, 589, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file) < 0) __PYX_ERR(10, 589, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file = &__pyx_type_4lxml_5etree___pyx_scope_struct___open_utf8_file;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file) < 0) __PYX_ERR(10, 589, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct___open_utf8_file->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces)) __PYX_ERR(10, 1005, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) < 0) __PYX_ERR(10, 1005, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces = &__pyx_type_4lxml_5etree___pyx_scope_struct_1__iter_namespaces;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces) < 0) __PYX_ERR(10, 1005, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_1__iter_namespaces->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__)) __PYX_ERR(10, 1359, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__) < 0) __PYX_ERR(10, 1359, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_2___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__) < 0) __PYX_ERR(10, 1359, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_2___aenter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__)) __PYX_ERR(10, 1370, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__) < 0) __PYX_ERR(10, 1370, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_3___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__) < 0) __PYX_ERR(10, 1370, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_3___aexit__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush)) __PYX_ERR(10, 1746, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush) < 0) __PYX_ERR(10, 1746, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush = &__pyx_type_4lxml_5etree___pyx_scope_struct_4_flush;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush) < 0) __PYX_ERR(10, 1746, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_4_flush->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration)) __PYX_ERR(10, 1752, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration) < 0) __PYX_ERR(10, 1752, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration = &__pyx_type_4lxml_5etree___pyx_scope_struct_5_write_declaration;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration) < 0) __PYX_ERR(10, 1752, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_5_write_declaration->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype)) __PYX_ERR(10, 1758, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype) < 0) __PYX_ERR(10, 1758, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype = &__pyx_type_4lxml_5etree___pyx_scope_struct_6_write_doctype;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype) < 0) __PYX_ERR(10, 1758, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_6_write_doctype->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write)) __PYX_ERR(10, 1764, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_7_write_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write = &__pyx_type_4lxml_5etree___pyx_scope_struct_7_write;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_7_write->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close)) __PYX_ERR(10, 1777, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_8__close_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close) < 0) __PYX_ERR(10, 1777, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close = &__pyx_type_4lxml_5etree___pyx_scope_struct_8__close;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close) < 0) __PYX_ERR(10, 1777, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_8__close->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__)) __PYX_ERR(10, 1797, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__) < 0) __PYX_ERR(10, 1797, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_9___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__) < 0) __PYX_ERR(10, 1797, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_9___aenter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__)) __PYX_ERR(10, 1803, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__) < 0) __PYX_ERR(10, 1803, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_10___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__) < 0) __PYX_ERR(10, 1803, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_10___aexit__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__)) __PYX_ERR(10, 1865, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__) < 0) __PYX_ERR(10, 1865, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_11___aenter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__) < 0) __PYX_ERR(10, 1865, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_11___aenter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__)) __PYX_ERR(10, 1869, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit___spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__) < 0) __PYX_ERR(10, 1869, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__ = &__pyx_type_4lxml_5etree___pyx_scope_struct_12___aexit__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__) < 0) __PYX_ERR(10, 1869, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_12___aexit__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues)) __PYX_ERR(20, 163, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues) < 0) __PYX_ERR(20, 163, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues = &__pyx_type_4lxml_5etree___pyx_scope_struct_13_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues) < 0) __PYX_ERR(20, 163, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_13_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes)) __PYX_ERR(20, 223, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes) < 0) __PYX_ERR(20, 223, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes = &__pyx_type_4lxml_5etree___pyx_scope_struct_14_iterattributes;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes) < 0) __PYX_ERR(20, 223, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_14_iterattributes->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements)) __PYX_ERR(20, 326, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements) < 0) __PYX_ERR(20, 326, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements = &__pyx_type_4lxml_5etree___pyx_scope_struct_15_iterelements;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements) < 0) __PYX_ERR(20, 326, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_15_iterelements->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec, NULL); if (unlikely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities)) __PYX_ERR(20, 339, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities_spec, __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities) < 0) __PYX_ERR(20, 339, __pyx_L1_error)
  #else
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities = &__pyx_type_4lxml_5etree___pyx_scope_struct_16_iterentities;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities) < 0) __PYX_ERR(20, 339, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_dictoffset && __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_4lxml_5etree___pyx_scope_struct_16_iterentities->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_10(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_10(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_10(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_10(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_0_10); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(26, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_etree(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_etree},
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "etree",
      __pyx_k_The_lxml_etree_module_implement, /* m_doc */
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      0, /* m_size */
    #elif CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstate), /* m_size */
    #else
      -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      (freefunc)__pyx_module_cleanup /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      (freefunc)__pyx_module_cleanup /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif
#endif

#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initetree(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initetree(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_etree(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_etree(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
#else
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
#endif
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
#if CYTHON_COMPILING_IN_LIMITED_API
            result = PyModule_AddObject(module, to_name, value);
#else
            result = PyDict_SetItemString(moddict, to_name, value);
#endif
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    moddict = module;
#else
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
#endif
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_etree(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned char *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  struct __pyx_opt_args_4lxml_5etree___unpackIntVersion __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'etree' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("etree", __pyx_methods, __pyx_k_The_lxml_etree_module_implement, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #elif CYTHON_USE_MODULE_STATE
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  {
    int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "etree" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #endif
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #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("__Pyx_PyMODINIT_FUNC PyInit_etree(void)", 0);
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_lxml__etree) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "lxml.etree")) {
      if (unlikely((PyDict_SetItemString(modules, "lxml.etree", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "lxml/etree.pyx":9
 * """
 * 
 * __docformat__ = "restructuredtext en"             # <<<<<<<<<<<<<<
 * 
 * __all__ = [
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_docformat, __pyx_kp_u_restructuredtext_en) < 0) __PYX_ERR(0, 9, __pyx_L1_error)

  /* "lxml/etree.pyx":11
 * __docformat__ = "restructuredtext en"
 * 
 * __all__ = [             # <<<<<<<<<<<<<<
 *     'AttributeBasedElementClassLookup', 'C14NError', 'C14NWriterTarget', 'CDATA',
 *     'Comment', 'CommentBase', 'CustomElementClassLookup', 'DEBUG',
 */
  __pyx_t_2 = PyList_New(113); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_AttributeBasedElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_AttributeBasedElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_AttributeBasedElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_C14NError);
  __Pyx_GIVEREF(__pyx_n_u_C14NError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_C14NError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_C14NWriterTarget);
  __Pyx_GIVEREF(__pyx_n_u_C14NWriterTarget);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_u_C14NWriterTarget)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_CDATA);
  __Pyx_GIVEREF(__pyx_n_u_CDATA);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_u_CDATA)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Comment);
  __Pyx_GIVEREF(__pyx_n_u_Comment);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_u_Comment)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_CommentBase);
  __Pyx_GIVEREF(__pyx_n_u_CommentBase);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_u_CommentBase)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_CustomElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_CustomElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_u_CustomElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DEBUG);
  __Pyx_GIVEREF(__pyx_n_u_DEBUG);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_u_DEBUG)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DTD);
  __Pyx_GIVEREF(__pyx_n_u_DTD);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_u_DTD)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DTDError);
  __Pyx_GIVEREF(__pyx_n_u_DTDError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_u_DTDError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DTDParseError);
  __Pyx_GIVEREF(__pyx_n_u_DTDParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_u_DTDParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DTDValidateError);
  __Pyx_GIVEREF(__pyx_n_u_DTDValidateError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_u_DTDValidateError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_DocumentInvalid);
  __Pyx_GIVEREF(__pyx_n_u_DocumentInvalid);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 12, __pyx_n_u_DocumentInvalid)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ETCompatXMLParser);
  __Pyx_GIVEREF(__pyx_n_u_ETCompatXMLParser);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 13, __pyx_n_u_ETCompatXMLParser)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ETXPath);
  __Pyx_GIVEREF(__pyx_n_u_ETXPath);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 14, __pyx_n_u_ETXPath)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Element_2);
  __Pyx_GIVEREF(__pyx_n_u_Element_2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 15, __pyx_n_u_Element_2)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ElementBase);
  __Pyx_GIVEREF(__pyx_n_u_ElementBase);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 16, __pyx_n_u_ElementBase)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_ElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 17, __pyx_n_u_ElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ElementDefaultClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_ElementDefaultClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 18, __pyx_n_u_ElementDefaultClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ElementNamespaceClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_ElementNamespaceClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 19, __pyx_n_u_ElementNamespaceClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ElementTree);
  __Pyx_GIVEREF(__pyx_n_u_ElementTree);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 20, __pyx_n_u_ElementTree)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Entity);
  __Pyx_GIVEREF(__pyx_n_u_Entity);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 21, __pyx_n_u_Entity)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_EntityBase);
  __Pyx_GIVEREF(__pyx_n_u_EntityBase);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 22, __pyx_n_u_EntityBase)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Error);
  __Pyx_GIVEREF(__pyx_n_u_Error);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 23, __pyx_n_u_Error)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ErrorDomains);
  __Pyx_GIVEREF(__pyx_n_u_ErrorDomains);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 24, __pyx_n_u_ErrorDomains)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ErrorLevels);
  __Pyx_GIVEREF(__pyx_n_u_ErrorLevels);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 25, __pyx_n_u_ErrorLevels)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ErrorTypes);
  __Pyx_GIVEREF(__pyx_n_u_ErrorTypes);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 26, __pyx_n_u_ErrorTypes)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Extension);
  __Pyx_GIVEREF(__pyx_n_u_Extension);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 27, __pyx_n_u_Extension)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_FallbackElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_FallbackElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 28, __pyx_n_u_FallbackElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_FunctionNamespace);
  __Pyx_GIVEREF(__pyx_n_u_FunctionNamespace);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 29, __pyx_n_u_FunctionNamespace)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_HTML);
  __Pyx_GIVEREF(__pyx_n_u_HTML);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 30, __pyx_n_u_HTML)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_HTMLParser);
  __Pyx_GIVEREF(__pyx_n_u_HTMLParser);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 31, __pyx_n_u_HTMLParser)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LIBXML_COMPILED_VERSION);
  __Pyx_GIVEREF(__pyx_n_u_LIBXML_COMPILED_VERSION);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 32, __pyx_n_u_LIBXML_COMPILED_VERSION)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LIBXML_VERSION);
  __Pyx_GIVEREF(__pyx_n_u_LIBXML_VERSION);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 33, __pyx_n_u_LIBXML_VERSION)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LIBXSLT_COMPILED_VERSION);
  __Pyx_GIVEREF(__pyx_n_u_LIBXSLT_COMPILED_VERSION);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 34, __pyx_n_u_LIBXSLT_COMPILED_VERSION)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LIBXSLT_VERSION);
  __Pyx_GIVEREF(__pyx_n_u_LIBXSLT_VERSION);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 35, __pyx_n_u_LIBXSLT_VERSION)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LXML_VERSION);
  __Pyx_GIVEREF(__pyx_n_u_LXML_VERSION);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 36, __pyx_n_u_LXML_VERSION)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LxmlError);
  __Pyx_GIVEREF(__pyx_n_u_LxmlError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 37, __pyx_n_u_LxmlError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LxmlRegistryError);
  __Pyx_GIVEREF(__pyx_n_u_LxmlRegistryError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 38, __pyx_n_u_LxmlRegistryError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_LxmlSyntaxError);
  __Pyx_GIVEREF(__pyx_n_u_LxmlSyntaxError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 39, __pyx_n_u_LxmlSyntaxError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_NamespaceRegistryError);
  __Pyx_GIVEREF(__pyx_n_u_NamespaceRegistryError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 40, __pyx_n_u_NamespaceRegistryError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_PI);
  __Pyx_GIVEREF(__pyx_n_u_PI);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 41, __pyx_n_u_PI)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_PIBase);
  __Pyx_GIVEREF(__pyx_n_u_PIBase);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 42, __pyx_n_u_PIBase)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ParseError);
  __Pyx_GIVEREF(__pyx_n_u_ParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 43, __pyx_n_u_ParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ParserBasedElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_ParserBasedElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 44, __pyx_n_u_ParserBasedElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ParserError);
  __Pyx_GIVEREF(__pyx_n_u_ParserError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 45, __pyx_n_u_ParserError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_ProcessingInstruction);
  __Pyx_GIVEREF(__pyx_n_u_ProcessingInstruction);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 46, __pyx_n_u_ProcessingInstruction)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_PyErrorLog);
  __Pyx_GIVEREF(__pyx_n_u_PyErrorLog);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 47, __pyx_n_u_PyErrorLog)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_PythonElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_u_PythonElementClassLookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 48, __pyx_n_u_PythonElementClassLookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_QName);
  __Pyx_GIVEREF(__pyx_n_u_QName);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 49, __pyx_n_u_QName)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_RelaxNG);
  __Pyx_GIVEREF(__pyx_n_u_RelaxNG);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 50, __pyx_n_u_RelaxNG)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_RelaxNGError);
  __Pyx_GIVEREF(__pyx_n_u_RelaxNGError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 51, __pyx_n_u_RelaxNGError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_RelaxNGErrorTypes);
  __Pyx_GIVEREF(__pyx_n_u_RelaxNGErrorTypes);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 52, __pyx_n_u_RelaxNGErrorTypes)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_RelaxNGParseError);
  __Pyx_GIVEREF(__pyx_n_u_RelaxNGParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 53, __pyx_n_u_RelaxNGParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_RelaxNGValidateError);
  __Pyx_GIVEREF(__pyx_n_u_RelaxNGValidateError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 54, __pyx_n_u_RelaxNGValidateError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Resolver);
  __Pyx_GIVEREF(__pyx_n_u_Resolver);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 55, __pyx_n_u_Resolver)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_Schematron);
  __Pyx_GIVEREF(__pyx_n_u_Schematron);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 56, __pyx_n_u_Schematron)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_SchematronError);
  __Pyx_GIVEREF(__pyx_n_u_SchematronError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 57, __pyx_n_u_SchematronError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_SchematronParseError);
  __Pyx_GIVEREF(__pyx_n_u_SchematronParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 58, __pyx_n_u_SchematronParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_SchematronValidateError);
  __Pyx_GIVEREF(__pyx_n_u_SchematronValidateError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 59, __pyx_n_u_SchematronValidateError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_SerialisationError);
  __Pyx_GIVEREF(__pyx_n_u_SerialisationError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 60, __pyx_n_u_SerialisationError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_SubElement);
  __Pyx_GIVEREF(__pyx_n_u_SubElement);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 61, __pyx_n_u_SubElement)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_TreeBuilder);
  __Pyx_GIVEREF(__pyx_n_u_TreeBuilder);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 62, __pyx_n_u_TreeBuilder)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XInclude);
  __Pyx_GIVEREF(__pyx_n_u_XInclude);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 63, __pyx_n_u_XInclude)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XIncludeError);
  __Pyx_GIVEREF(__pyx_n_u_XIncludeError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 64, __pyx_n_u_XIncludeError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XML);
  __Pyx_GIVEREF(__pyx_n_u_XML);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 65, __pyx_n_u_XML)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLDTDID);
  __Pyx_GIVEREF(__pyx_n_u_XMLDTDID);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 66, __pyx_n_u_XMLDTDID)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLID);
  __Pyx_GIVEREF(__pyx_n_u_XMLID);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 67, __pyx_n_u_XMLID)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLParser);
  __Pyx_GIVEREF(__pyx_n_u_XMLParser);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 68, __pyx_n_u_XMLParser)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLSchema);
  __Pyx_GIVEREF(__pyx_n_u_XMLSchema);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 69, __pyx_n_u_XMLSchema)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLSchemaError);
  __Pyx_GIVEREF(__pyx_n_u_XMLSchemaError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 70, __pyx_n_u_XMLSchemaError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLSchemaParseError);
  __Pyx_GIVEREF(__pyx_n_u_XMLSchemaParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 71, __pyx_n_u_XMLSchemaParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLSchemaValidateError);
  __Pyx_GIVEREF(__pyx_n_u_XMLSchemaValidateError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 72, __pyx_n_u_XMLSchemaValidateError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLSyntaxError);
  __Pyx_GIVEREF(__pyx_n_u_XMLSyntaxError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 73, __pyx_n_u_XMLSyntaxError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XMLTreeBuilder);
  __Pyx_GIVEREF(__pyx_n_u_XMLTreeBuilder);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 74, __pyx_n_u_XMLTreeBuilder)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPath);
  __Pyx_GIVEREF(__pyx_n_u_XPath);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 75, __pyx_n_u_XPath)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathDocumentEvaluator);
  __Pyx_GIVEREF(__pyx_n_u_XPathDocumentEvaluator);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 76, __pyx_n_u_XPathDocumentEvaluator)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathError);
  __Pyx_GIVEREF(__pyx_n_u_XPathError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 77, __pyx_n_u_XPathError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathEvalError);
  __Pyx_GIVEREF(__pyx_n_u_XPathEvalError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 78, __pyx_n_u_XPathEvalError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathEvaluator);
  __Pyx_GIVEREF(__pyx_n_u_XPathEvaluator);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 79, __pyx_n_u_XPathEvaluator)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathFunctionError);
  __Pyx_GIVEREF(__pyx_n_u_XPathFunctionError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 80, __pyx_n_u_XPathFunctionError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathResultError);
  __Pyx_GIVEREF(__pyx_n_u_XPathResultError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 81, __pyx_n_u_XPathResultError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XPathSyntaxError);
  __Pyx_GIVEREF(__pyx_n_u_XPathSyntaxError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 82, __pyx_n_u_XPathSyntaxError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLT);
  __Pyx_GIVEREF(__pyx_n_u_XSLT);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 83, __pyx_n_u_XSLT)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTAccessControl);
  __Pyx_GIVEREF(__pyx_n_u_XSLTAccessControl);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 84, __pyx_n_u_XSLTAccessControl)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTApplyError);
  __Pyx_GIVEREF(__pyx_n_u_XSLTApplyError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 85, __pyx_n_u_XSLTApplyError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTError);
  __Pyx_GIVEREF(__pyx_n_u_XSLTError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 86, __pyx_n_u_XSLTError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTExtension);
  __Pyx_GIVEREF(__pyx_n_u_XSLTExtension);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 87, __pyx_n_u_XSLTExtension)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTExtensionError);
  __Pyx_GIVEREF(__pyx_n_u_XSLTExtensionError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 88, __pyx_n_u_XSLTExtensionError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTParseError);
  __Pyx_GIVEREF(__pyx_n_u_XSLTParseError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 89, __pyx_n_u_XSLTParseError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_XSLTSaveError);
  __Pyx_GIVEREF(__pyx_n_u_XSLTSaveError);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 90, __pyx_n_u_XSLTSaveError)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_canonicalize);
  __Pyx_GIVEREF(__pyx_n_u_canonicalize);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 91, __pyx_n_u_canonicalize)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_cleanup_namespaces);
  __Pyx_GIVEREF(__pyx_n_u_cleanup_namespaces);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 92, __pyx_n_u_cleanup_namespaces)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_clear_error_log_2);
  __Pyx_GIVEREF(__pyx_n_u_clear_error_log_2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 93, __pyx_n_u_clear_error_log_2)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_dump);
  __Pyx_GIVEREF(__pyx_n_u_dump);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 94, __pyx_n_u_dump)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_fromstring);
  __Pyx_GIVEREF(__pyx_n_u_fromstring);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 95, __pyx_n_u_fromstring)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_fromstringlist);
  __Pyx_GIVEREF(__pyx_n_u_fromstringlist);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 96, __pyx_n_u_fromstringlist)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_get_default_parser);
  __Pyx_GIVEREF(__pyx_n_u_get_default_parser);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 97, __pyx_n_u_get_default_parser)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_iselement);
  __Pyx_GIVEREF(__pyx_n_u_iselement);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 98, __pyx_n_u_iselement)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_iterparse);
  __Pyx_GIVEREF(__pyx_n_u_iterparse);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 99, __pyx_n_u_iterparse)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_iterwalk);
  __Pyx_GIVEREF(__pyx_n_u_iterwalk);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 100, __pyx_n_u_iterwalk)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_parse);
  __Pyx_GIVEREF(__pyx_n_u_parse);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 101, __pyx_n_u_parse)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_parseid);
  __Pyx_GIVEREF(__pyx_n_u_parseid);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 102, __pyx_n_u_parseid)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_register_namespace);
  __Pyx_GIVEREF(__pyx_n_u_register_namespace);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 103, __pyx_n_u_register_namespace)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_set_default_parser);
  __Pyx_GIVEREF(__pyx_n_u_set_default_parser);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 104, __pyx_n_u_set_default_parser)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_set_element_class_lookup);
  __Pyx_GIVEREF(__pyx_n_u_set_element_class_lookup);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 105, __pyx_n_u_set_element_class_lookup)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_strip_attributes);
  __Pyx_GIVEREF(__pyx_n_u_strip_attributes);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 106, __pyx_n_u_strip_attributes)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_strip_elements);
  __Pyx_GIVEREF(__pyx_n_u_strip_elements);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 107, __pyx_n_u_strip_elements)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_strip_tags);
  __Pyx_GIVEREF(__pyx_n_u_strip_tags);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 108, __pyx_n_u_strip_tags)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_tostring);
  __Pyx_GIVEREF(__pyx_n_u_tostring);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 109, __pyx_n_u_tostring)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_tostringlist);
  __Pyx_GIVEREF(__pyx_n_u_tostringlist);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 110, __pyx_n_u_tostringlist)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_tounicode);
  __Pyx_GIVEREF(__pyx_n_u_tounicode);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 111, __pyx_n_u_tounicode)) __PYX_ERR(0, 11, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_use_global_python_log);
  __Pyx_GIVEREF(__pyx_n_u_use_global_python_log);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 112, __pyx_n_u_use_global_python_log)) __PYX_ERR(0, 11, __pyx_L1_error);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":63
 * 
 * cdef object os_path_abspath
 * from os.path import abspath as os_path_abspath             # <<<<<<<<<<<<<<
 * 
 * cdef object BytesIO, StringIO
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_abspath);
  __Pyx_GIVEREF(__pyx_n_s_abspath);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_abspath)) __PYX_ERR(0, 63, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_os_path, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_abspath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_os_path_abspath, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":66
 * 
 * cdef object BytesIO, StringIO
 * from io import BytesIO, StringIO             # <<<<<<<<<<<<<<
 * 
 * cdef object OrderedDict
 */
  __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_BytesIO);
  __Pyx_GIVEREF(__pyx_n_s_BytesIO);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_BytesIO)) __PYX_ERR(0, 66, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_s_StringIO);
  __Pyx_GIVEREF(__pyx_n_s_StringIO);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_StringIO)) __PYX_ERR(0, 66, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_io, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_BytesIO);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_StringIO);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_StringIO, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":69
 * 
 * cdef object OrderedDict
 * from collections import OrderedDict             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementpath
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_OrderedDict);
  __Pyx_GIVEREF(__pyx_n_s_OrderedDict);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_OrderedDict)) __PYX_ERR(0, 69, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_OrderedDict);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_OrderedDict, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":72
 * 
 * cdef object _elementpath
 * from lxml import _elementpath             # <<<<<<<<<<<<<<
 * 
 * cdef object sys
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_elementpath);
  __Pyx_GIVEREF(__pyx_n_s_elementpath);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_elementpath)) __PYX_ERR(0, 72, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_elementpath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__elementpath);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__elementpath, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":75
 * 
 * cdef object sys
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cdef object re
 */
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_sys);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_sys, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":78
 * 
 * cdef object re
 * import re             # <<<<<<<<<<<<<<
 * 
 * cdef object partial
 */
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_re, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_re);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_re, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":81
 * 
 * cdef object partial
 * from functools import partial             # <<<<<<<<<<<<<<
 * 
 * cdef object islice
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_partial);
  __Pyx_GIVEREF(__pyx_n_s_partial);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_partial)) __PYX_ERR(0, 81, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_partial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_partial);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_partial, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":84
 * 
 * cdef object islice
 * from itertools import islice             # <<<<<<<<<<<<<<
 * 
 * cdef object ITER_EMPTY = iter(())
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_islice);
  __Pyx_GIVEREF(__pyx_n_s_islice);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_islice)) __PYX_ERR(0, 84, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_islice); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_islice);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_islice, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":86
 * from itertools import islice
 * 
 * cdef object ITER_EMPTY = iter(())             # <<<<<<<<<<<<<<
 * 
 * cdef object MutableMapping
 */
  __pyx_t_2 = PyObject_GetIter(__pyx_empty_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_ITER_EMPTY, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":89
 * 
 * cdef object MutableMapping
 * from collections.abc import MutableMapping             # <<<<<<<<<<<<<<
 * 
 * class _ImmutableMapping(MutableMapping):
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_MutableMapping);
  __Pyx_GIVEREF(__pyx_n_s_MutableMapping);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_MutableMapping)) __PYX_ERR(0, 89, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_MutableMapping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_MutableMapping);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_MutableMapping, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":91
 * from collections.abc import MutableMapping
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_4lxml_5etree_MutableMapping);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree_MutableMapping);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_4lxml_5etree_MutableMapping)) __PYX_ERR(0, 91, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_ImmutableMapping, __pyx_n_s_ImmutableMapping, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2 != __pyx_t_3) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(0, 91, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":92
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__, 0, __pyx_n_s_ImmutableMapping___getitem, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_getitem, __pyx_t_3) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":95
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__, 0, __pyx_n_s_ImmutableMapping___setitem, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__110)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_setitem, __pyx_t_3) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":98
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__, 0, __pyx_n_s_ImmutableMapping___delitem, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_delitem, __pyx_t_3) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":101
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__, 0, __pyx_n_s_ImmutableMapping___contains, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__112)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_contains, __pyx_t_3) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":104
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__, 0, __pyx_n_s_ImmutableMapping___len, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_len, __pyx_t_3) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":107
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__, 0, __pyx_n_s_ImmutableMapping___iter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_iter_2, __pyx_t_3) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":109
 *     def __iter__(self):
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__             # <<<<<<<<<<<<<<
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
 */
  __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_n_s_iter_2);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_iter_2);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "lxml/etree.pyx":91
 * from collections.abc import MutableMapping
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_ImmutableMapping, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ImmutableMapping, __pyx_t_3) < 0) __PYX_ERR(0, 91, __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_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":111
 *     iterkeys = itervalues = iteritems = __iter__
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()             # <<<<<<<<<<<<<<
 * del _ImmutableMapping
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ImmutableMapping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":112
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
 * del _ImmutableMapping             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_ImmutableMapping) < 0) __PYX_ERR(0, 112, __pyx_L1_error)

  /* "lxml/etree.pyx":130
 * 
 * # 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_ERR(0, 130, __pyx_L1_error)

  /* "lxml/etree.pyx":141
 * 
 * # initialize parser (and threading)
 * xmlparser.xmlInitParser()             # <<<<<<<<<<<<<<
 * 
 * # global per-thread setup
 */
  xmlInitParser();

  /* "lxml/etree.pyx":144
 * 
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)             # <<<<<<<<<<<<<<
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 */
  (void)(xmlThrDefIndentTreeOutput(1));

  /* "lxml/etree.pyx":145
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)
 * tree.xmlThrDefLineNumbersDefaultValue(1)             # <<<<<<<<<<<<<<
 * 
 * _initThreadLogging()
 */
  (void)(xmlThrDefLineNumbersDefaultValue(1));

  /* "lxml/etree.pyx":147
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 * _initThreadLogging()             # <<<<<<<<<<<<<<
 * 
 * # filename encoding
 */
  __pyx_f_4lxml_5etree__initThreadLogging();

  /* "lxml/etree.pyx":150
 * 
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode("UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 150, __pyx_L1_error)
  if (!__pyx_t_6) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L2_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getdefaultencoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 150, __pyx_L1_error)
  if (!__pyx_t_6) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L2_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_n_u_ascii);
  __pyx_t_4 = __pyx_n_u_ascii;
  __pyx_L2_bool_binop_done:;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__116, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FILENAME_ENCODING, ((PyObject*)__pyx_t_4));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":151
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode("UTF-8")
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
 * 
 * # set up some default namespace prefixes
 */
  __pyx_t_4 = __pyx_v_4lxml_5etree__FILENAME_ENCODING;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_4lxml_5etree__C_FILENAME_ENCODING = PyBytes_AS_STRING(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":155
 * # 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",
 *     b"http://www.w3.org/1999/XSL/Transform": b"xsl",
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_XML_1998_namespa, __pyx_n_b_xml) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_1999_xhtml, __pyx_n_b_html) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_1999_XSL_Transfo, __pyx_n_b_xsl) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s, __pyx_n_b_rdf) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_schemas_xmlsoap_org_wsdl, __pyx_n_b_wsdl) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_2001_XMLSchema, __pyx_n_b_xs) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_www_w3_org_2001_XMLSchema_i, __pyx_n_b_xsi) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_purl_org_dc_elements_1_1, __pyx_n_b_dc) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_b_http_codespeak_net_lxml_objectif, __pyx_n_b_py) < 0) __PYX_ERR(0, 155, __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_4));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":171
 * # To avoid runtime encoding overhead, we keep a Unicode copy
 * # of the uri-prefix mapping as (str, str) items view.
 * cdef object _DEFAULT_NAMESPACE_PREFIXES_ITEMS = []             # <<<<<<<<<<<<<<
 * 
 * cdef _update_default_namespace_prefixes_items():
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":181
 *     }.items()
 * 
 * _update_default_namespace_prefixes_items()             # <<<<<<<<<<<<<<
 * 
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__update_default_namespace_prefixes_items(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":183
 * _update_default_namespace_prefixes_items()
 * 
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__117, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_match); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__check_internal_prefix, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "lxml/etree.pyx":185
 * cdef object _check_internal_prefix = re.compile(br"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     """Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_1register_namespace, 0, __pyx_n_s_register_namespace, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_namespace, __pyx_t_4) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "lxml/etree.pyx":222
 *             self.error_log = error_log.copy()
 * 
 * cdef object _Error = Error             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_Error);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__Error, ((PyObject *)__pyx_ptype_4lxml_5etree_Error));
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_Error);

  /* "lxml/etree.pyx":226
 * 
 * # superclass for all syntax errors
 * class LxmlSyntaxError(LxmlError, SyntaxError):             # <<<<<<<<<<<<<<
 *     """Base class for all syntax errors.
 *     """
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_LxmlError);
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_LxmlError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_4lxml_5etree_LxmlError))) __PYX_ERR(0, 226, __pyx_L1_error);
  __Pyx_INCREF(__pyx_builtin_SyntaxError);
  __Pyx_GIVEREF(__pyx_builtin_SyntaxError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_builtin_SyntaxError)) __PYX_ERR(0, 226, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_2, __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_3)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2 != __pyx_t_4) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 226, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_LxmlSyntaxError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LxmlSyntaxError, __pyx_t_4) < 0) __PYX_ERR(0, 226, __pyx_L1_error)
  __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":266
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "lxml/etree.pyx":268
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_match); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = ((unsigned char *)xmlParserVersion);
      __pyx_t_10 = __Pyx_ssize_strlen(((char const *)__pyx_t_9)); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 268, __pyx_L5_error)
      __pyx_t_5 = __Pyx_decode_c_string(((char const *)__pyx_t_9), 0, __pyx_t_10, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_kp_u_0_9);
      __Pyx_GIVEREF(__pyx_kp_u_0_9);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_0_9)) __PYX_ERR(0, 268, __pyx_L5_error);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 268, __pyx_L5_error);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_group); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__120, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "lxml/etree.pyx":267
 * cdef int _LIBXML_VERSION_INT
 * try:
 *     _LIBXML_VERSION_INT = int(             # <<<<<<<<<<<<<<
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
 */
      __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = __pyx_t_11;

      /* "lxml/etree.pyx":266
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(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;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "lxml/etree.pyx":269
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:             # <<<<<<<<<<<<<<
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 *     _LIBXML_VERSION_INT = 0
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "lxml/etree.pyx":270
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = 0
 * 
 */
      __pyx_t_9 = ((unsigned char *)xmlParserVersion);
      __pyx_t_10 = __Pyx_ssize_strlen(((char const *)__pyx_t_9)); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 270, __pyx_L7_except_error)
      __pyx_t_4 = __Pyx_decode_c_string(((char const *)__pyx_t_9), 0, __pyx_t_10, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_libxml2_version, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 270, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "lxml/etree.pyx":271
 * except Exception:
 *     print("Unknown libxml2 version: " + (<unsigned char*>tree.xmlParserVersion).decode("latin1"))
 *     _LIBXML_VERSION_INT = 0             # <<<<<<<<<<<<<<
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 */
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;

    /* "lxml/etree.pyx":266
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match('[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 */
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_7, __pyx_t_8);
    __pyx_L10_try_end:;
  }

  /* "lxml/etree.pyx":273
 *     _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_2 = __pyx_f_4lxml_5etree___unpackIntVersion(__pyx_v_4lxml_5etree__LIBXML_VERSION_INT, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXML_VERSION, __pyx_t_2) < 0) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":274
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)             # <<<<<<<<<<<<<<
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXML_VERSION, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXML_COMPILED_VERSION, __pyx_t_2) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":275
 * 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_2 = __Pyx_PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_f_4lxml_5etree___unpackDottedVersion(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LXML_VERSION, __pyx_t_5) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":277
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 * __version__ = tree.LXML_VERSION_STRING.decode("ascii")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
  __pyx_t_10 = __Pyx_ssize_strlen(LXML_VERSION_STRING); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error)
  __pyx_t_5 = __Pyx_decode_c_string(LXML_VERSION_STRING, 0, __pyx_t_10, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_2, __pyx_t_5) < 0) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":297
 * 
 * #ZLIB_COMPILED_VERSION = __unpackIntVersion(ZLIB_HEX_VERSION, base=0x10)
 * ICONV_COMPILED_VERSION = __unpackIntVersion(LIBICONV_HEX_VERSION, base=0x100)[:2]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_13.__pyx_n = 1;
  __pyx_t_13.base = 0x100;
  __pyx_t_5 = __pyx_f_4lxml_5etree___unpackIntVersion(__lxml_iconv_version, &__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 297, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_t_5, 0, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ICONV_COMPILED_VERSION, __pyx_t_2) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/apihelpers.pxi":651
 *     return attributes
 * 
 * cdef object __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/apihelpers.pxi":652
 * 
 * cdef object __RE_XML_ENCODING = re.compile(
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)             # <<<<<<<<<<<<<<
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_U); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/apihelpers.pxi":651
 *     return attributes
 * 
 * cdef object __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     r'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_u_xml_s_encoding_s_s_s);
  __Pyx_GIVEREF(__pyx_kp_u_xml_s_encoding_s_s_s);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_xml_s_encoding_s_s_s)) __PYX_ERR(7, 651, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(7, 651, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":654
 *     r'^(<\?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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s_sub); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/apihelpers.pxi":655
 * 
 * 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s_match); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___HAS_XML_ENCODING, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":11
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     """clear_error_log()
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3clear_error_log, 0, __pyx_n_s_clear_error_log_2, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__121)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_clear_error_log_2, __pyx_t_5) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":194
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_BaseErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseErrorLog_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_n_s_copy, __pyx_t_5) < 0) __PYX_ERR(1, 194, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__BaseErrorLog);

  /* "src/lxml/xmlerror.pxi":200
 *         return ''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_BaseErrorLog_7receive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseErrorLog_receive, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__124)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__BaseErrorLog, __pyx_n_s_receive, __pyx_t_5) < 0) __PYX_ERR(1, 200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__BaseErrorLog);

  /* "src/lxml/xmlerror.pxi":290
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_copy, __pyx_t_5) < 0) __PYX_ERR(1, 290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":328
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         """Filter the errors by the given domains and return a new error log
 *         containing the matches.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_17filter_domains, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_domains, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_domains, __pyx_t_5) < 0) __PYX_ERR(1, 328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":338
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         """filter_types(self, types)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_19filter_types, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_types, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_types, __pyx_t_5) < 0) __PYX_ERR(1, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":350
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         """filter_levels(self, levels)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_21filter_levels, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_levels, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_levels, __pyx_t_5) < 0) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":362
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         """filter_from_level(self, level)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_23filter_from_level, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_from_level, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_from_level, __pyx_t_5) < 0) __PYX_ERR(1, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":371
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         """filter_from_fatals(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_from_fatals, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_from_fatals, __pyx_t_5) < 0) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":378
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         """filter_from_errors(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_27filter_from_errors, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_from_errors, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__135)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_from_errors, __pyx_t_5) < 0) __PYX_ERR(1, 378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":385
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         """filter_from_warnings(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ListErrorLog_filter_from_warnin, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__136)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ListErrorLog, __pyx_n_s_filter_from_warnings, __pyx_t_5) < 0) __PYX_ERR(1, 385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ListErrorLog);

  /* "src/lxml/xmlerror.pxi":444
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ErrorLog___exit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_n_s_exit, __pyx_t_5) < 0) __PYX_ERR(1, 444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ErrorLog);

  /* "src/lxml/xmlerror.pxi":464
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_7clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ErrorLog_clear, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_n_s_clear, __pyx_t_5) < 0) __PYX_ERR(1, 464, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ErrorLog);

  /* "src/lxml/xmlerror.pxi":470
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Creates a shallow copy of this error log and the list of entries.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_9copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ErrorLog_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_n_s_copy, __pyx_t_5) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ErrorLog);

  /* "src/lxml/xmlerror.pxi":480
 *         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
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_ErrorLog_13receive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ErrorLog_receive, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ErrorLog, __pyx_n_s_receive, __pyx_t_5) < 0) __PYX_ERR(1, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ErrorLog);

  /* "src/lxml/xmlerror.pxi":490
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DomainErrorLog_3receive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DomainErrorLog_receive, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__DomainErrorLog, __pyx_n_s_receive, __pyx_t_5) < 0) __PYX_ERR(1, 490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__DomainErrorLog);

  /* "src/lxml/xmlerror.pxi":500
 *         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
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_RotatingErrorLog_3receive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_RotatingErrorLog_receive, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__RotatingErrorLog, __pyx_n_s_receive, __pyx_t_5) < 0) __PYX_ERR(1, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__RotatingErrorLog);

  /* "src/lxml/xmlerror.pxi":551
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         """Dummy method that returns an empty error log.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PyErrorLog_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_n_s_copy, __pyx_t_5) < 0) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_PyErrorLog);

  /* "src/lxml/xmlerror.pxi":556
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         """log(self, log_entry, message, *args)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_5log, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PyErrorLog_log, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_n_s_log, __pyx_t_5) < 0) __PYX_ERR(1, 556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_PyErrorLog);

  /* "src/lxml/xmlerror.pxi":573
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         """receive(self, log_entry)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10PyErrorLog_7receive, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PyErrorLog_receive, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_PyErrorLog, __pyx_n_s_receive, __pyx_t_5) < 0) __PYX_ERR(1, 573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_PyErrorLog);

  /* "src/lxml/xmlerror.pxi":589
 * # libxml2/libxslt
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree__RotatingErrorLog), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_5));
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":623
 * 
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     """use_global_python_log(log)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_5use_global_python_log, 0, __pyx_n_s_use_global_python_log, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_global_python_log, __pyx_t_5) < 0) __PYX_ERR(1, 623, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":814
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error levels"""
 * 
 */
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_tuple__152); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_5, __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_2)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5 != __pyx_tuple__152) {
    if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_tuple__152) < 0))) __PYX_ERR(1, 814, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ErrorLevels, __pyx_t_5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorLevels, __pyx_t_4) < 0) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":817
 *     """Libxml2 error levels"""
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error domains"""
 * 
 */
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_tuple__154); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_5, __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_2)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5 != __pyx_tuple__154) {
    if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_tuple__154) < 0))) __PYX_ERR(1, 817, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ErrorDomains, __pyx_t_5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorDomains, __pyx_t_4) < 0) __PYX_ERR(1, 817, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":820
 *     """Libxml2 error domains"""
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 error types"""
 * 
 */
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_tuple__156); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_5, __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_2)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5 != __pyx_tuple__156) {
    if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_tuple__156) < 0))) __PYX_ERR(1, 820, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ErrorTypes, __pyx_t_5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorTypes, __pyx_t_4) < 0) __PYX_ERR(1, 820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":823
 *     """Libxml2 error types"""
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     """Libxml2 RelaxNG error types"""
 * 
 */
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_tuple__158); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_5, __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_2)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5 != __pyx_tuple__158) {
    if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_tuple__158) < 0))) __PYX_ERR(1, 823, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_RelaxNGErrorTypes, __pyx_t_5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RelaxNGErrorTypes, __pyx_t_4) < 0) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/xmlerror.pxi":831
 * # This section is generated by the script 'update-error-constants.py'.
 * 
 * cdef object __ERROR_LEVELS = """\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
 */
  __Pyx_INCREF(__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_LEVELS, __pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);
  __Pyx_GIVEREF(__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3);

  /* "src/lxml/xmlerror.pxi":838
 * """
 * 
 * cdef object __ERROR_DOMAINS = """\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
 */
  __Pyx_INCREF(__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_DOMAINS, __pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);
  __Pyx_GIVEREF(__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE);

  /* "src/lxml/xmlerror.pxi":872
 * """
 * 
 * cdef object __PARSER_ERROR_TYPES = """\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
 */
  __Pyx_INCREF(__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES, __pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);
  __Pyx_GIVEREF(__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER);

  /* "src/lxml/xmlerror.pxi":1610
 * """
 * 
 * cdef object __RELAXNG_ERROR_TYPES = """\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
 */
  __Pyx_INCREF(__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES, __pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);
  __Pyx_GIVEREF(__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY);

  /* "src/lxml/xmlerror.pxi":1654
 * # --- END: GENERATED CONSTANTS ---
 * 
 * __initErrorConstants()             # <<<<<<<<<<<<<<
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree___initErrorConstants(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":525
 *                    for i in range(30) ])
 * 
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree___initPrefixCache(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__PREFIX_CACHE);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__PREFIX_CACHE, ((PyObject*)__pyx_t_5));
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":539
 * 
 * 
 * cdef object _find_invalid_public_id_characters = re.compile(             # <<<<<<<<<<<<<<
 *     ur"[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+").search
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__159, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":540
 * 
 * cdef object _find_invalid_public_id_characters = re.compile(
 *     ur"[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#@$_%-]+").search             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_invalid_public_id_characters);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_invalid_public_id_characters, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "lxml/etree.pyx":573
 *         return  tree.xmlCreateIntSubset(c_doc, c_name, NULL, NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Removes DOCTYPE and internal subset from the document."""
 *         cdef xmlDoc* c_doc = self._doc._c_doc
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7DocInfo_3clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DocInfo_clear, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__161)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_DocInfo, __pyx_n_s_clear, __pyx_t_5) < 0) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_DocInfo);

  /* "lxml/etree.pyx":730
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         """_init(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_1_init, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element__init, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__162)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_init_2, __pyx_t_5) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":818
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_9__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element___deepcopy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__164)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_deepcopy, __pyx_t_5) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":822
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_11__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element___copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__166)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_copy_2, __pyx_t_5) < 0) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":841
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_13set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_set, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__167)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_set, __pyx_t_5) < 0) __PYX_ERR(0, 841, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":851
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """append(self, element)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_15append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_append, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_append, __pyx_t_5) < 0) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":860
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addnext(self, element)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_17addnext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_addnext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_addnext, __pyx_t_5) < 0) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":878
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """addprevious(self, element)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_19addprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_addprevious, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__171)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_addprevious, __pyx_t_5) < 0) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":897
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """extend(self, elements)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_21extend, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_extend, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_extend, __pyx_t_5) < 0) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":910
 *             _appendChild(self, element)
 * 
 *     def clear(self, bint keep_tail=False):             # <<<<<<<<<<<<<<
 *         """clear(self, keep_tail=False)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_23clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_clear, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__175)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__176);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_clear, __pyx_t_5) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":942
 *             c_node = c_node_next
 * 
 *     def insert(self, index: int, _Element element not None):             # <<<<<<<<<<<<<<
 *         """insert(self, index, element)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_index, __pyx_n_s_int) < 0) __PYX_ERR(0, 942, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_25insert, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_insert, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__178)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_insert, __pyx_t_3) < 0) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":965
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """remove(self, element)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_27remove, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_remove, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_remove, __pyx_t_3) < 0) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":985
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         """replace(self, old_element, new_element)
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_29replace, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_replace, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__182)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_replace, __pyx_t_3) < 0) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1236
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         "__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_43__reversed__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element___reversed, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__183)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_reversed_2, __pyx_t_3) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1240
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, child: _Element, start: int = None, stop: int = None):             # <<<<<<<<<<<<<<
 *         """index(self, child, start=None, stop=None)
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_child, __pyx_n_s_Element_3) < 0) __PYX_ERR(0, 1240, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_start, __pyx_n_s_int) < 0) __PYX_ERR(0, 1240, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_stop, __pyx_n_s_int) < 0) __PYX_ERR(0, 1240, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_45index, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_index, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__186);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_index, __pyx_t_5) < 0) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1327
 *             raise ValueError, "list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_47get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__188)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_get, __pyx_t_5) < 0) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1335
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """keys(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_49keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_keys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__190)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_keys, __pyx_t_5) < 0) __PYX_ERR(0, 1335, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1344
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """values(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_51values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_values, __pyx_t_5) < 0) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1353
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """items(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_53items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__192)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_items, __pyx_t_5) < 0) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1362
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         """getchildren(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_55getchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getchildren, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__193)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getchildren, __pyx_t_5) < 0) __PYX_ERR(0, 1362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1375
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """getparent(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_57getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getparent, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__195)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getparent, __pyx_t_5) < 0) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1387
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """getnext(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_59getnext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getnext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__196)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getnext, __pyx_t_5) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1399
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """getprevious(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_61getprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getprevious, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__197)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getprevious, __pyx_t_5) < 0) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1411
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         """itersiblings(self, tag=None, *tags, preceding=False)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_preceding, Py_False) < 0) __PYX_ERR(0, 1411, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_63itersiblings, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_itersiblings, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__199)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_itersiblings, __pyx_t_3) < 0) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1434
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterancestors(self, tag=None, *tags)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_65iterancestors, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_iterancestors, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__201)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_iterancestors, __pyx_t_3) < 0) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1448
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iterdescendants(self, tag=None, *tags)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_67iterdescendants, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_iterdescendants, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__202)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_iterdescendants, __pyx_t_3) < 0) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1463
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, *tags, reversed=False)
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reversed, Py_False) < 0) __PYX_ERR(0, 1463, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_69iterchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_iterchildren, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__204)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_iterchildren, __pyx_t_5) < 0) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1478
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         """getroottree(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_71getroottree, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getroottree, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__205)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getroottree, __pyx_t_5) < 0) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1490
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, tag=None, *tags)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_73getiterator, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_getiterator, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__206)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_getiterator, __pyx_t_5) < 0) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1512
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_75iter, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_iter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__207)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_iter, __pyx_t_5) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1536
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         """itertext(self, tag=None, *tags, with_tail=True)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_tail, Py_True) < 0) __PYX_ERR(0, 1536, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_77itertext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_itertext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__209)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_itertext, __pyx_t_3) < 0) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1551
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_79makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_makeelement, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__211)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_makeelement, __pyx_t_3) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1560
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_81find, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_find, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__213)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_find, __pyx_t_3) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1573
 *         return _elementpath.find(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_83findtext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_findtext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__215)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_findtext, __pyx_t_3) < 0) __PYX_ERR(0, 1573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1586
 *         return _elementpath.findtext(self, path, default, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_85findall, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_findall, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_findall, __pyx_t_3) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1599
 *         return _elementpath.findall(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_87iterfind, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_iterfind, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__217)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_iterfind, __pyx_t_3) < 0) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, Py_None) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, Py_None) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)

  /* "lxml/etree.pyx":1613
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smart_strings, Py_True) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)

  /* "lxml/etree.pyx":1612
 *         return _elementpath.iterfind(self, path, namespaces, with_prefixes=not _isHtmlDocument(self))
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_89xpath, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_xpath, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__219)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_xpath, __pyx_t_5) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1623
 *         return evaluator(_path, **_variables)
 * 
 *     def cssselect(self, expr, *, translator='xml'):             # <<<<<<<<<<<<<<
 *         """
 *         Run the CSS expression on this element and its children,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_translator, __pyx_n_u_xml) < 0) __PYX_ERR(0, 1623, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8_Element_91cssselect, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Element_cssselect, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__221)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Element, __pyx_n_s_cssselect, __pyx_t_3) < 0) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Element);

  /* "lxml/etree.pyx":1673
 *         raise TypeError, "this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         "set(self, key, value)"
 *         self._raiseImmutable()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_1set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_set, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__222)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_set, __pyx_t_3) < 0) __PYX_ERR(0, 1673, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1677
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         "append(self, value)"
 *         self._raiseImmutable()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_3append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_append, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__224)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_append, __pyx_t_3) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1681
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         "insert(self, index, value)"
 *         self._raiseImmutable()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_5insert, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_insert, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__226)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_insert, __pyx_t_3) < 0) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1720
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         "get(self, key, default=None)"
 *         return None
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_13get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__227)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_get, __pyx_t_3) < 0) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1724
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         "keys(self)"
 *         return []
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_15keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_keys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__228)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_keys, __pyx_t_3) < 0) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1728
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         "items(self)"
 *         return []
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_17items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__229)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_items, __pyx_t_3) < 0) __PYX_ERR(0, 1728, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1732
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         "values(self)"
 *         return []
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_20__ContentOnlyElement_19values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ContentOnlyElement_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree___ContentOnlyElement, __pyx_n_s_values, __pyx_t_3) < 0) __PYX_ERR(0, 1732, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree___ContentOnlyElement);

  /* "lxml/etree.pyx":1768
 *             return "<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get(self, key, default=None)
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_ProcessingInstruction_3get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ProcessingInstruction_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__231)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ProcessingInstruction, __pyx_n_s_get, __pyx_t_3) < 0) __PYX_ERR(0, 1768, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ProcessingInstruction);

  /* "lxml/etree.pyx":1792
 *                  for attr, value1, value2 in _FIND_PI_ATTRIBUTES(' ' + self.text) }
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(r'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall             # <<<<<<<<<<<<<<
 * 
 * cdef class _Entity(__ContentOnlyElement):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_U); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u_s_w_s_s);
  __Pyx_GIVEREF(__pyx_kp_u_s_w_s_s);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_s_w_s_s)) __PYX_ERR(0, 1792, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5)) __PYX_ERR(0, 1792, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1792, __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_findall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1912
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """parse(self, source, parser=None, base_url=None)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(0, 1912, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_1parse, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_parse, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__233)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_parse, __pyx_t_5) < 0) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":1928
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         """_setroot(self, root)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_3_setroot, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree__setroot, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__235)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_setroot, __pyx_t_5) < 0) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":1939
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         """getroot(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_5getroot, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_getroot, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__236)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_getroot, __pyx_t_5) < 0) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":1946
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_7__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree___copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__237)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_copy_2, __pyx_t_5) < 0) __PYX_ERR(0, 1946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":1949
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_9__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree___deepcopy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__239)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_deepcopy, __pyx_t_5) < 0) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_encoding, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_method, __pyx_n_u_xml) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1990
 * 
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_pretty_print, Py_False) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_xml_declaration, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_tail, Py_True) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1991
 *     def write(self, file, *, encoding=None, method="xml",
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,             # <<<<<<<<<<<<<<
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_standalone, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_doctype, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_compression, __pyx_int_0) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1992
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_exclusive, Py_False) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_inclusive_ns_prefixes, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1993
 *               standalone=None, doctype=None, compression=0,
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *               docstring=None):
 *         """write(self, file, encoding=None, method="xml",
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_comments, Py_True) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_strip_text, Py_False) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1994
 *               bint exclusive=False, inclusive_ns_prefixes=None,
 *               bint with_comments=True, bint strip_text=False,
 *               docstring=None):             # <<<<<<<<<<<<<<
 *         """write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_docstring, Py_None) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)

  /* "lxml/etree.pyx":1989
 *         return None
 * 
 *     def write(self, file, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *               bint pretty_print=False, xml_declaration=None, bint with_tail=True,
 *               standalone=None, doctype=None, compression=0,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_11write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_write, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__241)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_write, __pyx_t_2) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2099
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getpath(self, element)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_13getpath, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_getpath, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__243)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_getpath, __pyx_t_2) < 0) __PYX_ERR(0, 2099, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2137
 *         return path
 * 
 *     def getelementpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         """getelementpath(self, element)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_15getelementpath, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_getelementpath, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__245)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_getelementpath, __pyx_t_2) < 0) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2201
 *         return '/'.join(path)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """getiterator(self, *tags, tag=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_17getiterator, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_getiterator, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__247)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_getiterator, __pyx_t_2) < 0) __PYX_ERR(0, 2201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2225
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         """iter(self, tag=None, *tags)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_19iter, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_iter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__248)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 2225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2243
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """find(self, path, namespaces=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_21find, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_find, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__250)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_find, __pyx_t_2) < 0) __PYX_ERR(0, 2243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2267
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findtext(self, path, default=None, namespaces=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_23findtext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_findtext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__252)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_findtext, __pyx_t_2) < 0) __PYX_ERR(0, 2267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2291
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """findall(self, path, namespaces=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_25findall, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_findall, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__253)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_findall, __pyx_t_2) < 0) __PYX_ERR(0, 2291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2315
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         """iterfind(self, path, namespaces=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_27iterfind, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_iterfind, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__254)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_iterfind, __pyx_t_2) < 0) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, Py_None) < 0) __PYX_ERR(0, 2339, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_extensions, Py_None) < 0) __PYX_ERR(0, 2339, __pyx_L1_error)

  /* "lxml/etree.pyx":2340
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_smart_strings, Py_True) < 0) __PYX_ERR(0, 2339, __pyx_L1_error)

  /* "lxml/etree.pyx":2339
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         """xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_29xpath, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_xpath, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__255)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_xpath, __pyx_t_5) < 0) __PYX_ERR(0, 2339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2364
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         """xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_31xslt, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_xslt, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__257)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_xslt_3, __pyx_t_5) < 0) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2383
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         """relaxng(self, relaxng)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_33relaxng, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_relaxng, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__259)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_relaxng, __pyx_t_5) < 0) __PYX_ERR(0, 2383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2401
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         """xmlschema(self, xmlschema)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_35xmlschema, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_xmlschema, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__261)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_xmlschema, __pyx_t_5) < 0) __PYX_ERR(0, 2401, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2419
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         """xinclude(self)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_37xinclude, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_xinclude, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__262)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_xinclude, __pyx_t_5) < 0) __PYX_ERR(0, 2419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_exclusive, Py_False) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_comments, Py_True) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_compression, __pyx_int_0) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

  /* "lxml/etree.pyx":2435
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,
 *                    compression=0, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 *                        compression=0, inclusive_ns_prefixes=None)
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_inclusive_ns_prefixes, Py_None) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)

  /* "lxml/etree.pyx":2434
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, bint exclusive=False, bint with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         """write_c14n(self, file, exclusive=False, with_comments=True,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ElementTree_39write_c14n, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTree_write_c14n, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__264)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementTree, __pyx_n_s_write_c14n, __pyx_t_2) < 0) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementTree);

  /* "lxml/etree.pyx":2501
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_7update, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_update, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__266)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_update, __pyx_t_2) < 0) __PYX_ERR(0, 2501, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2508
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, f"pop expected at most 2 arguments, got {len(default)+1}"
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_9pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_pop, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__268)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_pop, __pyx_t_2) < 0) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2521
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         c_attrs = self._element._c_node.properties
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_11clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_clear, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__270)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2533
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_15__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib___copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__271)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_copy_2, __pyx_t_2) < 0) __PYX_ERR(0, 2533, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2537
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_17__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib___deepcopy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__272)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_deepcopy, __pyx_t_2) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2567
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_25get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__273)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2571
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_27keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_keys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__274)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2579
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_31iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_iterkeys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__275)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2583
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_33values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__276)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2587
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_35itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_itervalues, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__277)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2591
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_37items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__278)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2595
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_39iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_iteritems, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__279)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2599
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_Attrib_41has_key, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Attrib_has_key, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__280)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Attrib, __pyx_n_s_has_key, __pyx_t_2) < 0) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Attrib);

  /* "lxml/etree.pyx":2620
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 * MutableMapping.register(_Attrib)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_MutableMapping, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_ptype_4lxml_5etree__Attrib)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2620, __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;

  /* "lxml/etree.pyx":3082
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     """Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7Element, 0, __pyx_n_s_Element_2, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__282)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__186);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Element_2, __pyx_t_5) < 0) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3096
 * 
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     """Comment(text=None)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9Comment, 0, __pyx_n_s_Comment, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__284)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comment, __pyx_t_5) < 0) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3120
 * 
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     """ProcessingInstruction(target, text=None)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11ProcessingInstruction, 0, __pyx_n_s_ProcessingInstruction, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__286)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProcessingInstruction, __pyx_t_5) < 0) __PYX_ERR(0, 3120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3148
 *     return _elementFactory(doc, c_node)
 * 
 * PI = ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PI, __pyx_t_5) < 0) __PYX_ERR(0, 3148, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3173
 * 
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     """Entity(name)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13Entity, 0, __pyx_n_s_Entity, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__288)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Entity, __pyx_t_5) < 0) __PYX_ERR(0, 3173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3199
 * 
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     """SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15SubElement, 0, __pyx_n_s_SubElement, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__290)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__186);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SubElement, __pyx_t_5) < 0) __PYX_ERR(0, 3199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3209
 * 
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """ElementTree(element=None, file=None, parser=None)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_file, Py_None) < 0) __PYX_ERR(0, 3209, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_parser, Py_None) < 0) __PYX_ERR(0, 3209, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17ElementTree, 0, __pyx_n_s_ElementTree, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__292)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTree, __pyx_t_2) < 0) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3235
 * 
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """HTML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(0, 3235, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_19HTML, 0, __pyx_n_s_HTML, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__294)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTML, __pyx_t_5) < 0) __PYX_ERR(0, 3235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3261
 * 
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(0, 3261, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21XML, 0, __pyx_n_s_XML, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__295)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XML, __pyx_t_2) < 0) __PYX_ERR(0, 3261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3292
 * 
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """fromstring(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(0, 3292, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23fromstring, 0, __pyx_n_s_fromstring, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__296)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_5) < 0) __PYX_ERR(0, 3292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3313
 * 
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """fromstringlist(strings, parser=None)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_25fromstringlist, 0, __pyx_n_s_fromstringlist, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__298)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstringlist, __pyx_t_5) < 0) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3334
 * 
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     """iselement(element)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27iselement, 0, __pyx_n_s_iselement, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__300)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iselement, __pyx_t_5) < 0) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3342
 * 
 * 
 * def indent(tree, space="  ", *, Py_ssize_t level=0):             # <<<<<<<<<<<<<<
 *     """indent(tree, space="  ", level=0)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromSsize_t(((Py_ssize_t)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_level, __pyx_t_2) < 0) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_29indent, 0, __pyx_n_s_indent, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__302)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__303);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_indent, __pyx_t_2) < 0) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3393
 * 
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """dump(elem, pretty_print=True, with_tail=True)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pretty_print, __pyx_t_5) < 0) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_with_tail, __pyx_t_5) < 0) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_31dump, 0, __pyx_n_s_dump, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__305)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dump, __pyx_t_5) < 0) __PYX_ERR(0, 3393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_encoding, Py_None) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_method, ((PyObject*)__pyx_n_u_xml)) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)

  /* "lxml/etree.pyx":3406
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              # method='c14n'
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_xml_declaration, Py_None) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_pretty_print, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_tail, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3407
 * def tostring(element_or_tree, *, encoding=None, method="xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_standalone, Py_None) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_doctype, Py_None) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)

  /* "lxml/etree.pyx":3409
 *              standalone=None, doctype=None,
 *              # method='c14n'
 *              bint exclusive=False, inclusive_ns_prefixes=None,             # <<<<<<<<<<<<<<
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_exclusive, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_inclusive_ns_prefixes, Py_None) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)

  /* "lxml/etree.pyx":3411
 *              bint exclusive=False, inclusive_ns_prefixes=None,
 *              # method='c14n2'
 *              bint with_comments=True, bint strip_text=False,             # <<<<<<<<<<<<<<
 *              ):
 *     """tostring(element_or_tree, encoding=None, method="xml",
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_with_comments, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_strip_text, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3405
 * 
 * 
 * def tostring(element_or_tree, *, encoding=None, method="xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_33tostring, 0, __pyx_n_s_tostring, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__307)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostring, __pyx_t_2) < 0) __PYX_ERR(0, 3405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3518
 * 
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """tostringlist(element_or_tree, *args, **kwargs)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_35tostringlist, 0, __pyx_n_s_tostringlist, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__309)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostringlist, __pyx_t_2) < 0) __PYX_ERR(0, 3518, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_method, ((PyObject*)__pyx_n_u_xml)) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pretty_print, __pyx_t_5) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3531
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
  __pyx_t_5 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_with_tail, __pyx_t_5) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_doctype, Py_None) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)

  /* "lxml/etree.pyx":3530
 * 
 * 
 * def tounicode(element_or_tree, *, method="xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     """tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_37tounicode, 0, __pyx_n_s_tounicode, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__311)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tounicode, __pyx_t_5) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "lxml/etree.pyx":3564
 * 
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parse(source, parser=None, base_url=None)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(0, 3564, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_39parse, 0, __pyx_n_s_parse, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__313)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse, __pyx_t_2) < 0) __PYX_ERR(0, 3564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":3596
 * 
 * 
 * def adopt_external_document(capsule, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """adopt_external_document(capsule, parser=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_41adopt_external_document, 0, __pyx_n_s_adopt_external_document, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__315)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_adopt_external_document, __pyx_t_2) < 0) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         "__deepcopy__(self, memo)"
 *         return self.__copy__()
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy___deepcopy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__316)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_deepcopy, __pyx_t_2) < 0) __PYX_ERR(8, 160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         "__copy__(self)"
 *         cdef xmlDoc* c_doc
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_13__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy___copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__317)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_copy_2, __pyx_t_2) < 0) __PYX_ERR(8, 164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         """iterchildren(self, tag=None, reversed=False)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reversed, Py_False) < 0) __PYX_ERR(8, 187, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy_iterchildren, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__319)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_iterchildren, __pyx_t_5) < 0) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         """Returns all subelements. The elements are returned in document
 *         order.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_19getchildren, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy_getchildren, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__320)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_getchildren, __pyx_t_5) < 0) __PYX_ERR(8, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         """Returns the parent of this element or None for the root element.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_21getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy_getparent, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__322)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_getparent, __pyx_t_5) < 0) __PYX_ERR(8, 214, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         """Returns the following sibling of this element or None.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_23getnext, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy_getnext, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__323)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_getnext, __pyx_t_5) < 0) __PYX_ERR(8, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         """Returns the preceding sibling of this element or None.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_ReadOnlyProxy_25getprevious, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyProxy_getprevious, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__324)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyProxy, __pyx_n_s_getprevious, __pyx_t_5) < 0) __PYX_ERR(8, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyProxy);

  /* "src/lxml/readonlytree.pxi":304
 *         return _build_nsmap(self._c_node)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """Gets an element attribute.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_1get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyElementProxy_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__325)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_n_s_get, __pyx_t_5) < 0) __PYX_ERR(8, 304, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);

  /* "src/lxml/readonlytree.pxi":310
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_3keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyElementProxy_keys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__326)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_n_s_keys, __pyx_t_5) < 0) __PYX_ERR(8, 310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);

  /* "src/lxml/readonlytree.pxi":317
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_5values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyElementProxy_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__327)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_n_s_values, __pyx_t_5) < 0) __PYX_ERR(8, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);

  /* "src/lxml/readonlytree.pxi":324
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ReadOnlyElementProxy_7items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ReadOnlyElementProxy_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__328)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy, __pyx_n_s_items, __pyx_t_5) < 0) __PYX_ERR(8, 324, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy);

  /* "src/lxml/readonlytree.pxi":390
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_1append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_OpaqueDocumentWrapper_append, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__330)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_n_s_append, __pyx_t_5) < 0) __PYX_ERR(8, 390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);

  /* "src/lxml/readonlytree.pxi":407
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_OpaqueDocumentWrapper_extend, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__331)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper, __pyx_n_s_extend, __pyx_t_5) < 0) __PYX_ERR(8, 407, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper);

  /* "src/lxml/readonlytree.pxi":487
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         """Append a copy of an Element to the list of children.
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_1append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AppendOnlyElementProxy_append, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__332)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_n_s_append, __pyx_t_5) < 0) __PYX_ERR(8, 487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);

  /* "src/lxml/readonlytree.pxi":499
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         """Append a copy of all Elements from a sequence to the list of
 *         children.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AppendOnlyElementProxy_3extend, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AppendOnlyElementProxy_extend, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__333)); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy, __pyx_n_s_extend, __pyx_t_5) < 0) __PYX_ERR(8, 499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy);

  /* "src/lxml/classlookup.pxi":248
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         """set_fallback(self, lookup)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FallbackElementClassLookup_set_f, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__335)); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup, __pyx_n_s_set_fallback, __pyx_t_5) < 0) __PYX_ERR(9, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_FallbackElementClassLookup);

  /* "src/lxml/classlookup.pxi":430
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         "lookup(self, type, doc, namespace, name)"
 *         return None
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_24CustomElementClassLookup_3lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_CustomElementClassLookup_lookup, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__337)); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_CustomElementClassLookup, __pyx_n_s_lookup, __pyx_t_5) < 0) __PYX_ERR(9, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_CustomElementClassLookup);

  /* "src/lxml/classlookup.pxi":512
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         """lookup(self, doc, element)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_24PythonElementClassLookup_3lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PythonElementClassLookup_lookup, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__339)); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_PythonElementClassLookup, __pyx_n_s_lookup, __pyx_t_5) < 0) __PYX_ERR(9, 512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_PythonElementClassLookup);

  /* "src/lxml/classlookup.pxi":549
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     """set_element_class_lookup(lookup = None)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_43set_element_class_lookup, 0, __pyx_n_s_set_element_class_lookup, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__341)); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_element_class_lookup, __pyx_t_5) < 0) __PYX_ERR(9, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/classlookup.pxi":578
 * # 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_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_5));
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "src/lxml/classlookup.pxi":580
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)             # <<<<<<<<<<<<<<
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_set_element_class_lookup); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":29
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         """update(self, class_dict_iterable)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_3update, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_NamespaceRegistry_update, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__343)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_n_s_update, __pyx_t_2) < 0) __PYX_ERR(12, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__NamespaceRegistry);

  /* "src/lxml/nsclasses.pxi":74
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_11items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_NamespaceRegistry_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__344)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(12, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__NamespaceRegistry);

  /* "src/lxml/nsclasses.pxi":77
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_13iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_NamespaceRegistry_iteritems, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__345)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(12, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__NamespaceRegistry);

  /* "src/lxml/nsclasses.pxi":80
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_15clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_NamespaceRegistry_clear, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__346)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(12, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__NamespaceRegistry);

  /* "src/lxml/nsclasses.pxi":99
 *         return obj
 * 
 *     def __deco(self, name, obj):             # <<<<<<<<<<<<<<
 *         self[name] = obj
 *         return obj
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_NamespaceRegistry_19_NamespaceRegistry__deco, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_NamespaceRegistry___deco, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__348)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__NamespaceRegistry, __pyx_n_s_NamespaceRegistry__deco, __pyx_t_2) < 0) __PYX_ERR(12, 99, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__NamespaceRegistry);

  /* "src/lxml/nsclasses.pxi":147
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         """get_namespace(self, ns_uri)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementNamespaceClassLookup_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__350)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup, __pyx_n_s_get_namespace, __pyx_t_2) < 0) __PYX_ERR(12, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup);

  /* "src/lxml/nsclasses.pxi":205
 * 
 * cdef dict __FUNCTION_NAMESPACE_REGISTRIES
 * __FUNCTION_NAMESPACE_REGISTRIES = {}             # <<<<<<<<<<<<<<
 * 
 * def FunctionNamespace(ns_uri):
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/nsclasses.pxi":207
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     """FunctionNamespace(ns_uri)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_45FunctionNamespace, 0, __pyx_n_s_FunctionNamespace, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__352)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FunctionNamespace, __pyx_t_2) < 0) __PYX_ERR(12, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     "This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         """resolve(self, system_url, public_id, context)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_1resolve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Resolver_resolve, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__354)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_Resolver, __pyx_n_s_resolve, __pyx_t_2) < 0) __PYX_ERR(13, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_Resolver);

  /* "src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         """resolve_empty(self, context)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_3resolve_empty, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Resolver_resolve_empty, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__356)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_Resolver, __pyx_n_s_resolve_empty, __pyx_t_2) < 0) __PYX_ERR(13, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_Resolver);

  /* "src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         """resolve_string(self, string, context, base_url=None)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(13, 48, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_5resolve_string, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Resolver_resolve_string, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__358)); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_Resolver, __pyx_n_s_resolve_string, __pyx_t_5) < 0) __PYX_ERR(13, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_Resolver);

  /* "src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         """resolve_filename(self, filename, context)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_7resolve_filename, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Resolver_resolve_filename, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__360)); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_Resolver, __pyx_n_s_resolve_filename, __pyx_t_5) < 0) __PYX_ERR(13, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_Resolver);

  /* "src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         """resolve_file(self, f, context, base_url=None, close=True)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(13, 83, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_close, Py_True) < 0) __PYX_ERR(13, 83, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8Resolver_9resolve_file, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Resolver_resolve_file, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__362)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_Resolver, __pyx_n_s_resolve_file, __pyx_t_2) < 0) __PYX_ERR(13, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_Resolver);

  /* "src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         """add(self, resolver)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_3add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ResolverRegistry_add, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__364)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_n_s_add, __pyx_t_2) < 0) __PYX_ERR(13, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ResolverRegistry);

  /* "src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         "remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_5remove, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ResolverRegistry_remove, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__365)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_n_s_remove, __pyx_t_2) < 0) __PYX_ERR(13, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ResolverRegistry);

  /* "src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         "copy(self)"
 *         return self._copy()
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_7copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ResolverRegistry_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__366)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(13, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ResolverRegistry);

  /* "src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         "resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_ResolverRegistry_9resolve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ResolverRegistry_resolve, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__368)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ResolverRegistry, __pyx_n_s_resolve, __pyx_t_2) < 0) __PYX_ERR(13, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ResolverRegistry);

  /* "src/lxml/parser.pxi":7
 * 
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __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_4)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_2 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_4, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(2, 7, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":12
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column, filename=None):             # <<<<<<<<<<<<<<
 *         super(_ParseError, self).__init__(message)
 *         self.lineno, self.offset = (line, column - 1)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_1__init__, 0, __pyx_n_s_ParseError___init, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__370)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__189);
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "src/lxml/parser.pxi":18
 *         self.filename = filename
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def position(self):
 *         return self.lineno, self.offset + 1
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_3position, 0, __pyx_n_s_ParseError_position, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__371)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_position, __pyx_t_12) < 0) __PYX_ERR(2, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/parser.pxi":22
 *         return self.lineno, self.offset + 1
 * 
 *     @position.setter             # <<<<<<<<<<<<<<
 *     def position(self, new_pos):
 *         self.lineno, column = new_pos
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_position);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_position);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10ParseError_5position, 0, __pyx_n_s_ParseError_position, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__373)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = NULL;
  __pyx_t_11 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_15)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
      __pyx_t_11 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_5};
    __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 22, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_position, __pyx_t_12) < 0) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/parser.pxi":7
 * 
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 * 
 */
  __pyx_t_12 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ParseError, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParseError, __pyx_t_12) < 0) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":27
 *         self.offset = column - 1
 * 
 * cdef object _ParseError = ParseError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ParseError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__ParseError, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":30
 * 
 * 
 * class XMLSyntaxError(ParseError):             # <<<<<<<<<<<<<<
 *     """Syntax error while parsing an XML document.
 *     """
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ParseError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(2, 30, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __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_12)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__pyx_t_2 != __pyx_t_3) {
    if (unlikely((PyDict_SetItemString(__pyx_t_12, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(2, 30, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_XMLSyntaxError, __pyx_t_2, __pyx_t_12, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSyntaxError, __pyx_t_3) < 0) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":178
 *         context._implied_parser_contexts.pop()
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":179
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_t_11 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 179, __pyx_L1_error)

  /* "src/lxml/parser.pxi":186
 * 
 * # name of Python Py_UNICODE encoding as known to libxml2
 * cdef const_char* _PY_UNICODE_ENCODING = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _setupPythonUnicode() except -1:
 */
  __pyx_v_4lxml_5etree__PY_UNICODE_ENCODING = NULL;

  /* "src/lxml/parser.pxi":243
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:             # <<<<<<<<<<<<<<
 *     _setupPythonUnicode()
 * 
 */
  __pyx_t_6 = (PY_VERSION_HEX < 0x030C0000);
  if (__pyx_t_6) {

    /* "src/lxml/parser.pxi":244
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:
 *     _setupPythonUnicode()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_11 = __pyx_f_4lxml_5etree__setupPythonUnicode(); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 244, __pyx_L1_error)

    /* "src/lxml/parser.pxi":243
 * 
 * # Python 3.12 removed support for "Py_UNICODE".
 * if python.PY_VERSION_HEX < 0x030C0000:             # <<<<<<<<<<<<<<
 *     _setupPythonUnicode()
 * 
 */
  }

  /* "src/lxml/parser.pxi":274
 *     return encoding_name or None
 * 
 * _pyucs4_encoding_name = _find_PyUCS4EncodingName()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__find_PyUCS4EncodingName(); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyucs4_encoding_name, __pyx_t_2) < 0) __PYX_ERR(2, 274, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":517
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER = xmlGetExternalEntityLoader();

  /* "src/lxml/parser.pxi":999
 *         return "libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_3set_element_class_lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseParser_set_element_class_lo, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__374)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__BaseParser, __pyx_n_s_set_element_class_lookup, __pyx_t_2) < 0) __PYX_ERR(2, 999, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__BaseParser);

  /* "src/lxml/parser.pxi":1026
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """copy(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_5copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseParser_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__375)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__BaseParser, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(2, 1026, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__BaseParser);

  /* "src/lxml/parser.pxi":1033
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_BaseParser_7makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseParser_makeelement, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__376)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__BaseParser, __pyx_n_s_makeelement, __pyx_t_2) < 0) __PYX_ERR(2, 1033, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__BaseParser);

  /* "src/lxml/parser.pxi":1331
 *         return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         """feed(self, data)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_FeedParser_1feed, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FeedParser_feed, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__378)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__FeedParser, __pyx_n_s_feed, __pyx_t_2) < 0) __PYX_ERR(2, 1331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__FeedParser);

  /* "src/lxml/parser.pxi":1455
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11_FeedParser_3close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FeedParser_close, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__379)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__FeedParser, __pyx_n_s_close, __pyx_t_2) < 0) __PYX_ERR(2, 1455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__FeedParser);

  /* "src/lxml/parser.pxi":1548
 *     xmlparser.XML_PARSE_NOCDATA |
 *     xmlparser.XML_PARSE_NONET   |
 *     xmlparser.XML_PARSE_COMPACT |             # <<<<<<<<<<<<<<
 *     xmlparser.XML_PARSE_BIG_LINES
 *     )
 */
  __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS = ((((XML_PARSE_NOENT | XML_PARSE_NOCDATA) | XML_PARSE_NONET) | XML_PARSE_COMPACT) | XML_PARSE_BIG_LINES);

  /* "src/lxml/parser.pxi":1667
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XMLPullParser_3read_events, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XMLPullParser_read_events, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__380)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XMLPullParser, __pyx_n_s_read_events, __pyx_t_2) < 0) __PYX_ERR(2, 1667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XMLPullParser);

  /* "src/lxml/parser.pxi":1711
 * 
 * # ET 1.2 compatible name
 * XMLTreeBuilder = ETCompatXMLParser             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLTreeBuilder, ((PyObject *)__pyx_ptype_4lxml_5etree_ETCompatXMLParser)) < 0) __PYX_ERR(2, 1711, __pyx_L1_error)

  /* "src/lxml/parser.pxi":1715
 * 
 * cdef XMLParser __DEFAULT_XML_PARSER
 * __DEFAULT_XML_PARSER = XMLParser()             # <<<<<<<<<<<<<<
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree_XMLParser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":1717
 * __DEFAULT_XML_PARSER = XMLParser()
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)             # <<<<<<<<<<<<<<
 * 
 * def set_default_parser(_BaseParser parser=None):
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_11 = __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 1717, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":1719
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     """set_default_parser(parser=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_47set_default_parser, 0, __pyx_n_s_set_default_parser, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__382)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_default_parser, __pyx_t_2) < 0) __PYX_ERR(2, 1719, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":1735
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     "get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_49get_default_parser, 0, __pyx_n_s_get_default_parser, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__383)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_default_parser, __pyx_t_2) < 0) __PYX_ERR(2, 1735, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":1746
 * _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);

  /* "src/lxml/parser.pxi":1812
 * 
 * cdef HTMLParser __DEFAULT_HTML_PARSER
 * __DEFAULT_HTML_PARSER = HTMLParser()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree_HTMLParser)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/parser.pxi":1840
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14HTMLPullParser_3read_events, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTMLPullParser_read_events, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__384)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_HTMLPullParser, __pyx_n_s_read_events, __pyx_t_2) < 0) __PYX_ERR(2, 1840, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_HTMLPullParser);

  /* "src/lxml/saxparser.pxi":3
 * # SAX-like interfaces
 * 
 * class XMLSyntaxAssertionError(XMLSyntaxError, AssertionError):             # <<<<<<<<<<<<<<
 *     """
 *     An XMLSyntaxError that additionally inherits from AssertionError for
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(3, 3, __pyx_L1_error);
  __Pyx_INCREF(__pyx_builtin_AssertionError);
  __Pyx_GIVEREF(__pyx_builtin_AssertionError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_builtin_AssertionError)) __PYX_ERR(3, 3, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_12, __pyx_t_2, __pyx_n_s_XMLSyntaxAssertionError, __pyx_n_s_XMLSyntaxAssertionError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_An_XMLSyntaxError_that_addition); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2 != __pyx_t_4) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(3, 3, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":10
 *     This class may get replaced by a plain XMLSyntaxError in a future version.
 *     """
 *     def __init__(self, message):             # <<<<<<<<<<<<<<
 *         XMLSyntaxError.__init__(self, message, None, 0, 1)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23XMLSyntaxAssertionError_1__init__, 0, __pyx_n_s_XMLSyntaxAssertionError___init, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__386)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/saxparser.pxi":3
 * # SAX-like interfaces
 * 
 * class XMLSyntaxAssertionError(XMLSyntaxError, AssertionError):             # <<<<<<<<<<<<<<
 *     """
 *     An XMLSyntaxError that additionally inherits from AssertionError for
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_12, __pyx_n_s_XMLSyntaxAssertionError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSyntaxAssertionError, __pyx_t_4) < 0) __PYX_ERR(3, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/saxparser.pxi":821
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """close(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_3close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_close, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__387)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_close, __pyx_t_2) < 0) __PYX_ERR(3, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/saxparser.pxi":834
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         """data(self, data)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_5data, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_data, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__388)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_data, __pyx_t_2) < 0) __PYX_ERR(3, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/saxparser.pxi":842
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         """start(self, tag, attrs, nsmap=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_7start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_start, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__390)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_start, __pyx_t_2) < 0) __PYX_ERR(3, 842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/saxparser.pxi":851
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         """end(self, tag)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_9end, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_end, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__392)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_end, __pyx_t_2) < 0) __PYX_ERR(3, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/saxparser.pxi":861
 *         return element
 * 
 *     def pi(self, target, data=None):             # <<<<<<<<<<<<<<
 *         """pi(self, target, data=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_11pi, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_pi, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__394)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_pi, __pyx_t_2) < 0) __PYX_ERR(3, 861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/saxparser.pxi":869
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         """comment(self, comment)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_11TreeBuilder_13comment, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TreeBuilder_comment, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__396)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_TreeBuilder, __pyx_n_s_comment, __pyx_t_2) < 0) __PYX_ERR(3, 869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_TreeBuilder);

  /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "src/lxml/parsertarget.pxi":5
 * cdef object inspect_getargspec
 * try:
 *     from inspect import getfullargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * except ImportError:
 *     from inspect import getargspec as inspect_getargspec
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 5, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_getfullargspec);
      __Pyx_GIVEREF(__pyx_n_s_getfullargspec);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_getfullargspec)) __PYX_ERR(4, 5, __pyx_L14_error);
      __pyx_t_12 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, __pyx_t_2, 0)); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 5, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_12, __pyx_n_s_getfullargspec); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 5, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
 */
    }
    __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;
    goto __pyx_L19_try_end;
    __pyx_L14_error:;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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;

    /* "src/lxml/parsertarget.pxi":6
 * try:
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:             # <<<<<<<<<<<<<<
 *     from inspect import getargspec as inspect_getargspec
 * 
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(4, 6, __pyx_L16_except_error)
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);

      /* "src/lxml/parsertarget.pxi":7
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
 *     from inspect import getargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 7, __pyx_L16_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_n_s_getargspec);
      __Pyx_GIVEREF(__pyx_n_s_getargspec);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_getargspec)) __PYX_ERR(4, 7, __pyx_L16_except_error);
      __pyx_t_14 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, __pyx_t_4, 0)); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 7, __pyx_L16_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_14, __pyx_n_s_getargspec); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 7, __pyx_L16_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L15_exception_handled;
    }
    goto __pyx_L16_except_error;

    /* "src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * try:             # <<<<<<<<<<<<<<
 *     from inspect import getfullargspec as inspect_getargspec
 * except ImportError:
 */
    __pyx_L16_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L15_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_1);
    __pyx_L19_try_end:;
  }

  /* "src/lxml/parsertarget.pxi":10
 * 
 * 
 * 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]));
  __Pyx_GIVEREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])))) __PYX_ERR(4, 10, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = __Pyx_Py3MetaclassPrepare(__pyx_t_12, __pyx_t_2, __pyx_n_s_TargetParserResult, __pyx_n_s_TargetParserResult, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__pyx_t_2 != __pyx_t_3) {
    if (unlikely((PyDict_SetItemString(__pyx_t_14, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(4, 10, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parsertarget.pxi":14
 *     # 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_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__, 0, __pyx_n_s_TargetParserResult___init, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__398)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_14, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(4, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/parsertarget.pxi":10
 * 
 * 
 * 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_3 = __Pyx_Py3ClassCreate(__pyx_t_12, __pyx_n_s_TargetParserResult, __pyx_t_2, __pyx_t_14, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TargetParserResult, __pyx_t_3) < 0) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":4
 * 
 * cdef object GzipFile
 * from gzip import GzipFile             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_GzipFile);
  __Pyx_GIVEREF(__pyx_n_s_GzipFile);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_GzipFile)) __PYX_ERR(10, 4, __pyx_L1_error);
  __pyx_t_12 = __Pyx_Import(__pyx_n_s_gzip, __pyx_t_2, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_12, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_GzipFile);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_GzipFile, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/serializer.pxi":575
 * 
 * cdef object io_open
 * from io import open as io_open             # <<<<<<<<<<<<<<
 * 
 * cdef object gzip
 */
  __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_n_s_open);
  __Pyx_GIVEREF(__pyx_n_s_open);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 0, __pyx_n_s_open)) __PYX_ERR(10, 575, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_io, __pyx_t_12, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_open); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_t_12);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_io_open);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_io_open, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":578
 * 
 * cdef object gzip
 * import gzip             # <<<<<<<<<<<<<<
 * 
 * cdef object getwriter
 */
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_gzip, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_gzip);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_gzip, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":581
 * 
 * cdef object getwriter
 * from codecs import getwriter             # <<<<<<<<<<<<<<
 * cdef object utf8_writer = getwriter('utf8')
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_getwriter);
  __Pyx_GIVEREF(__pyx_n_s_getwriter);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_getwriter)) __PYX_ERR(10, 581, __pyx_L1_error);
  __pyx_t_12 = __Pyx_Import(__pyx_n_s_codecs, __pyx_t_2, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_12, __pyx_n_s_getwriter); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_getwriter);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_getwriter, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/serializer.pxi":582
 * cdef object getwriter
 * from codecs import getwriter
 * cdef object utf8_writer = getwriter('utf8')             # <<<<<<<<<<<<<<
 * 
 * cdef object contextmanager
 */
  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_getwriter, __pyx_tuple__399, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_utf8_writer);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_utf8_writer, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "src/lxml/serializer.pxi":585
 * 
 * cdef object contextmanager
 * from contextlib import contextmanager             # <<<<<<<<<<<<<<
 * 
 * cdef object _open_utf8_file
 */
  __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_n_s_contextmanager);
  __Pyx_GIVEREF(__pyx_n_s_contextmanager);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 0, __pyx_n_s_contextmanager)) __PYX_ERR(10, 585, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_contextlib, __pyx_t_12, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_contextmanager); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(__pyx_t_12);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_contextmanager);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_contextmanager, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":589
 * cdef object _open_utf8_file
 * 
 * @contextmanager             # <<<<<<<<<<<<<<
 * def _open_utf8_file(file, compression=0):
 *     file = _getFSPathOrObject(file)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_51_open_utf8_file, 0, __pyx_n_s_open_utf8_file, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__120);
  __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_v_4lxml_5etree_contextmanager, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__open_utf8_file);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__open_utf8_file, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "src/lxml/serializer.pxi":862
 * # C14N 2.0
 * 
 * def canonicalize(xml_data=None, *, out=None, from_file=None, **options):             # <<<<<<<<<<<<<<
 *     """Convert XML to its C14N 2.0 serialised form.
 * 
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_out, Py_None) < 0) __PYX_ERR(10, 862, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_from_file, Py_None) < 0) __PYX_ERR(10, 862, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_54canonicalize, 0, __pyx_n_s_canonicalize, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__402)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_canonicalize, __pyx_t_2) < 0) __PYX_ERR(10, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/serializer.pxi":929
 * 
 * 
 * cdef object _looks_like_prefix_name = re.compile(r'^\w+:\w+$', re.UNICODE).match             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_UNICODE); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_INCREF(__pyx_kp_u_w_w);
  __Pyx_GIVEREF(__pyx_kp_u_w_w);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_kp_u_w_w)) __PYX_ERR(10, 929, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_12);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_12)) __PYX_ERR(10, 929, __pyx_L1_error);
  __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_match); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__looks_like_prefix_name);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__looks_like_prefix_name, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;

  /* "src/lxml/serializer.pxi":1005
 *         self._root_done = False
 * 
 *     def _iter_namespaces(self, ns_stack):             # <<<<<<<<<<<<<<
 *         for namespaces in reversed(ns_stack):
 *             if namespaces:  # almost no element declares new namespaces
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_3_iter_namespaces, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget__iter_namespace, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_iter_namespaces, __pyx_t_14) < 0) __PYX_ERR(10, 1005, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1054
 *         raise ValueError(f'Namespace "{uri}" of name "{tag}" is not declared in scope')
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         if not self._ignored_depth:
 *             self._data.append(data)
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_6data, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_data, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__404)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_data, __pyx_t_14) < 0) __PYX_ERR(10, 1054, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1072
 *             self._write(_escape_cdata_c14n(data))
 * 
 *     def start_ns(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_8start_ns, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_start_ns, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__406)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_start_ns_2, __pyx_t_14) < 0) __PYX_ERR(10, 1072, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1080
 *         self._ns_stack[-1].append((uri, prefix))
 * 
 *     def start(self, tag, attrs):             # <<<<<<<<<<<<<<
 *         if self._exclude_tags is not None and (
 *                 self._ignored_depth or tag in self._exclude_tags):
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_10start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_start, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__408)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_start, __pyx_t_14) < 0) __PYX_ERR(10, 1080, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1165
 *         self._ns_stack.append([])
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             self._ignored_depth -= 1
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_12end, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_end, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__410)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_end, __pyx_t_14) < 0) __PYX_ERR(10, 1165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1177
 *         self._ns_stack.pop()
 * 
 *     def comment(self, text):             # <<<<<<<<<<<<<<
 *         if not self._with_comments:
 *             return
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_14comment, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_comment, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__412)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_comment, __pyx_t_14) < 0) __PYX_ERR(10, 1177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1190
 *             self._write('\n')
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         if self._ignored_depth:
 *             return
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_16pi, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_pi, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__413)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_pi, __pyx_t_14) < 0) __PYX_ERR(10, 1190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1202
 *             self._write('\n')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16C14NWriterTarget_18close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_C14NWriterTarget_close, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__414)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_C14NWriterTarget, __pyx_n_s_close, __pyx_t_14) < 0) __PYX_ERR(10, 1202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_C14NWriterTarget);

  /* "src/lxml/serializer.pxi":1344
 *         self.method = OUTPUT_METHOD_XML
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         self.writer = _IncrementalFileWriter(
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_xmlfile___enter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__415)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_xmlfile, __pyx_n_s_enter, __pyx_t_14) < 0) __PYX_ERR(10, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_xmlfile);

  /* "src/lxml/serializer.pxi":1351
 *         return self.writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_xmlfile___exit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__417)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_xmlfile, __pyx_n_s_exit, __pyx_t_14) < 0) __PYX_ERR(10, 1351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_xmlfile);

  /* "src/lxml/serializer.pxi":1359
 *                 self.output_file = None
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         if isinstance(self.output_file, basestring):
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_7__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_xmlfile___aenter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_xmlfile, __pyx_n_s_aenter, __pyx_t_14) < 0) __PYX_ERR(10, 1359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_xmlfile);

  /* "src/lxml/serializer.pxi":1370
 *         return self.async_writer
 * 
 *     async def __aexit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.async_writer is not None:
 *             old_writer, self.async_writer = self.async_writer, None
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7xmlfile_10__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_xmlfile___aexit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_xmlfile, __pyx_n_s_aexit, __pyx_t_14) < 0) __PYX_ERR(10, 1370, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_xmlfile);

  /* "src/lxml/serializer.pxi":1427
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_write_dec, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__419)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__38);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_write_declaration, __pyx_t_14) < 0) __PYX_ERR(10, 1427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1456
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_write_doc, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__421)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_write_doctype, __pyx_t_14) < 0) __PYX_ERR(10, 1456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1473
 *         self._handle_error(self._c_out.error)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         """method(self, method)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_9method, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_method, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__423)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_method, __pyx_t_14) < 0) __PYX_ERR(10, 1473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1483
 *         return _MethodChanger(self, c_method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, method, **_extra)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_11element, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_element, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__425)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__38);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_element, __pyx_t_14) < 0) __PYX_ERR(10, 1483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1620
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False, method=None)
 * 
 */
  __pyx_t_14 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_with_tail, Py_True) < 0) __PYX_ERR(10, 1620, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_pretty_print, Py_False) < 0) __PYX_ERR(10, 1620, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_method, Py_None) < 0) __PYX_ERR(10, 1620, __pyx_L1_error)
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_13write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_write, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__427)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_write, __pyx_t_12) < 0) __PYX_ERR(10, 1620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1667
 *             self._handle_error(self._c_out.error)
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         """flush(self)
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_22_IncrementalFileWriter_15flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IncrementalFileWriter_flush, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__428)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IncrementalFileWriter, __pyx_n_s_flush, __pyx_t_12) < 0) __PYX_ERR(10, 1667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1714
 *         return data
 * 
 *     def write(self, data):             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16_AsyncDataWriter_3write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncDataWriter_write, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__429)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_n_s_write, __pyx_t_12) < 0) __PYX_ERR(10, 1714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncDataWriter);

  /* "src/lxml/serializer.pxi":1717
 *         self._data.append(data)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_16_AsyncDataWriter_5close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncDataWriter_close, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__430)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncDataWriter, __pyx_n_s_close, __pyx_t_12) < 0) __PYX_ERR(10, 1717, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncDataWriter);

  /* "src/lxml/serializer.pxi":1746
 *         return None
 * 
 *     async def flush(self):             # <<<<<<<<<<<<<<
 *         self._writer.flush()
 *         data = self._buffer.collect()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_3flush, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncIncrementalFileWriter_flus, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_flush, __pyx_t_12) < 0) __PYX_ERR(10, 1746, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1752
 *             await self._async_outfile.write(data)
 * 
 *     async def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         self._writer.write_declaration(version, standalone, doctype)
 *         data = self._flush()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_6write_declaration, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncIncrementalFileWriter_writ, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__38);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_write_declaration, __pyx_t_12) < 0) __PYX_ERR(10, 1752, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1758
 *             await self._async_outfile.write(data)
 * 
 *     async def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         self._writer.write_doctype(doctype)
 *         data = self._flush()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_9write_doctype, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncIncrementalFileWriter_writ_2, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_write_doctype, __pyx_t_12) < 0) __PYX_ERR(10, 1758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1764
 *             await self._async_outfile.write(data)
 * 
 *     async def write(self, *args, with_tail=True, pretty_print=False, method=None):             # <<<<<<<<<<<<<<
 *         self._writer.write(*args, with_tail=with_tail, pretty_print=pretty_print, method=method)
 *         data = self._flush()
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_with_tail, Py_True) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_pretty_print, Py_False) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_method, Py_None) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_12write, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncIncrementalFileWriter_writ_3, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_14, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_write, __pyx_t_14) < 0) __PYX_ERR(10, 1764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1770
 *             await self._async_outfile.write(data)
 * 
 *     def method(self, method):             # <<<<<<<<<<<<<<
 *         return self._writer.method(method)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_15method, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncIncrementalFileWriter_meth, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__435)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_method, __pyx_t_14) < 0) __PYX_ERR(10, 1770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1773
 *         return self._writer.method(method)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, method=None, **_extra):             # <<<<<<<<<<<<<<
 *         element_writer = self._writer.element(tag, attrib, nsmap, method, **_extra)
 *         return _AsyncFileWriterElement(element_writer, self)
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_17element, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncIncrementalFileWriter_elem, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__437)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__38);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_element, __pyx_t_14) < 0) __PYX_ERR(10, 1773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1777
 *         return _AsyncFileWriterElement(element_writer, self)
 * 
 *     async def _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         self._writer._close(raise_on_error)
 *         data = self._buffer.collect()
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_27_AsyncIncrementalFileWriter_19_close, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncIncrementalFileWriter__clo, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter, __pyx_n_s_close_2, __pyx_t_14) < 0) __PYX_ERR(10, 1777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncIncrementalFileWriter);

  /* "src/lxml/serializer.pxi":1797
 *         self._writer = writer
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         self._element_writer.__enter__()
 *         data = self._writer._flush()
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_3__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncFileWriterElement___aenter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncFileWriterElement, __pyx_n_s_aenter, __pyx_t_14) < 0) __PYX_ERR(10, 1797, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);

  /* "src/lxml/serializer.pxi":1803
 *             await self._writer._async_outfile.write(data)
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         self._element_writer.__exit__(*args)
 *         data = self._writer._flush()
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_23_AsyncFileWriterElement_6__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_AsyncFileWriterElement___aexit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__AsyncFileWriterElement, __pyx_n_s_aexit, __pyx_t_14) < 0) __PYX_ERR(10, 1803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__AsyncFileWriterElement);

  /* "src/lxml/serializer.pxi":1825
 *         self._old_method = writer._method
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._method = self._new_method
 *         self._writer._write_start_element(self._element)
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_FileWriterElement_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FileWriterElement___enter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__440)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__FileWriterElement, __pyx_n_s_enter, __pyx_t_14) < 0) __PYX_ERR(10, 1825, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__FileWriterElement);

  /* "src/lxml/serializer.pxi":1829
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 *         self._writer._method = self._old_method
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_18_FileWriterElement_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FileWriterElement___exit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__442)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__FileWriterElement, __pyx_n_s_exit, __pyx_t_14) < 0) __PYX_ERR(10, 1829, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__FileWriterElement);

  /* "src/lxml/serializer.pxi":1851
 *         self._exited = False
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._entered:
 *             raise LxmlSyntaxError("Inconsistent enter action in context manager")
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodChanger___enter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__443)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_n_s_enter, __pyx_t_14) < 0) __PYX_ERR(10, 1851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MethodChanger);

  /* "src/lxml/serializer.pxi":1857
 *         self._entered = True
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self._exited:
 *             raise LxmlSyntaxError("Inconsistent exit action in context manager")
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MethodChanger___exit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__444)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_n_s_exit, __pyx_t_14) < 0) __PYX_ERR(10, 1857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MethodChanger);

  /* "src/lxml/serializer.pxi":1865
 *         self._exited = True
 * 
 *     async def __aenter__(self):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__enter__()
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_7__aenter__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_MethodChanger___aenter, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_n_s_aenter, __pyx_t_14) < 0) __PYX_ERR(10, 1865, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MethodChanger);

  /* "src/lxml/serializer.pxi":1869
 *         return self.__enter__()
 * 
 *     async def __aexit__(self, *args):             # <<<<<<<<<<<<<<
 *         # for your async convenience
 *         return self.__exit__(*args)
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_14_MethodChanger_10__aexit__, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_MethodChanger___aexit, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_14)) __PYX_ERR(10, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MethodChanger, __pyx_n_s_aexit, __pyx_t_14) < 0) __PYX_ERR(10, 1869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MethodChanger);

  /* "src/lxml/iterparse.pxi":147
 *         return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         """set_element_class_lookup(self, lookup = None)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9iterparse_3set_element_class_lookup, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_iterparse_set_element_class_look, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__445)); if (unlikely(!__pyx_t_14)) __PYX_ERR(14, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_iterparse, __pyx_n_s_set_element_class_lookup, __pyx_t_14) < 0) __PYX_ERR(14, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_iterparse);

  /* "src/lxml/iterparse.pxi":156
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9iterparse_5makeelement, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_iterparse_makeelement, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__446)); if (unlikely(!__pyx_t_14)) __PYX_ERR(14, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_iterparse, __pyx_n_s_makeelement, __pyx_t_14) < 0) __PYX_ERR(14, 156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_iterparse);

  /* "src/lxml/iterparse.pxi":373
 *         return self._pop_event(0)
 * 
 *     def skip_subtree(self):             # <<<<<<<<<<<<<<
 *         """Prevent descending into the current subtree.
 *         Instead, the next returned event will be the 'end' event of the current element
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_8iterwalk_7skip_subtree, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_iterwalk_skip_subtree, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__447)); if (unlikely(!__pyx_t_14)) __PYX_ERR(14, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_iterwalk, __pyx_n_s_skip_subtree, __pyx_t_14) < 0) __PYX_ERR(14, 373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_iterwalk);

  /* "src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(15, 3, __pyx_L1_error)
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_56XMLID, 0, __pyx_n_s_XMLID, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__449)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLID, __pyx_t_12) < 0) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/xmlid.pxi":24
 *     return root, dic
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """XMLDTDID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(15, 24, __pyx_L1_error)
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_58XMLDTDID, 0, __pyx_n_s_XMLDTDID, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__451)); if (unlikely(!__pyx_t_14)) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_14, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLDTDID, __pyx_t_14) < 0) __PYX_ERR(15, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "src/lxml/xmlid.pxi":44
 *         return root, _IDDict(root)
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     """parseid(source, parser=None)
 * 
 */
  __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_base_url, Py_None) < 0) __PYX_ERR(15, 44, __pyx_L1_error)
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_60parseid, 0, __pyx_n_s_parseid, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__453)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_parseid, __pyx_t_12) < 0) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__454)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_copy, __pyx_t_12) < 0) __PYX_ERR(15, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_7get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_get, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__456)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_get, __pyx_t_12) < 0) __PYX_ERR(15, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_11has_key, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_has_key, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__457)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_has_key, __pyx_t_12) < 0) __PYX_ERR(15, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_15keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_keys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__458)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_keys, __pyx_t_12) < 0) __PYX_ERR(15, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_19iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_iterkeys, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__459)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_iterkeys, __pyx_t_12) < 0) __PYX_ERR(15, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_23items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_items, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__460)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_items, __pyx_t_12) < 0) __PYX_ERR(15, 129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_iteritems, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__461)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_iteritems, __pyx_t_12) < 0) __PYX_ERR(15, 134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_27values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__463)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_values, __pyx_t_12) < 0) __PYX_ERR(15, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7_IDDict_29itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IDDict_itervalues, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__464)); if (unlikely(!__pyx_t_12)) __PYX_ERR(15, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__IDDict, __pyx_n_s_itervalues, __pyx_t_12) < 0) __PYX_ERR(15, 149, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__IDDict);

  /* "src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     """cleanup_namespaces(tree_or_element, top_nsmap=None, keep_ns_prefixes=None)
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_62cleanup_namespaces, 0, __pyx_n_s_cleanup_namespaces, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__466)); if (unlikely(!__pyx_t_12)) __PYX_ERR(17, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__186);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_namespaces, __pyx_t_12) < 0) __PYX_ERR(17, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/cleanup.pxi":33
 * 
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     """strip_attributes(tree_or_element, *attribute_names)
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_64strip_attributes, 0, __pyx_n_s_strip_attributes, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__468)); if (unlikely(!__pyx_t_12)) __PYX_ERR(17, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_attributes, __pyx_t_12) < 0) __PYX_ERR(17, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/cleanup.pxi":74
 * 
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     """strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = __Pyx_PyBool_FromLong(((int)1)); if (unlikely(!__pyx_t_14)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_with_tail, __pyx_t_14) < 0) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_66strip_elements, 0, __pyx_n_s_strip_elements, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__470)); if (unlikely(!__pyx_t_14)) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_14, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_elements, __pyx_t_14) < 0) __PYX_ERR(17, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "src/lxml/cleanup.pxi":145
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     """strip_tags(tree_or_element, *tag_names)
 * 
 */
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_68strip_tags, 0, __pyx_n_s_strip_tags, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__472)); if (unlikely(!__pyx_t_14)) __PYX_ERR(17, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_tags, __pyx_t_14) < 0) __PYX_ERR(17, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "src/lxml/extensions.pxi":369
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
 */
  __Pyx_INCREF(__pyx_tuple__473);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES, __pyx_tuple__473);
  __Pyx_GIVEREF(__pyx_tuple__473);

  /* "src/lxml/extensions.pxi":427
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     """Extension(module, function_mapping=None, ns=None)
 * 
 */
  __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(11, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_ns, Py_None) < 0) __PYX_ERR(11, 427, __pyx_L1_error)
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_70Extension, 0, __pyx_n_s_Extension, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__475)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Extension, __pyx_t_12) < 0) __PYX_ERR(11, 427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/extensions.pxi":499
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_3test, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ExsltRegExp_test, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__477)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__478);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_n_s_test, __pyx_t_12) < 0) __PYX_ERR(11, 499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ExsltRegExp);

  /* "src/lxml/extensions.pxi":508
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_5match, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ExsltRegExp_match, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__480)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__478);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_n_s_match, __pyx_t_12) < 0) __PYX_ERR(11, 508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ExsltRegExp);

  /* "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)
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_12_ExsltRegExp_7replace, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ExsltRegExp_replace, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__482)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ExsltRegExp, __pyx_n_s_replace, __pyx_t_12) < 0) __PYX_ERR(11, 533, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ExsltRegExp);

  /* "src/lxml/extensions.pxi":725
 *     cdef readonly bint is_tail
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21_ElementUnicodeResult_1getparent, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementUnicodeResult_getparent, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__483)); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__ElementUnicodeResult, __pyx_n_s_getparent, __pyx_t_12) < 0) __PYX_ERR(11, 725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__ElementUnicodeResult);

  /* "src/lxml/xpath.pxi":3
 * # XPath evaluation
 * 
 * class XPathSyntaxError(LxmlSyntaxError, XPathError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_12);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12)) __PYX_ERR(18, 3, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_XPathError);
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_XPathError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_ptype_4lxml_5etree_XPathError))) __PYX_ERR(18, 3, __pyx_L1_error);
  __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PEP560_update_bases(__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_12, __pyx_n_s_XPathSyntaxError, __pyx_n_s_XPathSyntaxError, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_12 != __pyx_t_14) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_t_14) < 0))) __PYX_ERR(18, 3, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_XPathSyntaxError, __pyx_t_12, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathSyntaxError, __pyx_t_14) < 0) __PYX_ERR(18, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "src/lxml/xpath.pxi":10
 * 
 * cdef object _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 */
  __pyx_t_12 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_NUMBER_ERROR); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);

  /* "src/lxml/xpath.pxi":11
 * cdef object _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_2 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_UNFINISHED_LITERAL_ERROR); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":12
 *     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_3 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_VARIABLE_REF_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":13
 *     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_14 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_PREDICATE_ERROR); if (unlikely(!__pyx_t_14)) __PYX_ERR(18, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);

  /* "src/lxml/xpath.pxi":14
 *     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_4 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_UNCLOSED_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "src/lxml/xpath.pxi":15
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_CHAR_ERROR); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/xpath.pxi":10
 * 
 * cdef object _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 */
  __pyx_t_15 = PyTuple_New(6); if (unlikely(!__pyx_t_15)) __PYX_ERR(18, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_12);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_12)) __PYX_ERR(18, 10, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2)) __PYX_ERR(18, 10, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3)) __PYX_ERR(18, 10, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_14);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14)) __PYX_ERR(18, 10, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_4)) __PYX_ERR(18, 10, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_t_5)) __PYX_ERR(18, 10, __pyx_L1_error);
  __pyx_t_12 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_14 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;

  /* "src/lxml/xpath.pxi":19
 * 
 * cdef object _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 */
  __pyx_t_15 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_UNDEF_VARIABLE_ERROR); if (unlikely(!__pyx_t_15)) __PYX_ERR(18, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);

  /* "src/lxml/xpath.pxi":20
 * cdef object _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_5 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_UNDEF_PREFIX_ERROR); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "src/lxml/xpath.pxi":21
 *     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_4 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_UNKNOWN_FUNC_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "src/lxml/xpath.pxi":22
 *     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_14 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_OPERAND); if (unlikely(!__pyx_t_14)) __PYX_ERR(18, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);

  /* "src/lxml/xpath.pxi":23
 *     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_3 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/xpath.pxi":24
 *     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_2 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_ARITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/xpath.pxi":25
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 * )
 */
  __pyx_t_12 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_CTXT_SIZE); if (unlikely(!__pyx_t_12)) __PYX_ERR(18, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);

  /* "src/lxml/xpath.pxi":26
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_16 = __Pyx_PyInt_From_xmlParserErrors(XML_XPATH_INVALID_CTXT_POSITION); if (unlikely(!__pyx_t_16)) __PYX_ERR(18, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);

  /* "src/lxml/xpath.pxi":19
 * 
 * cdef object _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 */
  __pyx_t_17 = PyTuple_New(8); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_15);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_4)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_14);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_14)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_t_3)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 5, __pyx_t_2)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_12);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 6, __pyx_t_12)) __PYX_ERR(18, 19, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_16);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 7, __pyx_t_16)) __PYX_ERR(18, 19, __pyx_L1_error);
  __pyx_t_15 = 0;
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_14 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_12 = 0;
  __pyx_t_16 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_17 = 0;

  /* "src/lxml/xpath.pxi":251
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         """Register a namespace with the XPath context.
 *         """
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21XPathElementEvaluator_3register_namespace, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XPathElementEvaluator_register_n, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__484)); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_n_s_register_namespace, __pyx_t_17) < 0) __PYX_ERR(18, 251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XPathElementEvaluator);

  /* "src/lxml/xpath.pxi":257
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         """Register a prefix -> uri dict.
 *         """
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XPathElementEvaluator_register_n_2, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__486)); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XPathElementEvaluator, __pyx_n_s_register_namespaces, __pyx_t_17) < 0) __PYX_ERR(18, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XPathElementEvaluator);

  /* "src/lxml/xpath.pxi":352
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     """XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */
  __pyx_t_17 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_namespaces, Py_None) < 0) __PYX_ERR(18, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_extensions, Py_None) < 0) __PYX_ERR(18, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_regexp, ((PyObject *)Py_True)) < 0) __PYX_ERR(18, 352, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_smart_strings, ((PyObject *)Py_True)) < 0) __PYX_ERR(18, 352, __pyx_L1_error)
  __pyx_t_16 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_72XPathEvaluator, 0, __pyx_n_s_XPathEvaluator, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__488)); if (unlikely(!__pyx_t_16)) __PYX_ERR(18, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_16, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathEvaluator, __pyx_t_16) < 0) __PYX_ERR(18, 352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "src/lxml/xpath.pxi":448
 * 
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * cdef object _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_ERR(18, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_tuple__490, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_sub); if (unlikely(!__pyx_t_16)) __PYX_ERR(18, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 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;

  /* "src/lxml/xpath.pxi":449
 * 
 * cdef object _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * cdef object _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_ERR(18, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_tuple__492, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(18, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_findall); if (unlikely(!__pyx_t_16)) __PYX_ERR(18, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 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;

  /* "src/lxml/xslt.pxi":17
 *     """
 * 
 * class XSLTSaveError(XSLTError, SerialisationError):             # <<<<<<<<<<<<<<
 *     """Error serialising an XSLT result.
 *     """
 */
  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_XSLTError);
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_XSLTError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_ptype_4lxml_5etree_XSLTError))) __PYX_ERR(5, 17, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_ptype_4lxml_5etree_SerialisationError);
  __Pyx_GIVEREF((PyObject *)__pyx_ptype_4lxml_5etree_SerialisationError);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, ((PyObject *)__pyx_ptype_4lxml_5etree_SerialisationError))) __PYX_ERR(5, 17, __pyx_L1_error);
  __pyx_t_17 = __Pyx_PEP560_update_bases(__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_12 = __Pyx_CalculateMetaclass(NULL, __pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_12, __pyx_t_17, __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_2)) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_17 != __pyx_t_16) {
    if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_t_16) < 0))) __PYX_ERR(5, 17, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_Py3ClassCreate(__pyx_t_12, __pyx_n_s_XSLTSaveError, __pyx_t_17, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTSaveError, __pyx_t_16) < 0) __PYX_ERR(5, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":27
 * 
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)             # <<<<<<<<<<<<<<
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)
 * 
 */
  __pyx_t_17 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXSLT_VERSION, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXSLT_COMPILED_VERSION, __pyx_t_17) < 0) __PYX_ERR(5, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":28
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_17 = __pyx_f_4lxml_5etree___unpackIntVersion(xsltLibxsltVersion, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXSLT_VERSION, __pyx_t_17) < 0) __PYX_ERR(5, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "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;

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

  /* "src/lxml/xslt.pxi":204
 * 
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=False, write_network=False)
 * 
 */
  __pyx_t_17 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_read_file, Py_False) < 0) __PYX_ERR(5, 204, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_write_file, Py_False) < 0) __PYX_ERR(5, 204, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_create_dir, Py_False) < 0) __PYX_ERR(5, 204, __pyx_L1_error)

  /* "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_17, __pyx_n_s_read_network, Py_False) < 0) __PYX_ERR(5, 204, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_write_network, Py_False) < 0) __PYX_ERR(5, 204, __pyx_L1_error)

  /* "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_12 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl), __pyx_empty_tuple, __pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_n_s_DENY_ALL, __pyx_t_12) < 0) __PYX_ERR(5, 203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "src/lxml/xslt.pxi":208
 * 
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=True, write_network=False)
 * 
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_read_file, Py_True) < 0) __PYX_ERR(5, 208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_write_file, Py_False) < 0) __PYX_ERR(5, 208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_create_dir, Py_False) < 0) __PYX_ERR(5, 208, __pyx_L1_error)

  /* "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_12, __pyx_n_s_read_network, Py_True) < 0) __PYX_ERR(5, 208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_write_network, Py_False) < 0) __PYX_ERR(5, 208, __pyx_L1_error)

  /* "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_17 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl), __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl, __pyx_n_s_DENY_WRITE, __pyx_t_17) < 0) __PYX_ERR(5, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "src/lxml/xslt.pxi":267
 *         <xslt.xmlXPathFunction>_xpath_function_call)
 * 
 * cdef dict EMPTY_DICT = {}             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __pyx_t_17 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_EMPTY_DICT, ((PyObject*)__pyx_t_17));
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":437
 *         return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         """strparam(strval)
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_7strparam, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLT_strparam, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__494)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_strparam, __pyx_t_17) < 0) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);
  __Pyx_GetNameInClass(__pyx_t_17, (PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_strparam); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_strparam, __pyx_t_12) < 0) __PYX_ERR(5, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "src/lxml/xslt.pxi":451
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         """set_global_max_depth(max_depth)
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_9set_global_max_depth, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLT_set_global_max_depth, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__496)); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_set_global_max_depth, __pyx_t_12) < 0) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);
  __Pyx_GetNameInClass(__pyx_t_12, (PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_set_global_max_depth); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_12); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_set_global_max_depth, __pyx_t_17) < 0) __PYX_ERR(5, 451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "src/lxml/xslt.pxi":471
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         """tostring(self, result_tree)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_11tostring, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLT_tostring, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__498)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_tostring, __pyx_t_17) < 0) __PYX_ERR(5, 471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "src/lxml/xslt.pxi":480
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_13__deepcopy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLT___deepcopy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__499)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_deepcopy, __pyx_t_17) < 0) __PYX_ERR(5, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "src/lxml/xslt.pxi":483
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_4XSLT_15__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLT___copy, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__500)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_copy_2, __pyx_t_17) < 0) __PYX_ERR(5, 483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "src/lxml/xslt.pxi":711
 *     cdef Py_ssize_t _buffer_refcnt
 * 
 *     def write_output(self, file, *, compression=0):             # <<<<<<<<<<<<<<
 *         """write_output(self, file, *, compression=0)
 * 
 */
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_compression, __pyx_int_0) < 0) __PYX_ERR(5, 711, __pyx_L1_error)
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_XSLTResultTree_1write_output, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTResultTree_write_output, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__502)); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__XSLTResultTree, __pyx_n_s_write_output, __pyx_t_12) < 0) __PYX_ERR(5, 711, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__XSLTResultTree);

  /* "src/lxml/xslt.pxi":851
 * # 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();

  /* "src/lxml/xslt.pxi":854
 * 
 * # enable EXSLT support for XSLT
 * xslt.exsltRegisterAll()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  exsltRegisterAll();

  /* "src/lxml/xslt.pxi":860
 * # XSLT PI support
 * 
 * cdef object _RE_PI_HREF = re.compile(r'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')             # <<<<<<<<<<<<<<
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 */
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__503, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__RE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":861
 * 
 * cdef object _RE_PI_HREF = re.compile(r'\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_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s_findall); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_HREF, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":862
 * cdef object _RE_PI_HREF = re.compile(r'\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_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s_sub); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_17 = 0;

  /* "src/lxml/xslt.pxi":863
 * 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);

  /* "src/lxml/xslt.pxi":874
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         """parseXSL(self, parser=None)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTProcessingInstruction_parse, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__505)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_n_s_parseXSL, __pyx_t_17) < 0) __PYX_ERR(5, 874, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);

  /* "src/lxml/xslt.pxi":931
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         """set(self, key, value)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_26_XSLTProcessingInstruction_3set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTProcessingInstruction_set, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__507)); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction, __pyx_n_s_set, __pyx_t_17) < 0) __PYX_ERR(5, 931, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction);

  /* "src/lxml/xsltext.pxi":6
 *     """Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         """execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_1execute, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTExtension_execute, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__509)); if (unlikely(!__pyx_t_17)) __PYX_ERR(19, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_n_s_execute, __pyx_t_17) < 0) __PYX_ERR(19, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTExtension);

  /* "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):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_t_17 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(19, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);

  /* "src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_elements_only, Py_False) < 0) __PYX_ERR(19, 22, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_remove_blank_text, Py_False) < 0) __PYX_ERR(19, 22, __pyx_L1_error)

  /* "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):
 *         """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_3apply_templates, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTExtension_apply_templates, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__511)); if (unlikely(!__pyx_t_12)) __PYX_ERR(19, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_12, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_n_s_apply_templates, __pyx_t_12) < 0) __PYX_ERR(19, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTExtension);

  /* "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):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(19, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);

  /* "src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_elements_only, Py_False) < 0) __PYX_ERR(19, 74, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_remove_blank_text, Py_False) < 0) __PYX_ERR(19, 74, __pyx_L1_error)

  /* "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):
 *         """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_13XSLTExtension_5process_children, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_XSLTExtension_process_children, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__513)); if (unlikely(!__pyx_t_17)) __PYX_ERR(19, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_tuple__189);
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_17, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_XSLTExtension, __pyx_n_s_process_children, __pyx_t_17) < 0) __PYX_ERR(19, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTExtension);

  /* "lxml/etree.pyx":3677
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         """validate(self, etree)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_3validate, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Validator_validate, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__515)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Validator, __pyx_n_s_validate, __pyx_t_17) < 0) __PYX_ERR(0, 3677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Validator);

  /* "lxml/etree.pyx":3686
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         """assertValid(self, etree)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_5assertValid, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Validator_assertValid, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__516)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Validator, __pyx_n_s_assertValid, __pyx_t_17) < 0) __PYX_ERR(0, 3686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Validator);

  /* "lxml/etree.pyx":3696
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         """assert_(self, etree)
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_7assert_, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Validator_assert, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__517)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Validator, __pyx_n_s_assert, __pyx_t_17) < 0) __PYX_ERR(0, 3696, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Validator);

  /* "lxml/etree.pyx":3705
 *                 "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,
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_9_append_log_message, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Validator__append_log_message, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__519)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Validator, __pyx_n_s_append_log_message, __pyx_t_17) < 0) __PYX_ERR(0, 3705, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Validator);

  /* "lxml/etree.pyx":3710
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_10_Validator_11_clear_error_log, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Validator__clear_error_log, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__520)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__Validator, __pyx_n_s_clear_error_log, __pyx_t_17) < 0) __PYX_ERR(0, 3710, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__Validator);

  /* "src/lxml/dtd.pxi":163
 *        return funicodeOrNone(self._c_node.defaultValue)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_3itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTDAttributeDecl_itervalues, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__DTDAttributeDecl, __pyx_n_s_itervalues, __pyx_t_17) < 0) __PYX_ERR(20, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__DTDAttributeDecl);

  /* "src/lxml/dtd.pxi":170
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_17_DTDAttributeDecl_6values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTDAttributeDecl_values, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__521)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__DTDAttributeDecl, __pyx_n_s_values, __pyx_t_17) < 0) __PYX_ERR(20, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__DTDAttributeDecl);

  /* "src/lxml/dtd.pxi":223
 *            return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DTDElementDecl_3iterattributes, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTDElementDecl_iterattributes, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__DTDElementDecl, __pyx_n_s_iterattributes, __pyx_t_17) < 0) __PYX_ERR(20, 223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__DTDElementDecl);

  /* "src/lxml/dtd.pxi":233
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_15_DTDElementDecl_6attributes, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTDElementDecl_attributes, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__523)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__DTDElementDecl, __pyx_n_s_attributes, __pyx_t_17) < 0) __PYX_ERR(20, 233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__DTDElementDecl);

  /* "src/lxml/dtd.pxi":326
 *        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:
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_3iterelements, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTD_iterelements, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_DTD, __pyx_n_s_iterelements, __pyx_t_17) < 0) __PYX_ERR(20, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_DTD);

  /* "src/lxml/dtd.pxi":336
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_6elements, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTD_elements, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__524)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_DTD, __pyx_n_s_elements, __pyx_t_17) < 0) __PYX_ERR(20, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_DTD);

  /* "src/lxml/dtd.pxi":339
 *         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:
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_8iterentities, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTD_iterentities, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_DTD, __pyx_n_s_iterentities, __pyx_t_17) < 0) __PYX_ERR(20, 339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_DTD);

  /* "src/lxml/dtd.pxi":349
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
 */
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_3DTD_11entities, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DTD_entities, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__525)); if (unlikely(!__pyx_t_17)) __PYX_ERR(20, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_DTD, __pyx_n_s_entities, __pyx_t_17) < 0) __PYX_ERR(20, 349, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_DTD);

  /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "src/lxml/relaxng.pxi":6
 * cdef object _rnc2rng
 * try:
 *     import rnc2rng as _rnc2rng             # <<<<<<<<<<<<<<
 * except ImportError:
 *     _rnc2rng = None
 */
      __pyx_t_17 = __Pyx_ImportDottedModule(__pyx_n_s_rnc2rng, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(21, 6, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__rnc2rng);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__rnc2rng, __pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_17);
      __pyx_t_17 = 0;

      /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
 */
    }
    __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;
    goto __pyx_L27_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 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;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "src/lxml/relaxng.pxi":7
 * try:
 *     import rnc2rng as _rnc2rng
 * except ImportError:             # <<<<<<<<<<<<<<
 *     _rnc2rng = None
 * 
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_17, &__pyx_t_12, &__pyx_t_2) < 0) __PYX_ERR(21, 7, __pyx_L24_except_error)
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "src/lxml/relaxng.pxi":8
 *     import rnc2rng as _rnc2rng
 * except ImportError:
 *     _rnc2rng = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__rnc2rng);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__rnc2rng, Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L23_exception_handled;
    }
    goto __pyx_L24_except_error;

    /* "src/lxml/relaxng.pxi":5
 * 
 * cdef object _rnc2rng
 * try:             # <<<<<<<<<<<<<<
 *     import rnc2rng as _rnc2rng
 * except ImportError:
 */
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_7, __pyx_t_8);
    __pyx_L27_try_end:;
  }

  /* "src/lxml/relaxng.pxi":154
 *             return False
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_rnc_string(cls, src, base_url=None):
 *         """Parse a RelaxNG schema in compact syntax from a text string
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_7RelaxNG_9from_rnc_string, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_RelaxNG_from_rnc_string, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__527)); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__189);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_n_s_from_rnc_string, __pyx_t_2) < 0) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_RelaxNG);
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_n_s_from_rnc_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree_RelaxNG, __pyx_n_s_from_rnc_string, __pyx_t_12) < 0) __PYX_ERR(21, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_RelaxNG);

  /* "src/lxml/xmlschema.pxi":23
 * cdef XPath _check_for_default_attributes = XPath(
 *     "boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(22, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_xs, __pyx_kp_u_http_www_w3_org_2001_XMLSchema) < 0) __PYX_ERR(22, 23, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_namespaces, __pyx_t_2) < 0) __PYX_ERR(22, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/xmlschema.pxi":21
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     "boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_5etree_XPath), __pyx_tuple__528, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/debug.pxi":6
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_1bytes_used, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MemDebug_bytes_used, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__529)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug, __pyx_n_s_bytes_used, __pyx_t_2) < 0) __PYX_ERR(25, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MemDebug);

  /* "src/lxml/debug.pxi":15
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_3blocks_used, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MemDebug_blocks_used, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__530)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug, __pyx_n_s_blocks_used, __pyx_t_2) < 0) __PYX_ERR(25, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MemDebug);

  /* "src/lxml/debug.pxi":24
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_5dict_size, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MemDebug_dict_size, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__532)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug, __pyx_n_s_dict_size, __pyx_t_2) < 0) __PYX_ERR(25, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MemDebug);

  /* "src/lxml/debug.pxi":35
 *         return tree.xmlDictSize(c_dict)
 * 
 *     def dump(self, output_file=None, byte_count=None):             # <<<<<<<<<<<<<<
 *         """dump(self, output_file=None, byte_count=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_7dump, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MemDebug_dump, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__534)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug, __pyx_n_s_dump, __pyx_t_2) < 0) __PYX_ERR(25, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MemDebug);

  /* "src/lxml/debug.pxi":65
 *             stdio.fclose(f)
 * 
 *     def show(self, output_file=None, block_count=None):             # <<<<<<<<<<<<<<
 *         """show(self, output_file=None, block_count=None)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_5etree_9_MemDebug_9show, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MemDebug_show, NULL, __pyx_n_s_lxml_etree, __pyx_d, ((PyObject *)__pyx_codeobj__536)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__186);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug, __pyx_n_s_show, __pyx_t_2) < 0) __PYX_ERR(25, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree__MemDebug);

  /* "src/lxml/debug.pxi":90
 *             stdio.fclose(f)
 * 
 * memory_debugger = _MemDebug()             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_5etree__MemDebug)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_memory_debugger, __pyx_t_2) < 0) __PYX_ERR(25, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "lxml/etree.pyx":1
 * # cython: binding=True             # <<<<<<<<<<<<<<
 * # cython: auto_pickle=False
 * # cython: language_level=3
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_XML_line_3261, __pyx_kp_u_XML_text_parser_None_base_url_No) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_FunctionNamespace_line_207, __pyx_kp_u_FunctionNamespace_ns_uri_Retriev) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error)
  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_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  if (__pyx_m) {
    if (__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init lxml.etree");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}
/* #### Code section: cleanup_globals ### */

static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
  Py_CLEAR(__pyx_tuple_);
  Py_CLEAR(__pyx_tuple__2);
  Py_CLEAR(__pyx_tuple__5);
  Py_CLEAR(__pyx_slice__6);
  Py_CLEAR(__pyx_slice__7);
  Py_CLEAR(__pyx_slice__8);
  Py_CLEAR(__pyx_slice__9);
  Py_CLEAR(__pyx_tuple__10);
  Py_CLEAR(__pyx_tuple__13);
  Py_CLEAR(__pyx_tuple__14);
  Py_CLEAR(__pyx_tuple__15);
  Py_CLEAR(__pyx_tuple__16);
  Py_CLEAR(__pyx_tuple__23);
  Py_CLEAR(__pyx_tuple__27);
  Py_CLEAR(__pyx_tuple__31);
  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_slice__44);
  Py_CLEAR(__pyx_tuple__46);
  Py_CLEAR(__pyx_tuple__47);
  Py_CLEAR(__pyx_tuple__49);
  Py_CLEAR(__pyx_tuple__51);
  Py_CLEAR(__pyx_tuple__53);
  Py_CLEAR(__pyx_tuple__54);
  Py_CLEAR(__pyx_slice__55);
  Py_CLEAR(__pyx_tuple__58);
  Py_CLEAR(__pyx_tuple__59);
  Py_CLEAR(__pyx_tuple__60);
  Py_CLEAR(__pyx_codeobj__62);
  Py_CLEAR(__pyx_tuple__64);
  Py_CLEAR(__pyx_tuple__65);
  Py_CLEAR(__pyx_tuple__66);
  Py_CLEAR(__pyx_codeobj__67);
  Py_CLEAR(__pyx_tuple__68);
  Py_CLEAR(__pyx_slice__69);
  Py_CLEAR(__pyx_tuple__70);
  Py_CLEAR(__pyx_codeobj__76);
  Py_CLEAR(__pyx_tuple__77);
  Py_CLEAR(__pyx_tuple__78);
  Py_CLEAR(__pyx_codeobj__79);
  Py_CLEAR(__pyx_slice__80);
  Py_CLEAR(__pyx_slice__81);
  Py_CLEAR(__pyx_codeobj__82);
  Py_CLEAR(__pyx_codeobj__83);
  Py_CLEAR(__pyx_codeobj__84);
  Py_CLEAR(__pyx_codeobj__85);
  Py_CLEAR(__pyx_codeobj__86);
  Py_CLEAR(__pyx_codeobj__87);
  Py_CLEAR(__pyx_codeobj__88);
  Py_CLEAR(__pyx_codeobj__89);
  Py_CLEAR(__pyx_codeobj__90);
  Py_CLEAR(__pyx_tuple__91);
  Py_CLEAR(__pyx_tuple__92);
  Py_CLEAR(__pyx_slice__93);
  Py_CLEAR(__pyx_slice__94);
  Py_CLEAR(__pyx_tuple__97);
  Py_CLEAR(__pyx_tuple__98);
  Py_CLEAR(__pyx_codeobj__99);
  Py_CLEAR(__pyx_codeobj__100);
  Py_CLEAR(__pyx_codeobj__101);
  Py_CLEAR(__pyx_codeobj__102);
  Py_CLEAR(__pyx_tuple__103);
  Py_CLEAR(__pyx_tuple__104);
  Py_CLEAR(__pyx_slice__105);
  Py_CLEAR(__pyx_tuple__107);
  Py_CLEAR(__pyx_codeobj__108);
  Py_CLEAR(__pyx_tuple__109);
  Py_CLEAR(__pyx_codeobj__110);
  Py_CLEAR(__pyx_codeobj__111);
  Py_CLEAR(__pyx_codeobj__112);
  Py_CLEAR(__pyx_tuple__113);
  Py_CLEAR(__pyx_codeobj__114);
  Py_CLEAR(__pyx_codeobj__115);
  Py_CLEAR(__pyx_tuple__116);
  Py_CLEAR(__pyx_tuple__117);
  Py_CLEAR(__pyx_tuple__118);
  Py_CLEAR(__pyx_codeobj__119);
  Py_CLEAR(__pyx_tuple__120);
  Py_CLEAR(__pyx_codeobj__121);
  Py_CLEAR(__pyx_codeobj__122);
  Py_CLEAR(__pyx_tuple__123);
  Py_CLEAR(__pyx_codeobj__124);
  Py_CLEAR(__pyx_codeobj__125);
  Py_CLEAR(__pyx_tuple__126);
  Py_CLEAR(__pyx_codeobj__127);
  Py_CLEAR(__pyx_tuple__128);
  Py_CLEAR(__pyx_codeobj__129);
  Py_CLEAR(__pyx_tuple__130);
  Py_CLEAR(__pyx_codeobj__131);
  Py_CLEAR(__pyx_tuple__132);
  Py_CLEAR(__pyx_codeobj__133);
  Py_CLEAR(__pyx_codeobj__134);
  Py_CLEAR(__pyx_codeobj__135);
  Py_CLEAR(__pyx_codeobj__136);
  Py_CLEAR(__pyx_tuple__137);
  Py_CLEAR(__pyx_codeobj__138);
  Py_CLEAR(__pyx_codeobj__139);
  Py_CLEAR(__pyx_codeobj__140);
  Py_CLEAR(__pyx_codeobj__141);
  Py_CLEAR(__pyx_codeobj__142);
  Py_CLEAR(__pyx_codeobj__143);
  Py_CLEAR(__pyx_codeobj__144);
  Py_CLEAR(__pyx_tuple__145);
  Py_CLEAR(__pyx_codeobj__146);
  Py_CLEAR(__pyx_tuple__147);
  Py_CLEAR(__pyx_codeobj__148);
  Py_CLEAR(__pyx_tuple__149);
  Py_CLEAR(__pyx_codeobj__150);
  Py_CLEAR(__pyx_tuple__151);
  Py_CLEAR(__pyx_tuple__152);
  Py_CLEAR(__pyx_tuple__153);
  Py_CLEAR(__pyx_tuple__154);
  Py_CLEAR(__pyx_tuple__155);
  Py_CLEAR(__pyx_tuple__156);
  Py_CLEAR(__pyx_tuple__157);
  Py_CLEAR(__pyx_tuple__158);
  Py_CLEAR(__pyx_tuple__159);
  Py_CLEAR(__pyx_tuple__160);
  Py_CLEAR(__pyx_codeobj__161);
  Py_CLEAR(__pyx_codeobj__162);
  Py_CLEAR(__pyx_tuple__163);
  Py_CLEAR(__pyx_codeobj__164);
  Py_CLEAR(__pyx_tuple__165);
  Py_CLEAR(__pyx_codeobj__166);
  Py_CLEAR(__pyx_codeobj__167);
  Py_CLEAR(__pyx_tuple__168);
  Py_CLEAR(__pyx_codeobj__169);
  Py_CLEAR(__pyx_codeobj__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_tuple__176);
  Py_CLEAR(__pyx_tuple__177);
  Py_CLEAR(__pyx_codeobj__178);
  Py_CLEAR(__pyx_tuple__179);
  Py_CLEAR(__pyx_codeobj__180);
  Py_CLEAR(__pyx_tuple__181);
  Py_CLEAR(__pyx_codeobj__182);
  Py_CLEAR(__pyx_codeobj__183);
  Py_CLEAR(__pyx_tuple__184);
  Py_CLEAR(__pyx_codeobj__185);
  Py_CLEAR(__pyx_tuple__186);
  Py_CLEAR(__pyx_tuple__187);
  Py_CLEAR(__pyx_codeobj__188);
  Py_CLEAR(__pyx_tuple__189);
  Py_CLEAR(__pyx_codeobj__190);
  Py_CLEAR(__pyx_codeobj__191);
  Py_CLEAR(__pyx_codeobj__192);
  Py_CLEAR(__pyx_codeobj__193);
  Py_CLEAR(__pyx_tuple__194);
  Py_CLEAR(__pyx_codeobj__195);
  Py_CLEAR(__pyx_codeobj__196);
  Py_CLEAR(__pyx_codeobj__197);
  Py_CLEAR(__pyx_tuple__198);
  Py_CLEAR(__pyx_codeobj__199);
  Py_CLEAR(__pyx_tuple__200);
  Py_CLEAR(__pyx_codeobj__201);
  Py_CLEAR(__pyx_codeobj__202);
  Py_CLEAR(__pyx_tuple__203);
  Py_CLEAR(__pyx_codeobj__204);
  Py_CLEAR(__pyx_codeobj__205);
  Py_CLEAR(__pyx_codeobj__206);
  Py_CLEAR(__pyx_codeobj__207);
  Py_CLEAR(__pyx_tuple__208);
  Py_CLEAR(__pyx_codeobj__209);
  Py_CLEAR(__pyx_tuple__210);
  Py_CLEAR(__pyx_codeobj__211);
  Py_CLEAR(__pyx_tuple__212);
  Py_CLEAR(__pyx_codeobj__213);
  Py_CLEAR(__pyx_tuple__214);
  Py_CLEAR(__pyx_codeobj__215);
  Py_CLEAR(__pyx_codeobj__216);
  Py_CLEAR(__pyx_codeobj__217);
  Py_CLEAR(__pyx_tuple__218);
  Py_CLEAR(__pyx_codeobj__219);
  Py_CLEAR(__pyx_tuple__220);
  Py_CLEAR(__pyx_codeobj__221);
  Py_CLEAR(__pyx_codeobj__222);
  Py_CLEAR(__pyx_tuple__223);
  Py_CLEAR(__pyx_codeobj__224);
  Py_CLEAR(__pyx_tuple__225);
  Py_CLEAR(__pyx_codeobj__226);
  Py_CLEAR(__pyx_codeobj__227);
  Py_CLEAR(__pyx_codeobj__228);
  Py_CLEAR(__pyx_codeobj__229);
  Py_CLEAR(__pyx_codeobj__230);
  Py_CLEAR(__pyx_codeobj__231);
  Py_CLEAR(__pyx_tuple__232);
  Py_CLEAR(__pyx_codeobj__233);
  Py_CLEAR(__pyx_tuple__234);
  Py_CLEAR(__pyx_codeobj__235);
  Py_CLEAR(__pyx_codeobj__236);
  Py_CLEAR(__pyx_codeobj__237);
  Py_CLEAR(__pyx_tuple__238);
  Py_CLEAR(__pyx_codeobj__239);
  Py_CLEAR(__pyx_tuple__240);
  Py_CLEAR(__pyx_codeobj__241);
  Py_CLEAR(__pyx_tuple__242);
  Py_CLEAR(__pyx_codeobj__243);
  Py_CLEAR(__pyx_tuple__244);
  Py_CLEAR(__pyx_codeobj__245);
  Py_CLEAR(__pyx_tuple__246);
  Py_CLEAR(__pyx_codeobj__247);
  Py_CLEAR(__pyx_codeobj__248);
  Py_CLEAR(__pyx_tuple__249);
  Py_CLEAR(__pyx_codeobj__250);
  Py_CLEAR(__pyx_tuple__251);
  Py_CLEAR(__pyx_codeobj__252);
  Py_CLEAR(__pyx_codeobj__253);
  Py_CLEAR(__pyx_codeobj__254);
  Py_CLEAR(__pyx_codeobj__255);
  Py_CLEAR(__pyx_tuple__256);
  Py_CLEAR(__pyx_codeobj__257);
  Py_CLEAR(__pyx_tuple__258);
  Py_CLEAR(__pyx_codeobj__259);
  Py_CLEAR(__pyx_tuple__260);
  Py_CLEAR(__pyx_codeobj__261);
  Py_CLEAR(__pyx_codeobj__262);
  Py_CLEAR(__pyx_tuple__263);
  Py_CLEAR(__pyx_codeobj__264);
  Py_CLEAR(__pyx_tuple__265);
  Py_CLEAR(__pyx_codeobj__266);
  Py_CLEAR(__pyx_tuple__267);
  Py_CLEAR(__pyx_codeobj__268);
  Py_CLEAR(__pyx_tuple__269);
  Py_CLEAR(__pyx_codeobj__270);
  Py_CLEAR(__pyx_codeobj__271);
  Py_CLEAR(__pyx_codeobj__272);
  Py_CLEAR(__pyx_codeobj__273);
  Py_CLEAR(__pyx_codeobj__274);
  Py_CLEAR(__pyx_codeobj__275);
  Py_CLEAR(__pyx_codeobj__276);
  Py_CLEAR(__pyx_codeobj__277);
  Py_CLEAR(__pyx_codeobj__278);
  Py_CLEAR(__pyx_codeobj__279);
  Py_CLEAR(__pyx_codeobj__280);
  Py_CLEAR(__pyx_tuple__281);
  Py_CLEAR(__pyx_codeobj__282);
  Py_CLEAR(__pyx_tuple__283);
  Py_CLEAR(__pyx_codeobj__284);
  Py_CLEAR(__pyx_tuple__285);
  Py_CLEAR(__pyx_codeobj__286);
  Py_CLEAR(__pyx_tuple__287);
  Py_CLEAR(__pyx_codeobj__288);
  Py_CLEAR(__pyx_tuple__289);
  Py_CLEAR(__pyx_codeobj__290);
  Py_CLEAR(__pyx_tuple__291);
  Py_CLEAR(__pyx_codeobj__292);
  Py_CLEAR(__pyx_tuple__293);
  Py_CLEAR(__pyx_codeobj__294);
  Py_CLEAR(__pyx_codeobj__295);
  Py_CLEAR(__pyx_codeobj__296);
  Py_CLEAR(__pyx_tuple__297);
  Py_CLEAR(__pyx_codeobj__298);
  Py_CLEAR(__pyx_tuple__299);
  Py_CLEAR(__pyx_codeobj__300);
  Py_CLEAR(__pyx_tuple__301);
  Py_CLEAR(__pyx_codeobj__302);
  Py_CLEAR(__pyx_tuple__303);
  Py_CLEAR(__pyx_tuple__304);
  Py_CLEAR(__pyx_codeobj__305);
  Py_CLEAR(__pyx_tuple__306);
  Py_CLEAR(__pyx_codeobj__307);
  Py_CLEAR(__pyx_tuple__308);
  Py_CLEAR(__pyx_codeobj__309);
  Py_CLEAR(__pyx_tuple__310);
  Py_CLEAR(__pyx_codeobj__311);
  Py_CLEAR(__pyx_tuple__312);
  Py_CLEAR(__pyx_codeobj__313);
  Py_CLEAR(__pyx_tuple__314);
  Py_CLEAR(__pyx_codeobj__315);
  Py_CLEAR(__pyx_codeobj__316);
  Py_CLEAR(__pyx_codeobj__317);
  Py_CLEAR(__pyx_tuple__318);
  Py_CLEAR(__pyx_codeobj__319);
  Py_CLEAR(__pyx_codeobj__320);
  Py_CLEAR(__pyx_tuple__321);
  Py_CLEAR(__pyx_codeobj__322);
  Py_CLEAR(__pyx_codeobj__323);
  Py_CLEAR(__pyx_codeobj__324);
  Py_CLEAR(__pyx_codeobj__325);
  Py_CLEAR(__pyx_codeobj__326);
  Py_CLEAR(__pyx_codeobj__327);
  Py_CLEAR(__pyx_codeobj__328);
  Py_CLEAR(__pyx_tuple__329);
  Py_CLEAR(__pyx_codeobj__330);
  Py_CLEAR(__pyx_codeobj__331);
  Py_CLEAR(__pyx_codeobj__332);
  Py_CLEAR(__pyx_codeobj__333);
  Py_CLEAR(__pyx_tuple__334);
  Py_CLEAR(__pyx_codeobj__335);
  Py_CLEAR(__pyx_tuple__336);
  Py_CLEAR(__pyx_codeobj__337);
  Py_CLEAR(__pyx_tuple__338);
  Py_CLEAR(__pyx_codeobj__339);
  Py_CLEAR(__pyx_tuple__340);
  Py_CLEAR(__pyx_codeobj__341);
  Py_CLEAR(__pyx_tuple__342);
  Py_CLEAR(__pyx_codeobj__343);
  Py_CLEAR(__pyx_codeobj__344);
  Py_CLEAR(__pyx_codeobj__345);
  Py_CLEAR(__pyx_codeobj__346);
  Py_CLEAR(__pyx_tuple__347);
  Py_CLEAR(__pyx_codeobj__348);
  Py_CLEAR(__pyx_tuple__349);
  Py_CLEAR(__pyx_codeobj__350);
  Py_CLEAR(__pyx_tuple__351);
  Py_CLEAR(__pyx_codeobj__352);
  Py_CLEAR(__pyx_tuple__353);
  Py_CLEAR(__pyx_codeobj__354);
  Py_CLEAR(__pyx_tuple__355);
  Py_CLEAR(__pyx_codeobj__356);
  Py_CLEAR(__pyx_tuple__357);
  Py_CLEAR(__pyx_codeobj__358);
  Py_CLEAR(__pyx_tuple__359);
  Py_CLEAR(__pyx_codeobj__360);
  Py_CLEAR(__pyx_tuple__361);
  Py_CLEAR(__pyx_codeobj__362);
  Py_CLEAR(__pyx_tuple__363);
  Py_CLEAR(__pyx_codeobj__364);
  Py_CLEAR(__pyx_codeobj__365);
  Py_CLEAR(__pyx_codeobj__366);
  Py_CLEAR(__pyx_tuple__367);
  Py_CLEAR(__pyx_codeobj__368);
  Py_CLEAR(__pyx_tuple__369);
  Py_CLEAR(__pyx_codeobj__370);
  Py_CLEAR(__pyx_codeobj__371);
  Py_CLEAR(__pyx_tuple__372);
  Py_CLEAR(__pyx_codeobj__373);
  Py_CLEAR(__pyx_codeobj__374);
  Py_CLEAR(__pyx_codeobj__375);
  Py_CLEAR(__pyx_codeobj__376);
  Py_CLEAR(__pyx_tuple__377);
  Py_CLEAR(__pyx_codeobj__378);
  Py_CLEAR(__pyx_codeobj__379);
  Py_CLEAR(__pyx_codeobj__380);
  Py_CLEAR(__pyx_tuple__381);
  Py_CLEAR(__pyx_codeobj__382);
  Py_CLEAR(__pyx_codeobj__383);
  Py_CLEAR(__pyx_codeobj__384);
  Py_CLEAR(__pyx_tuple__385);
  Py_CLEAR(__pyx_codeobj__386);
  Py_CLEAR(__pyx_codeobj__387);
  Py_CLEAR(__pyx_codeobj__388);
  Py_CLEAR(__pyx_tuple__389);
  Py_CLEAR(__pyx_codeobj__390);
  Py_CLEAR(__pyx_tuple__391);
  Py_CLEAR(__pyx_codeobj__392);
  Py_CLEAR(__pyx_tuple__393);
  Py_CLEAR(__pyx_codeobj__394);
  Py_CLEAR(__pyx_tuple__395);
  Py_CLEAR(__pyx_codeobj__396);
  Py_CLEAR(__pyx_tuple__397);
  Py_CLEAR(__pyx_codeobj__398);
  Py_CLEAR(__pyx_tuple__399);
  Py_CLEAR(__pyx_tuple__400);
  Py_CLEAR(__pyx_tuple__401);
  Py_CLEAR(__pyx_codeobj__402);
  Py_CLEAR(__pyx_tuple__403);
  Py_CLEAR(__pyx_codeobj__404);
  Py_CLEAR(__pyx_tuple__405);
  Py_CLEAR(__pyx_codeobj__406);
  Py_CLEAR(__pyx_tuple__407);
  Py_CLEAR(__pyx_codeobj__408);
  Py_CLEAR(__pyx_tuple__409);
  Py_CLEAR(__pyx_codeobj__410);
  Py_CLEAR(__pyx_tuple__411);
  Py_CLEAR(__pyx_codeobj__412);
  Py_CLEAR(__pyx_codeobj__413);
  Py_CLEAR(__pyx_codeobj__414);
  Py_CLEAR(__pyx_codeobj__415);
  Py_CLEAR(__pyx_tuple__416);
  Py_CLEAR(__pyx_codeobj__417);
  Py_CLEAR(__pyx_tuple__418);
  Py_CLEAR(__pyx_codeobj__419);
  Py_CLEAR(__pyx_tuple__420);
  Py_CLEAR(__pyx_codeobj__421);
  Py_CLEAR(__pyx_tuple__422);
  Py_CLEAR(__pyx_codeobj__423);
  Py_CLEAR(__pyx_tuple__424);
  Py_CLEAR(__pyx_codeobj__425);
  Py_CLEAR(__pyx_tuple__426);
  Py_CLEAR(__pyx_codeobj__427);
  Py_CLEAR(__pyx_codeobj__428);
  Py_CLEAR(__pyx_codeobj__429);
  Py_CLEAR(__pyx_codeobj__430);
  Py_CLEAR(__pyx_tuple__431);
  Py_CLEAR(__pyx_tuple__432);
  Py_CLEAR(__pyx_tuple__433);
  Py_CLEAR(__pyx_tuple__434);
  Py_CLEAR(__pyx_codeobj__435);
  Py_CLEAR(__pyx_tuple__436);
  Py_CLEAR(__pyx_codeobj__437);
  Py_CLEAR(__pyx_tuple__438);
  Py_CLEAR(__pyx_tuple__439);
  Py_CLEAR(__pyx_codeobj__440);
  Py_CLEAR(__pyx_tuple__441);
  Py_CLEAR(__pyx_codeobj__442);
  Py_CLEAR(__pyx_codeobj__443);
  Py_CLEAR(__pyx_codeobj__444);
  Py_CLEAR(__pyx_codeobj__445);
  Py_CLEAR(__pyx_codeobj__446);
  Py_CLEAR(__pyx_codeobj__447);
  Py_CLEAR(__pyx_tuple__448);
  Py_CLEAR(__pyx_codeobj__449);
  Py_CLEAR(__pyx_tuple__450);
  Py_CLEAR(__pyx_codeobj__451);
  Py_CLEAR(__pyx_tuple__452);
  Py_CLEAR(__pyx_codeobj__453);
  Py_CLEAR(__pyx_codeobj__454);
  Py_CLEAR(__pyx_tuple__455);
  Py_CLEAR(__pyx_codeobj__456);
  Py_CLEAR(__pyx_codeobj__457);
  Py_CLEAR(__pyx_codeobj__458);
  Py_CLEAR(__pyx_codeobj__459);
  Py_CLEAR(__pyx_codeobj__460);
  Py_CLEAR(__pyx_codeobj__461);
  Py_CLEAR(__pyx_tuple__462);
  Py_CLEAR(__pyx_codeobj__463);
  Py_CLEAR(__pyx_codeobj__464);
  Py_CLEAR(__pyx_tuple__465);
  Py_CLEAR(__pyx_codeobj__466);
  Py_CLEAR(__pyx_tuple__467);
  Py_CLEAR(__pyx_codeobj__468);
  Py_CLEAR(__pyx_tuple__469);
  Py_CLEAR(__pyx_codeobj__470);
  Py_CLEAR(__pyx_tuple__471);
  Py_CLEAR(__pyx_codeobj__472);
  Py_CLEAR(__pyx_tuple__473);
  Py_CLEAR(__pyx_tuple__474);
  Py_CLEAR(__pyx_codeobj__475);
  Py_CLEAR(__pyx_tuple__476);
  Py_CLEAR(__pyx_codeobj__477);
  Py_CLEAR(__pyx_tuple__478);
  Py_CLEAR(__pyx_tuple__479);
  Py_CLEAR(__pyx_codeobj__480);
  Py_CLEAR(__pyx_tuple__481);
  Py_CLEAR(__pyx_codeobj__482);
  Py_CLEAR(__pyx_codeobj__483);
  Py_CLEAR(__pyx_codeobj__484);
  Py_CLEAR(__pyx_tuple__485);
  Py_CLEAR(__pyx_codeobj__486);
  Py_CLEAR(__pyx_tuple__487);
  Py_CLEAR(__pyx_codeobj__488);
  Py_CLEAR(__pyx_tuple__490);
  Py_CLEAR(__pyx_tuple__492);
  Py_CLEAR(__pyx_tuple__493);
  Py_CLEAR(__pyx_codeobj__494);
  Py_CLEAR(__pyx_tuple__495);
  Py_CLEAR(__pyx_codeobj__496);
  Py_CLEAR(__pyx_tuple__497);
  Py_CLEAR(__pyx_codeobj__498);
  Py_CLEAR(__pyx_codeobj__499);
  Py_CLEAR(__pyx_codeobj__500);
  Py_CLEAR(__pyx_tuple__501);
  Py_CLEAR(__pyx_codeobj__502);
  Py_CLEAR(__pyx_tuple__503);
  Py_CLEAR(__pyx_tuple__504);
  Py_CLEAR(__pyx_codeobj__505);
  Py_CLEAR(__pyx_tuple__506);
  Py_CLEAR(__pyx_codeobj__507);
  Py_CLEAR(__pyx_tuple__508);
  Py_CLEAR(__pyx_codeobj__509);
  Py_CLEAR(__pyx_tuple__510);
  Py_CLEAR(__pyx_codeobj__511);
  Py_CLEAR(__pyx_tuple__512);
  Py_CLEAR(__pyx_codeobj__513);
  Py_CLEAR(__pyx_tuple__514);
  Py_CLEAR(__pyx_codeobj__515);
  Py_CLEAR(__pyx_codeobj__516);
  Py_CLEAR(__pyx_codeobj__517);
  Py_CLEAR(__pyx_tuple__518);
  Py_CLEAR(__pyx_codeobj__519);
  Py_CLEAR(__pyx_codeobj__520);
  Py_CLEAR(__pyx_codeobj__521);
  Py_CLEAR(__pyx_tuple__522);
  Py_CLEAR(__pyx_codeobj__523);
  Py_CLEAR(__pyx_codeobj__524);
  Py_CLEAR(__pyx_codeobj__525);
  Py_CLEAR(__pyx_tuple__526);
  Py_CLEAR(__pyx_codeobj__527);
  Py_CLEAR(__pyx_tuple__528);
  Py_CLEAR(__pyx_codeobj__529);
  Py_CLEAR(__pyx_codeobj__530);
  Py_CLEAR(__pyx_tuple__531);
  Py_CLEAR(__pyx_codeobj__532);
  Py_CLEAR(__pyx_tuple__533);
  Py_CLEAR(__pyx_codeobj__534);
  Py_CLEAR(__pyx_tuple__535);
  Py_CLEAR(__pyx_codeobj__536);
  /* CodeObjectCache.cleanup */
  #if !CYTHON_COMPILING_IN_LIMITED_API
  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);
  }
  #endif

Py_CLEAR(__pyx_umethod_PyBytes_Type_replace.method);
  Py_CLEAR(__pyx_umethod_PyBytes_Type_split.method);
  Py_CLEAR(__pyx_umethod_PyDict_Type_get.method);
  Py_CLEAR(__pyx_umethod_PyDict_Type_items.method);
  Py_CLEAR(__pyx_umethod_PyDict_Type_values.method);
  Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
  Py_CLEAR(__pyx_umethod_PySet_Type_update.method);
  Py_CLEAR(__pyx_umethod_PyUnicode_Type_strip.method);
}
/* #### Code section: cleanup_module ### */
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__rnc2rng);
  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__looks_like_prefix_name);
  Py_CLEAR(__pyx_v_4lxml_5etree__open_utf8_file);
  Py_CLEAR(__pyx_v_4lxml_5etree_contextmanager);
  Py_CLEAR(__pyx_v_4lxml_5etree_utf8_writer);
  Py_CLEAR(__pyx_v_4lxml_5etree_getwriter);
  Py_CLEAR(__pyx_v_4lxml_5etree_gzip);
  Py_CLEAR(__pyx_v_4lxml_5etree_io_open);
  Py_CLEAR(__pyx_v_4lxml_5etree_GzipFile);
  Py_CLEAR(__pyx_v_4lxml_5etree_inspect_getargspec);
  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___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__find_invalid_public_id_characters);
  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__Error);
  Py_CLEAR(__pyx_v_4lxml_5etree__check_internal_prefix);
  Py_CLEAR(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES_ITEMS);
  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_MutableMapping);
  Py_CLEAR(__pyx_v_4lxml_5etree_ITER_EMPTY);
  Py_CLEAR(__pyx_v_4lxml_5etree_islice);
  Py_CLEAR(__pyx_v_4lxml_5etree_partial);
  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_OrderedDict);
  Py_CLEAR(__pyx_v_4lxml_5etree_StringIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_BytesIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_CleanupGlobals();
  /*--- Type import cleanup code ---*/
  Py_CLEAR(__pyx_ptype_7cpython_4type_type);
  /*--- Builtin cleanup code ---*/
  Py_CLEAR(__pyx_builtin_SyntaxError);
  Py_CLEAR(__pyx_builtin_print);
  Py_CLEAR(__pyx_builtin_object);
  Py_CLEAR(__pyx_builtin_property);
  Py_CLEAR(__pyx_builtin_AssertionError);
  Py_CLEAR(__pyx_builtin_ImportError);
  Py_CLEAR(__pyx_builtin_staticmethod);
  Py_CLEAR(__pyx_builtin_KeyError);
  Py_CLEAR(__pyx_builtin_ValueError);
  Py_CLEAR(__pyx_builtin_super);
  Py_CLEAR(__pyx_builtin_BaseException);
  Py_CLEAR(__pyx_builtin_MemoryError);
  Py_CLEAR(__pyx_builtin_id);
  Py_CLEAR(__pyx_builtin_TypeError);
  Py_CLEAR(__pyx_builtin_range);
  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_DeprecationWarning);
  Py_CLEAR(__pyx_builtin_StopIteration);
  Py_CLEAR(__pyx_builtin_ReferenceError);
  Py_CLEAR(__pyx_builtin_AttributeError);
  Py_CLEAR(__pyx_builtin_IOError);
  Py_CLEAR(__pyx_builtin_LookupError);
  Py_CLEAR(__pyx_builtin_reversed);
  Py_CLEAR(__pyx_builtin_open);
  Py_CLEAR(__pyx_builtin_sorted);
  Py_CLEAR(__pyx_builtin_NotImplementedError);
  /*--- Intern cleanup code ---*/
  Py_CLEAR(__pyx_empty_tuple);
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__LogEntry > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__LogEntry[--__pyx_freecount_4lxml_5etree__LogEntry];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__Document > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__Document[--__pyx_freecount_4lxml_5etree__Document];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__Attrib > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__Attrib[--__pyx_freecount_4lxml_5etree__Attrib];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__FileWriterElement > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__FileWriterElement[--__pyx_freecount_4lxml_5etree__FileWriterElement];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__MethodChanger > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__MethodChanger[--__pyx_freecount_4lxml_5etree__MethodChanger];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[--__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementContentDecl[--__pyx_freecount_4lxml_5etree__DTDElementContentDecl];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDAttributeDecl[--__pyx_freecount_4lxml_5etree__DTDAttributeDecl];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementDecl[--__pyx_freecount_4lxml_5etree__DTDElementDecl];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDEntityDecl[--__pyx_freecount_4lxml_5etree__DTDEntityDecl];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct___open_utf8_file[--__pyx_freecount_4lxml_5etree___pyx_scope_struct___open_utf8_file];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_1__iter_namespaces[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_1__iter_namespaces];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_2___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_2___aenter__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_3___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_3___aexit__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_4_flush[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_4_flush];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_5_write_declaration[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_5_write_declaration];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_6_write_doctype[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_6_write_doctype];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_7_write[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_7_write];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_8__close[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_8__close];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_9___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_9___aenter__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_10___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_10___aexit__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_11___aenter__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_11___aenter__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__ > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_12___aexit__[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_12___aexit__];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_13_itervalues[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_13_itervalues];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_14_iterattributes[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_14_iterattributes];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_15_iterelements[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_15_iterelements];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  #if CYTHON_USE_FREELISTS
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_16_iterentities[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_16_iterentities];
    #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
    (*Py_TYPE(o)->tp_free)(o);
    #else
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
    #endif
  }
  #endif
  Py_CLEAR(__pyx_cython_runtime);
  Py_CLEAR(__pyx_b);
  Py_CLEAR(__pyx_d);
}
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* PyObjectGetAttrStrNoError */
#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        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;
}

/* TupleAndListFromArray */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *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_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        Py_INCREF(__pyx_empty_tuple);
        return __pyx_empty_tuple;
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    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;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            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
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        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
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
    for (i = 0; i < n; i++)
    {
        if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
    PyObject *dict;
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

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

/* RaiseDoubleKeywords */
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
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject *const *kwvalues,
    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;
    int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
    while (1) {
        Py_XDECREF(key); key = NULL;
        Py_XDECREF(value); value = NULL;
        if (kwds_is_tuple) {
            Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS
            size = PyTuple_GET_SIZE(kwds);
#else
            size = PyTuple_Size(kwds);
            if (size < 0) goto bad;
#endif
            if (pos >= size) break;
#if CYTHON_AVOID_BORROWED_REFS
            key = __Pyx_PySequence_ITEM(kwds, pos);
            if (!key) goto bad;
#elif CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kwds, pos);
#else
            key = PyTuple_GetItem(kwds, pos);
            if (!key) goto bad;
#endif
            value = kwvalues[pos];
            pos++;
        }
        else
        {
            if (!PyDict_Next(kwds, &pos, &key, &value)) break;
#if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(key);
#endif
        }
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
#if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(value);
            Py_DECREF(key);
#endif
            key = NULL;
            value = NULL;
            continue;
        }
#if !CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(key);
#endif
        Py_INCREF(value);
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (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;
#if CYTHON_AVOID_BORROWED_REFS
                    value = NULL;
#endif
                    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 = (
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key)
                );
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
#if CYTHON_AVOID_BORROWED_REFS
                    value = NULL;
#endif
                    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
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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;
        }
    }
    Py_XDECREF(key);
    Py_XDECREF(value);
    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:
    #if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_TypeError,
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    Py_XDECREF(key);
    Py_XDECREF(value);
    return -1;
}

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    __Pyx_PyThreadState_declare
    CYTHON_UNUSED_VAR(cause);
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
      #if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
      #elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    #if PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    #endif
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* UnpackUnboundCMethod */
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
     METH_VARARGS | METH_KEYWORDS,
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #else
    if (likely(!__Pyx_CyOrPyCFunction_Check(method)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            target->method = unbound_method;
        }
    }
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_items */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
    else
        return PyDict_Items(d);
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    #if PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
        return NULL;
    }
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
        return NULL;
    }
    #endif
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    #if PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    #endif
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    #if PY_VERSION_HEX < 0x030800B1
    #if CYTHON_FAST_PYCCALL
    if (PyCFunction_Check(func)) {
        if (kwargs) {
            return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
        } else {
            return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
        }
    }
    #if PY_VERSION_HEX >= 0x030700A1
    if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
        return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
    }
    #endif
    #endif
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
    }
    #endif
    #endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
        #if PY_VERSION_HEX < 0x03090000
        vectorcallfunc f = _PyVectorcall_Function(func);
        #else
        vectorcallfunc f = PyVectorcall_Function(func);
        #endif
        if (f) {
            return f(func, args, (size_t)nargs, NULL);
        }
        #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
        if (__Pyx_CyFunction_CheckExact(func)) {
            __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
            if (f) return f(func, args, (size_t)nargs, NULL);
        }
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectCallNoArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallOneArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#elif PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetName(tp);
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
#else
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
                 type_name, PyString_AS_STRING(name));
#endif
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
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");
}

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

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

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

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#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);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    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);
    *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;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
#include <string.h>
#endif
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 (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#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, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED 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;
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* decode_c_bytes */
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;
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* SliceObject */
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) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    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))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#else
    CYTHON_UNUSED_VAR(wraparound);
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#else
    CYTHON_UNUSED_VAR(wraparound);
#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_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return NULL;
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C00A6
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
  #else
    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;
  #endif
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
    if (unlikely(tstate->current_exception))
#elif CYTHON_FAST_THREAD_STATE
    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_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    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;
    #endif
    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;
}

/* ModInt[int] */
static CYTHON_INLINE int __Pyx_mod_int(int a, int b) {
    int r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

/* DivInt[int] */
static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
    int q = a / b;
    int r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kw,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
        Py_ssize_t kwsize;
#if CYTHON_ASSUME_SAFE_MACROS
        kwsize = PyTuple_GET_SIZE(kw);
#else
        kwsize = PyTuple_Size(kw);
        if (kwsize < 0) return 0;
#endif
        if (unlikely(kwsize == 0))
            return 1;
        if (!kw_allowed) {
#if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, 0);
#else
            key = PyTuple_GetItem(kw, pos);
            if (!key) return 0;
#endif
            goto invalid_keyword;
        }
#if PY_VERSION_HEX < 0x03090000
        for (pos = 0; pos < kwsize; pos++) {
#if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
#else
            key = PyTuple_GetItem(kw, pos);
            if (!key) return 0;
#endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
        }
#endif
        return 1;
    }
    while (PyDict_Next(kw, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (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:
    #if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_TypeError,
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* SliceObject */
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) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    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))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#else
    CYTHON_UNUSED_VAR(wraparound);
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#else
    CYTHON_UNUSED_VAR(wraparound);
#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_USE_TYPE_SLOTS
        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;
    }
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s",
        obj_type_name, value ? "assignment" : "deletion");
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return -1;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    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;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
#endif
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __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);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
        
            x = (long)((unsigned long)a + (unsigned long)b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        if (unlikely(__Pyx_PyLong_IsZero(op1))) {
            return __Pyx_NewRef(op2);
        }
        if (likely(__Pyx_PyLong_IsCompact(op1))) {
            a = __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
            double result;
            
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        return (a == b);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* CIntToDigits */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
#if CYTHON_PEP393_ENABLED
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
#else
    Py_UNICODE *udata;
    uval = PyUnicode_FromUnicode(NULL, ulength);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_AS_UNICODE(uval);
#endif
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp;
                    PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign);
                    if (unlikely(!repeat)) goto done_or_error;
                    tmp = PyNumber_Multiply(padding, repeat);
                    Py_DECREF(repeat);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyNumber_Add(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyNumber_Add(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_xmlElementType(xmlElementType value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(xmlElementType)*3+2];
    char *dpos, *end = digits + sizeof(xmlElementType)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    xmlElementType remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlElementType neg_one = (xmlElementType) -1, const_zero = (xmlElementType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (xmlElementType) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (xmlElementType) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (xmlElementType) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* decode_c_string */
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))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(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(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_subscript) {
            PyObject *r, *key = PyInt_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#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);
}

/* HasAttr */
#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (!r) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!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,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(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 {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyInt_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o))
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* DivInt[Py_ssize_t] */
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;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    CYTHON_MAYBE_UNUSED_VAR(max_char);
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    CYTHON_UNUSED_VAR(value_count);
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyString_CheckExact(s))) {
        PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
        Py_DECREF(s);
        return result;
    }
    #endif
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(long)*3+2];
    char *dpos, *end = digits + sizeof(long)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    long remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (long) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (long) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (long) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#elif CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    type_name = __Pyx_PyType_GetName(type);
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* pop */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
    if (__Pyx_IS_TYPE(L, &PySet_Type)) {
        return PySet_Pop(L);
    }
    return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
    if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
    return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
}
#endif

/* SliceTupleAndList */
#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 PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (length <= 0) {
        return PyList_New(0);
    }
    return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
}
#endif

/* DivInt[long] */
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;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *empty_list = 0;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (unlikely(!py_import))
        goto bad;
    if (!from_list) {
        empty_list = PyList_New(0);
        if (unlikely(!empty_list))
            goto bad;
        from_list = empty_list;
    }
    #endif
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
                module = PyImport_ImportModuleLevelObject(
                    name, __pyx_d, empty_dict, from_list, 1);
                if (unlikely(!module)) {
                    if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (unlikely(!py_level))
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, __pyx_d, empty_dict, from_list, level);
            #endif
        }
    }
bad:
    Py_XDECREF(empty_dict);
    Py_XDECREF(empty_list);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    return module;
}

/* ImportDottedModule */
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
    PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
    if (unlikely(PyErr_Occurred())) {
        PyErr_Clear();
    }
    if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
        partial_name = name;
    } else {
        slice = PySequence_GetSlice(parts_tuple, 0, count);
        if (unlikely(!slice))
            goto bad;
        sep = PyUnicode_FromStringAndSize(".", 1);
        if (unlikely(!sep))
            goto bad;
        partial_name = PyUnicode_Join(sep, slice);
    }
    PyErr_Format(
#if PY_MAJOR_VERSION < 3
        PyExc_ImportError,
        "No module named '%s'", PyString_AS_STRING(partial_name));
#else
#if PY_VERSION_HEX >= 0x030600B1
        PyExc_ModuleNotFoundError,
#else
        PyExc_ImportError,
#endif
        "No module named '%U'", partial_name);
#endif
bad:
    Py_XDECREF(sep);
    Py_XDECREF(slice);
    Py_XDECREF(partial_name);
    return NULL;
}
#endif
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
    PyObject *imported_module;
#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400)
    PyObject *modules = PyImport_GetModuleDict();
    if (unlikely(!modules))
        return NULL;
    imported_module = __Pyx_PyDict_GetItemStr(modules, name);
    Py_XINCREF(imported_module);
#else
    imported_module = PyImport_GetModule(name);
#endif
    return imported_module;
}
#endif
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
    Py_ssize_t i, nparts;
    nparts = PyTuple_GET_SIZE(parts_tuple);
    for (i=1; i < nparts && module; i++) {
        PyObject *part, *submodule;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        part = PyTuple_GET_ITEM(parts_tuple, i);
#else
        part = PySequence_ITEM(parts_tuple, i);
#endif
        submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF(part);
#endif
        Py_DECREF(module);
        module = submodule;
    }
    if (unlikely(!module)) {
        return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
    }
    return module;
}
#endif
static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if PY_MAJOR_VERSION < 3
    PyObject *module, *from_list, *star = __pyx_n_s__22;
    CYTHON_UNUSED_VAR(parts_tuple);
    from_list = PyList_New(1);
    if (unlikely(!from_list))
        return NULL;
    Py_INCREF(star);
    PyList_SET_ITEM(from_list, 0, star);
    module = __Pyx_Import(name, from_list, 0);
    Py_DECREF(from_list);
    return module;
#else
    PyObject *imported_module;
    PyObject *module = __Pyx_Import(name, NULL, 0);
    if (!parts_tuple || unlikely(!module))
        return module;
    imported_module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(imported_module)) {
        Py_DECREF(module);
        return imported_module;
    }
    PyErr_Clear();
    return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
#endif
}
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
    PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(module)) {
        PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
        if (likely(spec)) {
            PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
            if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
                Py_DECREF(spec);
                spec = NULL;
            }
            Py_XDECREF(unsafe);
        }
        if (likely(!spec)) {
            PyErr_Clear();
            return module;
        }
        Py_DECREF(spec);
        Py_DECREF(module);
    } else if (PyErr_Occurred()) {
        PyErr_Clear();
    }
#endif
    return __Pyx__ImportDottedModule(name, parts_tuple);
}

/* RaiseUnboundLocalError */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
        _PyUnicodeWriter_Init(&writer, 0);
#else
        _PyUnicodeWriter_Init(&writer);
#endif
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
        _PyUnicodeWriter_Init(&writer, 0);
#else
        _PyUnicodeWriter_Init(&writer);
#endif
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__4);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400)
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        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;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(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 if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
static int
__Pyx_unicode_modifiable(PyObject *unicode)
{
    if (Py_REFCNT(unicode) != 1)
        return 0;
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* IterNext */
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetName(Py_TYPE(iterator));
    PyErr_Format(PyExc_TypeError,
        __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
    __Pyx_DECREF_TypeName(iterator_type_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
    if (likely(iternext)) {
#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
        next = iternext(iterator);
        if (likely(next))
            return next;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
#endif
#else
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
#endif
    } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    }
#if !CYTHON_USE_TYPE_SLOTS
    else {
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
    }
#endif
    return __Pyx_PyIter_Next2Default(defval);
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            #else
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            #endif
        } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
        
            x = (long)((unsigned long)a - (unsigned long)b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        if (unlikely(__Pyx_PyLong_IsZero(op1))) {
            return PyLong_FromLong(-intval);
        }
        if (likely(__Pyx_PyLong_IsCompact(op1))) {
            a = __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    #ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
                    #endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
            double result;
            
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyUnicode_Substring */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length;
    if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL;
    length = __Pyx_PyUnicode_GET_LENGTH(text);
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    if (stop <= start)
        return __Pyx_NewRef(__pyx_empty_unicode);
    if (start == 0 && stop == length)
        return __Pyx_NewRef(text);
#if CYTHON_PEP393_ENABLED
    return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
        PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
#else
    return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(text)+start, stop-start);
#endif
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc;
    __Pyx_PyThreadState_declare
    #ifdef __Pyx_StopAsyncIteration_USED
    int is_async_stopiteration = 0;
    #endif
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    cur_exc = PyErr_Occurred();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        #ifdef __Pyx_StopAsyncIteration_USED
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else
        #endif
            return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(val);
    Py_XDECREF(tb);
    PyErr_SetString(PyExc_RuntimeError,
        #ifdef __Pyx_StopAsyncIteration_USED
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        #endif
        "generator raised StopIteration");
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* FixUpExtensionType */
#if CYTHON_USE_TYPE_SPECS
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
#else
    const PyType_Slot *slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
        int changed = 0;
#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
        const
#endif
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
#if PY_VERSION_HEX < 0x030900b1
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
#if PY_VERSION_HEX >= 0x030800b4
                    type->tp_vectorcall_offset = memb->offset;
#else
                    type->tp_print = (printfunc) memb->offset;
#endif
                    changed = 1;
                }
#endif
#else
                if ((0));
#endif
#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
                        Py_DECREF(descr);
                        return -1;
                    }
                    Py_DECREF(descr);
                    changed = 1;
                }
#endif
            }
            memb++;
        }
        if (changed)
            PyType_Modified(type);
    }
#endif
    return 0;
}
#endif

/* FetchSharedCythonModule */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
}

/* FetchCommonType */
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t basicsize,
                               Py_ssize_t expected_basicsize) {
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
#if !CYTHON_USE_TYPE_SPECS
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* abi_module;
    const char* object_name;
    PyTypeObject *cached_type = NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) return NULL;
    object_name = strrchr(type->tp_name, '.');
    object_name = object_name ? object_name+1 : type->tp_name;
    cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
    if (cached_type) {
        if (__Pyx_VerifyCachedType(
              (PyObject *)cached_type,
              object_name,
              cached_type->tp_basicsize,
              type->tp_basicsize) < 0) {
            goto bad;
        }
        goto done;
    }
    if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
    PyErr_Clear();
    if (PyType_Ready(type) < 0) goto bad;
    if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
        goto bad;
    Py_INCREF(type);
    cached_type = type;
done:
    Py_DECREF(abi_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}
#else
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module, *cached_type = NULL;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) return NULL;
    cached_type = PyObject_GetAttrString(abi_module, object_name);
    if (cached_type) {
        Py_ssize_t basicsize;
#if CYTHON_COMPILING_IN_LIMITED_API
        PyObject *py_basicsize;
        py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
        if (unlikely(!py_basicsize)) goto bad;
        basicsize = PyLong_AsSsize_t(py_basicsize);
        Py_DECREF(py_basicsize);
        py_basicsize = 0;
        if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
#else
        basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
#endif
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              basicsize,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    }
    if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
    PyErr_Clear();
    CYTHON_UNUSED_VAR(module);
    cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
done:
    Py_DECREF(abi_module);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}
#endif

/* PyObjectCall2Args */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallMethod1 */
#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_GetMethod;
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* CoroutineBase */
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)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 = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(PyObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body(self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval))
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    gen->is_running = 0;
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) 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 && CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        Py_TYPE(gen)->tp_del(self);
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (likely(--self->ob_refcnt == 0)) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
#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;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
#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;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context)
{
    PyObject *frame = self->gi_frame;
    CYTHON_UNUSED_VAR(context);
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, attr_name);
#else
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
                 type_name, PyString_AS_STRING(attr_name));
#endif
    __Pyx_DECREF_TypeName(type_name);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (unlikely(!module)) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if CYTHON_USE_TYPE_SPECS
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    __pyx_GeneratorType_slots
};
#else
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
static int __pyx_Generator_init(PyObject *module) {
#if CYTHON_USE_TYPE_SPECS
    __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL);
#else
    CYTHON_UNUSED_VAR(module);
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
#endif
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* GeneratorYieldFrom */
#if CYTHON_USE_TYPE_SLOTS
static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetName(Py_TYPE(source));
    PyErr_Format(PyExc_TypeError,
        "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    Py_DECREF(source);
}
#endif
static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) {
    PyObject *source_gen, *retval;
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(source)) {
        Py_INCREF(source);
        source_gen = source;
        retval = __Pyx_Generator_Next(source);
    } else
#endif
    {
#if CYTHON_USE_TYPE_SLOTS
        if (likely(Py_TYPE(source)->tp_iter)) {
            source_gen = Py_TYPE(source)->tp_iter(source);
            if (unlikely(!source_gen))
                return NULL;
            if (unlikely(!PyIter_Check(source_gen))) {
                __Pyx_PyIter_CheckErrorAndDecref(source_gen);
                return NULL;
            }
        } else
#endif
        {
            source_gen = PyObject_GetIter(source);
            if (unlikely(!source_gen))
                return NULL;
        }
        retval = __Pyx_PyObject_GetIterNextFunc(source_gen)(source_gen);
    }
    if (likely(retval)) {
        gen->yieldfrom = source_gen;
        return retval;
    }
    Py_DECREF(source_gen);
    return NULL;
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PySet_Update */
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
    PyObject *retval;
    #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    if (PyAnySet_Check(it)) {
        if (PySet_GET_SIZE(it) == 0)
            return 0;
        retval = PySet_Type.tp_as_number->nb_inplace_or(set, it);
        if (likely(retval == set)) {
            Py_DECREF(retval);
            return 0;
        }
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    #endif
    retval = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_update, set, it);
    if (unlikely(!retval)) return -1;
    Py_DECREF(retval);
    return 0;
}

/* PyVectorcallFastCallDict */
#if CYTHON_METH_FASTCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i, pos;
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (PyDict_Next(kw, &pos, &key, &value)) {
        keys_are_strings &= Py_TYPE(key)->tp_flags;
        Py_INCREF(key);
        Py_INCREF(value);
        PyTuple_SET_ITEM(kwnames, i, key);
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
        return vc(func, args, nargs, NULL);
    }
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
{
    CYTHON_UNUSED_VAR(closure);
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#elif PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->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, void *context)
{
    CYTHON_UNUSED_VAR(context);
#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;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
#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;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    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, void *context)
{
    CYTHON_UNUSED_VAR(context);
    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;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_dict, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->defaults_tuple;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__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, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->defaults_kwdict;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__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, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->func_annotations;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    int is_coroutine;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
#if PY_VERSION_HEX >= 0x03050000
    if (is_coroutine) {
        PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(op->func_is_coroutine)) {
            return __Pyx_NewRef(op->func_is_coroutine);
        }
ignore:
        PyErr_Clear();
    }
#endif
    op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
    return __Pyx_NewRef(op->func_is_coroutine);
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
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 *) "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},
    {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if CYTHON_USE_TYPE_SPECS
    {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#if CYTHON_METH_FASTCALL
#if CYTHON_BACKPORT_VECTORCALL
    {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
#if !CYTHON_COMPILING_IN_LIMITED_API
    {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#endif
#endif
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    CYTHON_UNUSED_VAR(args);
#if PY_MAJOR_VERSION >= 3
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#else
    return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
    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);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
    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);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    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_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
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyObject *py_name = NULL;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_MACROS
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
#if CYTHON_COMPILING_IN_LIMITED_API
            py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
            if (!py_name) return NULL;
            PyErr_Format(PyExc_TypeError,
                "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                py_name, size);
            Py_DECREF(py_name);
#else
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
#endif
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_MACROS
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
#if CYTHON_COMPILING_IN_LIMITED_API
            py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
            if (!py_name) return NULL;
            PyErr_Format(PyExc_TypeError,
                "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                py_name, size);
            Py_DECREF(py_name);
#else
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
#endif
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
    if (!py_name) return NULL;
    PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
                 py_name);
    Py_DECREF(py_name);
#else
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
#endif
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_MACROS
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(!argc) < 0) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
#if PY_MAJOR_VERSION > 2
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
#else
            PyErr_SetString(PyExc_TypeError,
                            "unbound method needs an argument");
#endif
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
                         ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
        PyErr_Format(PyExc_TypeError,
                     "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
            def->ml_name, nargs);
        return NULL;
    }
    return def->ml_meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
            def->ml_name, nargs);
        return NULL;
    }
    return def->ml_meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
}
#endif
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
#else
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
#if !CYTHON_METH_FASTCALL
    0,
#elif CYTHON_BACKPORT_VECTORCALL
    (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
#else
    offsetof(PyCFunctionObject, vectorcall),
#endif
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_PyMethod_New,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
static int __pyx_CyFunction_init(PyObject *module) {
#if CYTHON_USE_TYPE_SPECS
    __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
#else
    CYTHON_UNUSED_VAR(module);
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
#endif
    if (unlikely(__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 = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    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);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* unicode_iter */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
#if CYTHON_COMPILING_IN_LIMITED_API
    *kind   = 0;
    *length = PyUnicode_GetLength(ustring);
    *data   = (void*)ustring;
#elif CYTHON_PEP393_ENABLED
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
    *kind   = PyUnicode_KIND(ustring);
    *length = PyUnicode_GET_LENGTH(ustring);
    *data   = PyUnicode_DATA(ustring);
#else
    *kind   = 0;
    *length = PyUnicode_GET_SIZE(ustring);
    *data   = (void*)PyUnicode_AS_UNICODE(ustring);
#endif
    return 0;
}

/* ReturnWithStopIteration */
static void __Pyx__ReturnWithStopIteration(PyObject* value) {
    PyObject *exc, *args;
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
    if (PY_VERSION_HEX >= 0x030C00A6
            || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        args = PyTuple_New(1);
        if (unlikely(!args)) return;
        Py_INCREF(value);
        PyTuple_SET_ITEM(args, 0, value);
        exc = PyType_Type.tp_call(PyExc_StopIteration, args, NULL);
        Py_DECREF(args);
        if (!exc) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(PyExc_StopIteration);
        __Pyx_ErrRestore(PyExc_StopIteration, exc, NULL);
        return;
    }
    #endif
#else
    args = PyTuple_Pack(1, value);
    if (unlikely(!args)) return;
    exc = PyObject_Call(PyExc_StopIteration, args, NULL);
    Py_DECREF(args);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(PyExc_StopIteration, exc);
    Py_DECREF(exc);
}

/* Coroutine */
static void __Pyx_CoroutineAwait_dealloc(PyObject *self) {
    PyObject_GC_UnTrack(self);
    Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine);
    __Pyx_PyHeapTypeObject_GC_Del(self);
}
static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) {
    Py_VISIT(self->coroutine);
    return 0;
}
static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) {
    Py_CLEAR(self->coroutine);
    return 0;
}
static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) {
    return __Pyx_Generator_Next(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) {
    return __Pyx_Coroutine_Send(self->coroutine, value);
}
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) {
    return __Pyx_Coroutine_Throw(self->coroutine, args);
}
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    return __Pyx_Coroutine_Close(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) {
    Py_INCREF(self);
    return self;
}
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_CoroutineAwait_no_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) {
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(args);
    CYTHON_UNUSED_VAR(kwargs);
    PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead");
    return NULL;
}
#endif
static PyObject *__Pyx_CoroutineAwait_reduce_ex(__pyx_CoroutineAwaitObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    PyErr_Format(PyExc_TypeError, "cannot pickle '%.200s' object",
                         Py_TYPE(self)->tp_name);
    return NULL;
}
static PyMethodDef __pyx_CoroutineAwait_methods[] = {
    {"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_CoroutineAwait_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_CoroutineAwaitType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CoroutineAwait_dealloc},
    {Py_tp_traverse, (void *)__Pyx_CoroutineAwait_traverse},
    {Py_tp_clear, (void *)__Pyx_CoroutineAwait_clear},
#if !CYTHON_COMPILING_IN_PYPY
    {Py_tp_new, (void *)__Pyx_CoroutineAwait_no_new},
#endif
    {Py_tp_methods, (void *)__pyx_CoroutineAwait_methods},
    {Py_tp_iter, (void *)__Pyx_CoroutineAwait_self},
    {Py_tp_iternext, (void *)__Pyx_CoroutineAwait_Next},
    {0, 0},
};
static PyType_Spec __pyx_CoroutineAwaitType_spec = {
    __PYX_TYPE_MODULE_PREFIX "coroutine_wrapper",
    sizeof(__pyx_CoroutineAwaitObject),
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    __pyx_CoroutineAwaitType_slots
};
#else
static PyTypeObject __pyx_CoroutineAwaitType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "coroutine_wrapper",
    sizeof(__pyx_CoroutineAwaitObject),
    0,
    (destructor) __Pyx_CoroutineAwait_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    PyDoc_STR("A wrapper object implementing __await__ for coroutines."),
    (traverseproc) __Pyx_CoroutineAwait_traverse,
    (inquiry) __Pyx_CoroutineAwait_clear,
    0,
    0,
    __Pyx_CoroutineAwait_self,
    (iternextfunc) __Pyx_CoroutineAwait_Next,
    __pyx_CoroutineAwait_methods,
    0                         ,
    0                      ,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if !CYTHON_COMPILING_IN_PYPY
    __Pyx_CoroutineAwait_no_new,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
#if PY_VERSION_HEX < 0x030500B1 || defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS
static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) {
    __pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_CoroutineAwaitType);
    if (unlikely(!await)) return NULL;
    Py_INCREF(coroutine);
    await->coroutine = coroutine;
    PyObject_GC_Track(await);
    return (PyObject*)await;
}
#endif
#if PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_await_method(PyObject *coroutine, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    return __Pyx__Coroutine_await(coroutine);
}
#endif
#if defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
    if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) {
        PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine");
        return NULL;
    }
    return __Pyx__Coroutine_await(coroutine);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) {
    PyObject* result;
    switch (op) {
        case Py_EQ: result = (other == obj) ? Py_True : Py_False; break;
        case Py_NE: result = (other != obj) ? Py_True : Py_False; break;
        default:
            result = Py_NotImplemented;
    }
    Py_INCREF(result);
    return result;
}
#endif
static PyMethodDef __pyx_Coroutine_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1
    {"__await__", (PyCFunction) __Pyx_Coroutine_await_method, METH_NOARGS,
     (char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")},
#endif
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Coroutine_memberlist[] = {
    {(char *) "cr_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being awaited, or None")},
    {(char*) "cr_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if CYTHON_USE_TYPE_SPECS
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Coroutine_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the coroutine"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the coroutine"), 0},
    {(char *) "cr_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the coroutine"), 0},
    {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_CoroutineType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_am_await, (void *)&__Pyx_Coroutine_await},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_methods, (void *)__pyx_Coroutine_methods},
    {Py_tp_members, (void *)__pyx_Coroutine_memberlist},
    {Py_tp_getset, (void *)__pyx_Coroutine_getsets},
    {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
    {0, 0},
};
static PyType_Spec __pyx_CoroutineType_spec = {
    __PYX_TYPE_MODULE_PREFIX "coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    __pyx_CoroutineType_slots
};
#else
#if CYTHON_USE_ASYNC_SLOTS
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = {
    __Pyx_Coroutine_await,
    0,
    0,
#if PY_VERSION_HEX >= 0x030A00A3
    0,
#endif
};
#endif
static PyTypeObject __pyx_CoroutineType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
#if CYTHON_USE_ASYNC_SLOTS
    &__pyx_Coroutine_as_async,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
    __Pyx_Coroutine_compare,
#else
    0,
#endif
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    0,
    __pyx_Coroutine_methods,
    __pyx_Coroutine_memberlist,
    __pyx_Coroutine_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
static int __pyx_Coroutine_init(PyObject *module) {
    CYTHON_MAYBE_UNUSED_VAR(module);
#if CYTHON_USE_TYPE_SPECS
    __pyx_CoroutineType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineType_spec, NULL);
#else
    __pyx_CoroutineType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_CoroutineType = __Pyx_FetchCommonType(&__pyx_CoroutineType_type);
#endif
    if (unlikely(!__pyx_CoroutineType))
        return -1;
#ifdef __Pyx_IterableCoroutine_USED
    if (unlikely(__pyx_IterableCoroutine_init(module) == -1))
        return -1;
#endif
#if CYTHON_USE_TYPE_SPECS
    __pyx_CoroutineAwaitType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineAwaitType_spec, NULL);
#else
    __pyx_CoroutineAwaitType = __Pyx_FetchCommonType(&__pyx_CoroutineAwaitType_type);
#endif
    if (unlikely(!__pyx_CoroutineAwaitType))
        return -1;
    return 0;
}

/* GetAwaitIter */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(o)) {
        return __Pyx_NewRef(o);
    }
#endif
    return __Pyx__Coroutine_GetAwaitableIter(o);
}
static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) {
#if PY_VERSION_HEX >= 0x030600B3 && PY_VERSION_HEX < 0x030d0000 || defined(_PyErr_FormatFromCause)
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetName(Py_TYPE(source));
    _PyErr_FormatFromCause(PyExc_TypeError,
        "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
#elif PY_MAJOR_VERSION >= 3
    PyObject *exc, *val, *val2, *tb;
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetName(Py_TYPE(source));
    assert(PyErr_Occurred());
    PyErr_Fetch(&exc, &val, &tb);
    PyErr_NormalizeException(&exc, &val, &tb);
    if (tb != NULL) {
        PyException_SetTraceback(val, tb);
        Py_DECREF(tb);
    }
    Py_DECREF(exc);
    assert(!PyErr_Occurred());
    PyErr_Format(PyExc_TypeError,
        "'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    PyErr_Fetch(&exc, &val2, &tb);
    PyErr_NormalizeException(&exc, &val2, &tb);
    Py_INCREF(val);
    PyException_SetCause(val2, val);
    PyException_SetContext(val2, val);
    PyErr_Restore(exc, val2, tb);
#else
    CYTHON_UNUSED_VAR(source);
#endif
}
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
    PyObject *res;
#if CYTHON_USE_ASYNC_SLOTS
    __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
    if (likely(am && am->am_await)) {
        res = (*am->am_await)(obj);
    } else
#endif
#if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
    if (PyCoro_CheckExact(obj)) {
        return __Pyx_NewRef(obj);
    } else
#endif
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
#if PY_VERSION_HEX >= 0x030C00A6
    if (PyGen_CheckExact(obj) && (PyGen_GetCode((PyGenObject*)obj)->co_flags & CO_ITERABLE_COROUTINE)) {
#else
    if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) {
#endif
        return __Pyx_NewRef(obj);
    } else
#endif
    {
        PyObject *method = NULL;
        int is_method = __Pyx_PyObject_GetMethod(obj, __pyx_n_s_await, &method);
        if (likely(is_method)) {
            res = __Pyx_PyObject_CallOneArg(method, obj);
        } else if (likely(method)) {
            res = __Pyx_PyObject_CallNoArg(method);
        } else
            goto slot_error;
        Py_DECREF(method);
    }
    if (unlikely(!res)) {
        __Pyx_Coroutine_AwaitableIterError(obj);
        goto bad;
    }
    if (unlikely(!PyIter_Check(res))) {
        __Pyx_TypeName res_type_name = __Pyx_PyType_GetName(Py_TYPE(res));
        PyErr_Format(PyExc_TypeError,
            "__await__() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", res_type_name);
        __Pyx_DECREF_TypeName(res_type_name);
        Py_CLEAR(res);
    } else {
        int is_coroutine = 0;
        #ifdef __Pyx_Coroutine_USED
        is_coroutine |= __Pyx_Coroutine_Check(res);
        #endif
        #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
        is_coroutine |= PyCoro_CheckExact(res);
        #endif
        if (unlikely(is_coroutine)) {
            /* __await__ must return an *iterator*, not
               a coroutine or another awaitable (see PEP 492) */
            PyErr_SetString(PyExc_TypeError,
                            "__await__() returned a coroutine");
            Py_CLEAR(res);
        }
    }
    return res;
slot_error:
    {
        __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
        PyErr_Format(PyExc_TypeError,
            "object " __Pyx_FMT_TYPENAME " can't be used in 'await' expression", obj_type_name);
        __Pyx_DECREF_TypeName(obj_type_name);
    }
bad:
    return NULL;
}

/* CoroutineYieldFrom */
  static PyObject* __Pyx__Coroutine_Yield_From_Generic(__pyx_CoroutineObject *gen, PyObject *source) {
    PyObject *retval;
    PyObject *source_gen = __Pyx__Coroutine_GetAwaitableIter(source);
    if (unlikely(!source_gen)) {
        return NULL;
    }
    if (__Pyx_Coroutine_Check(source_gen)) {
        retval = __Pyx_Generator_Next(source_gen);
    } else {
        retval = __Pyx_PyObject_GetIterNextFunc(source_gen)(source_gen);
    }
    if (retval) {
        gen->yieldfrom = source_gen;
        return retval;
    }
    Py_DECREF(source_gen);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) {
    PyObject *retval;
    if (__Pyx_Coroutine_Check(source)) {
        if (unlikely(((__pyx_CoroutineObject*)source)->yieldfrom)) {
            PyErr_SetString(
                PyExc_RuntimeError,
                "coroutine is being awaited already");
            return NULL;
        }
        retval = __Pyx_Generator_Next(source);
#ifdef __Pyx_AsyncGen_USED
    } else if (__pyx_PyAsyncGenASend_CheckExact(source)) {
        retval = __Pyx_async_gen_asend_iternext(source);
#endif
    } else {
        return __Pyx__Coroutine_Yield_From_Generic(gen, source);
    }
    if (retval) {
        Py_INCREF(source);
        gen->yieldfrom = source;
    }
    return retval;
}

/* py_dict_values */
  static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_values, d);
    else
        return PyDict_Values(d);
}

/* dict_getitem_default */
  static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#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);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* StringJoin */
  static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    (void) __Pyx_PyObject_CallMethod1;
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION < 3
    return _PyString_Join(sep, values);
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    return _PyBytes_Join(sep, values);
#else
    return __Pyx_PyObject_CallMethod1(sep, __pyx_n_s_join, values);
#endif
}

/* MergeKeywords */
  static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

/* set_iter */
  static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
    *p_source_is_set = is_set;
    if (likely(is_set)) {
        *p_orig_length = PySet_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#else
    CYTHON_UNUSED_VAR(is_set);
    *p_source_is_set = 0;
#endif
    *p_orig_length = 0;
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set) {
    if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
        *value = PyIter_Next(iter_obj);
        if (unlikely(!*value)) {
            return __Pyx_IterFinish();
        }
        CYTHON_UNUSED_VAR(orig_length);
        CYTHON_UNUSED_VAR(ppos);
        return 1;
    }
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
        PyErr_SetString(
            PyExc_RuntimeError,
            "set changed size during iteration");
        return -1;
    }
    {
        Py_hash_t hash;
        int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
        assert (ret != -1);
        if (likely(ret)) {
            Py_INCREF(*value);
            return 1;
        }
    }
#endif
    return 0;
}

/* CIntToPyUnicode */
  static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_xmlXPathObjectType(xmlXPathObjectType value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(xmlXPathObjectType)*3+2];
    char *dpos, *end = digits + sizeof(xmlXPathObjectType)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    xmlXPathObjectType remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlXPathObjectType neg_one = (xmlXPathObjectType) -1, const_zero = (xmlXPathObjectType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (xmlXPathObjectType) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (xmlXPathObjectType) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (xmlXPathObjectType) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* ErrOccurredWithGIL */
  static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) {
  int err;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  err = !!PyErr_Occurred();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
  return err;
}

/* CallNextTpTraverse */
  static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    traverseproc tp_traverse = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_traverse)
        return tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
  static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    inquiry tp_clear = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_clear)
        tp_clear(obj);
}

/* FormatTypeName */
  #if CYTHON_COMPILING_IN_LIMITED_API
static __Pyx_TypeName
__Pyx_PyType_GetName(PyTypeObject* tp)
{
    PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_n_s_name);
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
        PyErr_Clear();
        Py_XDECREF(name);
        name = __Pyx_NewRef(__pyx_n_s__106);
    }
    return name;
}
#endif

/* ValidateExternBase */
  static int __Pyx_validate_extern_base(PyTypeObject *base) {
    Py_ssize_t itemsize;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_itemsize;
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
    itemsize = ((PyTypeObject *)base)->tp_itemsize;
#else
    py_itemsize = PyObject_GetAttrString((PyObject*)base, "__itemsize__");
    if (!py_itemsize)
        return -1;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        return -1;
#endif
    if (itemsize) {
        __Pyx_TypeName b_name = __Pyx_PyType_GetName(base);
        PyErr_Format(PyExc_TypeError,
                "inheritance from PyVarObject types like '" __Pyx_FMT_TYPENAME "' not currently supported", b_name);
        __Pyx_DECREF_TypeName(b_name);
        return -1;
    }
    return 0;
}

/* ValidateBasesTuple */
  #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_MACROS
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (n < 0) return -1;
#endif
    for (i = 1; i < n; i++)
    {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        PyTypeObject *b;
#if PY_MAJOR_VERSION < 3
        if (PyClass_Check(b0))
        {
            PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
                         PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY)
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
  static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
        gc = PyImport_GetModule(__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* PyObject_GenericGetAttr */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
  static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable */
  static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
  #if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i;
    void** base_vtables;
    __Pyx_TypeName tp_base_name;
    __Pyx_TypeName base_name;
    void* unknown = (void*)-1;
    PyObject* bases = type->tp_bases;
    int base_depth = 0;
    {
        PyTypeObject* base = type->tp_base;
        while (base) {
            base_depth += 1;
            base = base->tp_base;
        }
    }
    base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
    for (i = 1; i < PyTuple_GET_SIZE(bases); i++) {
        void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i)));
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = type->tp_base;
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = base->tp_base;
            }
        }
    }
    PyErr_Clear();
    free(base_vtables);
    return 0;
bad:
    tp_base_name = __Pyx_PyType_GetName(type->tp_base);
    base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i));
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
    free(base_vtables);
    return -1;
}
#endif

/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType_3_0_10
#define __PYX_HAVE_RT_ImportType_3_0_10
static PyTypeObject *__Pyx_ImportType_3_0_10(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_10 check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !CYTHON_COMPILING_IN_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_10 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_10 && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* Py3UpdateBases */
  static PyObject*
__Pyx_PEP560_update_bases(PyObject *bases)
{
    Py_ssize_t i, j, size_bases;
    PyObject *base, *meth, *new_base, *result, *new_bases = NULL;
    size_bases = PyTuple_GET_SIZE(bases);
    for (i = 0; i < size_bases; i++) {
        base  = PyTuple_GET_ITEM(bases, i);
        if (PyType_Check(base)) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_n_s_mro_entries);
        if (!meth && PyErr_Occurred()) {
            goto error;
        }
        if (!meth) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        new_base = __Pyx_PyObject_CallOneArg(meth, bases);
        Py_DECREF(meth);
        if (!new_base) {
            goto error;
        }
        if (!PyTuple_Check(new_base)) {
            PyErr_SetString(PyExc_TypeError,
                            "__mro_entries__ must return a tuple");
            Py_DECREF(new_base);
            goto error;
        }
        if (!new_bases) {
            if (!(new_bases = PyList_New(i))) {
                goto error;
            }
            for (j = 0; j < i; j++) {
                base = PyTuple_GET_ITEM(bases, j);
                PyList_SET_ITEM(new_bases, j, base);
                Py_INCREF(base);
            }
        }
        j = PyList_GET_SIZE(new_bases);
        if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
            goto error;
        }
        Py_DECREF(new_base);
    }
    if (!new_bases) {
        Py_INCREF(bases);
        return bases;
    }
    result = PyList_AsTuple(new_bases);
    Py_DECREF(new_bases);
    return result;
error:
    Py_XDECREF(new_bases);
    return NULL;
}

/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases;
#if CYTHON_ASSUME_SAFE_MACROS
    nbases = PyTuple_GET_SIZE(bases);
#else
    nbases = PyTuple_Size(bases);
    if (nbases < 0) return NULL;
#endif
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
#if CYTHON_ASSUME_SAFE_MACROS
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *tmp = PyTuple_GetItem(bases, i);
        if (!tmp) return NULL;
#endif
        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;
}

/* Py3ClassCreate */
  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_GetAttrStrNoError(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs[3] = {NULL, name, bases};
            ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
            Py_DECREF(prep);
        } else {
            if (unlikely(PyErr_Occurred()))
                return NULL;
            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 PY_VERSION_HEX >= 0x03030000
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
#else
    CYTHON_MAYBE_UNUSED_VAR(qualname);
#endif
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc_3, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
static int __Pyx_SetNamesPEP487(PyObject *type_obj) {
    PyTypeObject *type = (PyTypeObject*) type_obj;
    PyObject *names_to_set, *key, *value, *set_name, *tmp;
    Py_ssize_t i = 0;
#if CYTHON_USE_TYPE_SLOTS
    names_to_set = PyDict_Copy(type->tp_dict);
#else
    {
        PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict);
        names_to_set = NULL;
        if (likely(d)) {
            PyObject *names_to_set = PyDict_New();
            int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1;
            Py_DECREF(d);
            if (unlikely(ret < 0))
                Py_CLEAR(names_to_set);
        }
    }
#endif
    if (unlikely(names_to_set == NULL))
        goto bad;
    while (PyDict_Next(names_to_set, &i, &key, &value)) {
        set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name);
        if (unlikely(set_name != NULL)) {
            tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key);
            Py_DECREF(set_name);
            if (unlikely(tmp == NULL)) {
                __Pyx_TypeName value_type_name =
                    __Pyx_PyType_GetName(Py_TYPE(value));
                __Pyx_TypeName type_name = __Pyx_PyType_GetName(type);
                PyErr_Format(PyExc_RuntimeError,
#if PY_MAJOR_VERSION >= 3
                    "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'",
                    value_type_name, key, type_name);
#else
                    "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'",
                    value_type_name,
                    PyString_Check(key) ? PyString_AS_STRING(key) : "?",
                    type_name);
#endif
                goto bad;
            } else {
                Py_DECREF(tmp);
            }
        }
        else if (unlikely(PyErr_Occurred())) {
            goto bad;
        }
    }
    Py_DECREF(names_to_set);
    return 0;
bad:
    Py_XDECREF(names_to_set);
    return -1;
}
static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) {
#if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyTypeObject *type = (PyTypeObject*) type_obj;
    PyObject *mro = type->tp_mro;
    Py_ssize_t i, nbases;
    if (unlikely(!mro)) goto done;
    (void) &__Pyx_GetBuiltinName;
    Py_INCREF(mro);
    nbases = PyTuple_GET_SIZE(mro);
    assert(PyTuple_GET_ITEM(mro, 0) == type_obj);
    for (i = 1; i < nbases-1; i++) {
        PyObject *base, *dict, *meth;
        base = PyTuple_GET_ITEM(mro, i);
        dict = ((PyTypeObject *)base)->tp_dict;
        meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass);
        if (unlikely(meth)) {
            descrgetfunc f = Py_TYPE(meth)->tp_descr_get;
            PyObject *res;
            Py_INCREF(meth);
            if (likely(f)) {
                res = f(meth, NULL, type_obj);
                Py_DECREF(meth);
                if (unlikely(!res)) goto bad;
                meth = res;
            }
            res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw);
            Py_DECREF(meth);
            if (unlikely(!res)) goto bad;
            Py_DECREF(res);
            goto done;
        } else if (unlikely(PyErr_Occurred())) {
            goto bad;
        }
    }
done:
    Py_XDECREF(mro);
    return type_obj;
bad:
    Py_XDECREF(mro);
    Py_DECREF(type_obj);
    return NULL;
#else
    PyObject *super_type, *super, *func, *res;
#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
    super_type = __Pyx_GetBuiltinName(__pyx_n_s_super);
#else
    super_type = (PyObject*) &PySuper_Type;
    (void) &__Pyx_GetBuiltinName;
#endif
    super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL;
#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
    Py_XDECREF(super_type);
#endif
    if (unlikely(!super)) {
        Py_CLEAR(type_obj);
        goto done;
    }
    func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass);
    Py_DECREF(super);
    if (likely(!func)) {
        if (unlikely(PyErr_Occurred()))
            Py_CLEAR(type_obj);
        goto done;
    }
    res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw);
    Py_DECREF(func);
    if (unlikely(!res))
        Py_CLEAR(type_obj);
    Py_XDECREF(res);
done:
    return type_obj;
#endif
}
#endif
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result;
    PyObject *owned_metaclass = NULL;
    PyObject *margs[4] = {NULL, name, bases, dict};
    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;
    }
    result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET,
#if PY_VERSION_HEX < 0x030600A4
        (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw
#else
        mkw
#endif
    );
    Py_XDECREF(owned_metaclass);
#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
    if (likely(result) && likely(PyType_Check(result))) {
        if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) {
            Py_CLEAR(result);
        } else {
            result = __Pyx_InitSubclassPEP487(result, mkw);
        }
    }
#else
    (void) &__Pyx_GetBuiltinName;
#endif
    return result;
}

/* PatchInspect */
  static PyObject* __Pyx_patch_inspect(PyObject* module) {
#if defined(__Pyx_Generator_USED) && (!defined(CYTHON_PATCH_INSPECT) || CYTHON_PATCH_INSPECT)
    static int inspect_patched = 0;
    if (unlikely((!inspect_patched) && module)) {
        module = __Pyx_Coroutine_patch_module(
            module, ""
"old_types = getattr(_module.isgenerator, '_cython_generator_types', None)\n"
"if old_types is None or not isinstance(old_types, set):\n"
"    old_types = set()\n"
"    def cy_wrap(orig_func, type=type, cython_generator_types=old_types):\n"
"        def cy_isgenerator(obj): return type(obj) in cython_generator_types or orig_func(obj)\n"
"        cy_isgenerator._cython_generator_types = cython_generator_types\n"
"        return cy_isgenerator\n"
"    _module.isgenerator = cy_wrap(_module.isgenerator)\n"
"old_types.add(_cython_generator_type)\n"
        );
        inspect_patched = 1;
    }
#else
    if ((0)) return __Pyx_Coroutine_patch_module(module, NULL);
#endif
    return module;
}

/* GetNameInClass */
  static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    PyObject *dict;
    assert(PyType_Check(nmspace));
#if CYTHON_USE_TYPE_SLOTS
    dict = ((PyTypeObject*)nmspace)->tp_dict;
    Py_XINCREF(dict);
#else
    dict = PyObject_GetAttr(nmspace, __pyx_n_s_dict);
#endif
    if (likely(dict)) {
        result = PyObject_GetItem(dict, name);
        Py_DECREF(dict);
        if (result) {
            return result;
        }
    }
    PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}

/* ClassMethod */
  static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (PyMethodDescr_Check(method))
#else
    #if PY_MAJOR_VERSION == 2
    static PyTypeObject *methoddescr_type = NULL;
    if (unlikely(methoddescr_type == NULL)) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (unlikely(!meth)) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    #else
    PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
    #endif
    if (__Pyx_TypeCheck(method, methoddescr_type))
#endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else {
        return PyClassMethod_New(method);
    }
}

/* RegisterModuleCleanup */
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject* __pyx_module_cleanup_atexit(PyObject *module, PyObject *unused) {
    CYTHON_UNUSED_VAR(unused);
    __pyx_module_cleanup(module);
    Py_INCREF(Py_None); return Py_None;
}
static int __Pyx_RegisterCleanup(void) {
    static PyMethodDef cleanup_def = {
        "__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 = PyImport_ImportModule("atexit");
    if (!atexit)
        goto bad;
    reg = PyObject_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 = PyObject_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;
}
#endif

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  #if !CYTHON_COMPILING_IN_LIMITED_API
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 - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}
#endif

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result;
        result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    #if __PYX_LIMITED_VERSION_HEX < 0x030780000
    {
        PyObject *compiled = NULL, *result = NULL;
        if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
        if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
        compiled = Py_CompileString(
            "out = type(code)(\n"
            "  code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
            "  code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
            "  code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
            "  code.co_lnotab)\n", "<dummy>", Py_file_input);
        if (!compiled) return NULL;
        result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
        Py_DECREF(compiled);
        if (!result) PyErr_Print();
        Py_DECREF(result);
        result = PyDict_GetItemString(scratch_dict, "out");
        if (result) Py_INCREF(result);
        return result;
    }
    #else
    return NULL;
    #endif
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        (void) __pyx_cfilenm;
        (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
    if (unlikely(!code_object)) goto bad;
    py_py_line = PyLong_FromLong(py_line);
    if (unlikely(!py_py_line)) goto bad;
    py_funcname = PyUnicode_FromString(funcname);
    if (unlikely(!py_funcname)) goto bad;
    dict = PyDict_New();
    if (unlikely(!dict)) goto bad;
    {
        PyObject *old_code_object = code_object;
        code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
        Py_DECREF(old_code_object);
    }
    if (unlikely(!code_object)) goto bad;
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* UnicodeAsUCS4 */
  static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
   Py_ssize_t length;
   #if CYTHON_PEP393_ENABLED
   length = PyUnicode_GET_LENGTH(x);
   if (likely(length == 1)) {
       return PyUnicode_READ_CHAR(x, 0);
   }
   #else
   length = PyUnicode_GET_SIZE(x);
   if (likely(length == 1)) {
       return PyUnicode_AS_UNICODE(x)[0];
   }
   #if Py_UNICODE_SIZE == 2
   else if (PyUnicode_GET_SIZE(x) == 2) {
       Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
       if (high_val >= 0xD800 && high_val <= 0xDBFF) {
           Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
           if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
               return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
           }
       }
   }
   #endif
   #endif
   PyErr_Format(PyExc_ValueError,
                "only single character unicode strings can be converted to Py_UCS4, "
                "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
   return (Py_UCS4)-1;
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                                return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                                return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                                return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(int) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                                return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                                return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                                return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                                return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(int) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (int) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (int) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (int) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (int) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (int) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((int) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((int) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlParserErrors(xmlParserErrors value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlParserErrors neg_one = (xmlParserErrors) -1, const_zero = (xmlParserErrors) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(xmlParserErrors) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(xmlParserErrors) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlParserErrors) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(xmlParserErrors) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlParserErrors) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(xmlParserErrors),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlParserErrors));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                                return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                                return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                                return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(size_t) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                                return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                                return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                                return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                                return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(size_t) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (size_t) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (size_t) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (size_t) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (size_t) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (size_t) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((size_t) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((size_t) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
  static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(unsigned int) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                                return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                                return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) {
                                return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(unsigned int) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (unsigned int) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (unsigned int) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (unsigned int) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (unsigned int) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (unsigned int) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((unsigned int) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((unsigned int) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE signed char __Pyx_PyInt_As_signed_char(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const signed char neg_one = (signed char) -1, const_zero = (signed char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(signed char) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(signed char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (signed char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(signed char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(signed char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) >= 2 * PyLong_SHIFT)) {
                                return (signed char) (((((signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(signed char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) >= 3 * PyLong_SHIFT)) {
                                return (signed char) (((((((signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(signed char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) >= 4 * PyLong_SHIFT)) {
                                return (signed char) (((((((((signed char)digits[3]) << PyLong_SHIFT) | (signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (signed char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(signed char) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(signed char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(signed char) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(signed char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(signed char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(signed char) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 2 * PyLong_SHIFT)) {
                                return (signed char) (((signed char)-1)*(((((signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(signed char) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 2 * PyLong_SHIFT)) {
                                return (signed char) ((((((signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(signed char) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 3 * PyLong_SHIFT)) {
                                return (signed char) (((signed char)-1)*(((((((signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(signed char) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 3 * PyLong_SHIFT)) {
                                return (signed char) ((((((((signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(signed char) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 4 * PyLong_SHIFT)) {
                                return (signed char) (((signed char)-1)*(((((((((signed char)digits[3]) << PyLong_SHIFT) | (signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(signed char) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(signed char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(signed char) - 1 > 4 * PyLong_SHIFT)) {
                                return (signed char) ((((((((((signed char)digits[3]) << PyLong_SHIFT) | (signed char)digits[2]) << PyLong_SHIFT) | (signed char)digits[1]) << PyLong_SHIFT) | (signed char)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(signed char) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(signed char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(signed char) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(signed char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            signed char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (signed char) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (signed char) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (signed char) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (signed char) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (signed char) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(signed char) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((signed char) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(signed char) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((signed char) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((signed char) 1) << (sizeof(signed char) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (signed char) -1;
        }
    } else {
        signed char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (signed char) -1;
        val = __Pyx_PyInt_As_signed_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to signed char");
    return (signed char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to signed char");
    return (signed char) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(unsigned short) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 2 * PyLong_SHIFT)) {
                                return (unsigned short) (((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned short) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 3 * PyLong_SHIFT)) {
                                return (unsigned short) (((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned short) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) >= 4 * PyLong_SHIFT)) {
                                return (unsigned short) (((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(unsigned short) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(unsigned short) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(unsigned short) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(unsigned short) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(unsigned short) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((((unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(unsigned short) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned short) (((unsigned short)-1)*(((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(unsigned short) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(unsigned short) - 1 > 4 * PyLong_SHIFT)) {
                                return (unsigned short) ((((((((((unsigned short)digits[3]) << PyLong_SHIFT) | (unsigned short)digits[2]) << PyLong_SHIFT) | (unsigned short)digits[1]) << PyLong_SHIFT) | (unsigned short)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(unsigned short) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(unsigned short) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned short, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            unsigned short val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (unsigned short) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (unsigned short) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (unsigned short) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (unsigned short) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (unsigned short) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(unsigned short) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((unsigned short) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(unsigned short) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((unsigned short) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((unsigned short) 1) << (sizeof(unsigned short) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (unsigned short) -1;
        }
    } else {
        unsigned short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned short) -1;
        val = __Pyx_PyInt_As_unsigned_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned short");
    return (unsigned short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned short");
    return (unsigned short) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const char neg_one = (char) -1, const_zero = (char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(char),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(char));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
  static CYTHON_INLINE xmlChar __Pyx_PyInt_As_xmlChar(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlChar neg_one = (xmlChar) -1, const_zero = (xmlChar) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(xmlChar) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(xmlChar, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (xmlChar) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlChar, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(xmlChar) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 2 * PyLong_SHIFT)) {
                                return (xmlChar) (((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlChar) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 3 * PyLong_SHIFT)) {
                                return (xmlChar) (((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlChar) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) >= 4 * PyLong_SHIFT)) {
                                return (xmlChar) (((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (xmlChar) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(xmlChar) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(xmlChar) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(xmlChar, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(xmlChar) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(xmlChar) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(xmlChar) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(xmlChar) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((((xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(xmlChar) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlChar) (((xmlChar)-1)*(((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(xmlChar) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(xmlChar, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(xmlChar) - 1 > 4 * PyLong_SHIFT)) {
                                return (xmlChar) ((((((((((xmlChar)digits[3]) << PyLong_SHIFT) | (xmlChar)digits[2]) << PyLong_SHIFT) | (xmlChar)digits[1]) << PyLong_SHIFT) | (xmlChar)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(xmlChar) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(xmlChar) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(xmlChar, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            xmlChar val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (xmlChar) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (xmlChar) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (xmlChar) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (xmlChar) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (xmlChar) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(xmlChar) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((xmlChar) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(xmlChar) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((xmlChar) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((xmlChar) 1) << (sizeof(xmlChar) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (xmlChar) -1;
        }
    } else {
        xmlChar val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (xmlChar) -1;
        val = __Pyx_PyInt_As_xmlChar(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to xmlChar");
    return (xmlChar) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to xmlChar");
    return (xmlChar) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlErrorDomain(xmlErrorDomain value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlErrorDomain neg_one = (xmlErrorDomain) -1, const_zero = (xmlErrorDomain) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(xmlErrorDomain) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(xmlErrorDomain) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlErrorDomain) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(xmlErrorDomain) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlErrorDomain) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(xmlErrorDomain),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlErrorDomain));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_xmlErrorLevel(xmlErrorLevel value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const xmlErrorLevel neg_one = (xmlErrorLevel) -1, const_zero = (xmlErrorLevel) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(xmlErrorLevel) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(xmlErrorLevel) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlErrorLevel) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(xmlErrorLevel) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(xmlErrorLevel) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        return _PyLong_FromByteArray(bytes, sizeof(xmlErrorLevel),
                                     little, !is_unsigned);
#else
        PyObject *from_bytes, *result = NULL;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(xmlErrorLevel));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* BytesContains */
  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);
    return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
}

/* ObjectAsUCS4 */
  static Py_UCS4 __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
   if (ival < 0) {
       if (!PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "cannot convert negative value to Py_UCS4");
   } else {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to Py_UCS4");
   }
   return (Py_UCS4)-1;
}
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
   long ival;
   ival = __Pyx_PyInt_As_long(x);
   if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
       return __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
   }
   return (Py_UCS4)ival;
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(long) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            if (unlikely(__Pyx_PyLong_IsNeg(x))) {
                goto raise_neg_overflow;
            } else if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_DigitCount(x)) {
                    case 2:
                        if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                                return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                                return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                                return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                            }
                        }
                        break;
                }
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if ((sizeof(long) <= sizeof(unsigned long))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            if (__Pyx_PyLong_IsCompact(x)) {
                __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
            } else {
                const digit* digits = __Pyx_PyLong_Digits(x);
                assert(__Pyx_PyLong_DigitCount(x) > 1);
                switch (__Pyx_PyLong_SignedDigitCount(x)) {
                    case -2:
                        if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 2:
                        if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                                return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case -3:
                        if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 3:
                        if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                                return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case -4:
                        if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                                return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                    case 4:
                        if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                            if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                                __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                            } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                                return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                            }
                        }
                        break;
                }
            }
#endif
            if ((sizeof(long) <= sizeof(long))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 ret = -1;
#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                ret = _PyLong_AsByteArray((PyLongObject *)v,
                                           bytes, sizeof(val),
                                           is_little, !is_unsigned);
#else
                PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
                int bits, remaining_bits, is_negative = 0;
                long idigit;
                int chunk_size = (sizeof(long) < 8) ? 30 : 62;
                if (unlikely(!PyLong_CheckExact(v))) {
                    PyObject *tmp = v;
                    v = PyNumber_Long(v);
                    assert(PyLong_CheckExact(v));
                    Py_DECREF(tmp);
                    if (unlikely(!v)) return (long) -1;
                }
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                if (Py_SIZE(x) == 0)
                    return (long) 0;
                is_negative = Py_SIZE(x) < 0;
#else
                {
                    int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                    if (unlikely(result < 0))
                        return (long) -1;
                    is_negative = result == 1;
                }
#endif
                if (is_unsigned && unlikely(is_negative)) {
                    goto raise_neg_overflow;
                } else if (is_negative) {
                    stepval = PyNumber_Invert(v);
                    if (unlikely(!stepval))
                        return (long) -1;
                } else {
                    stepval = __Pyx_NewRef(v);
                }
                val = (long) 0;
                mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
                shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
                for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
                    PyObject *tmp, *digit;
                    digit = PyNumber_And(stepval, mask);
                    if (unlikely(!digit)) goto done;
                    idigit = PyLong_AsLong(digit);
                    Py_DECREF(digit);
                    if (unlikely(idigit < 0)) goto done;
                    tmp = PyNumber_Rshift(stepval, shift);
                    if (unlikely(!tmp)) goto done;
                    Py_DECREF(stepval); stepval = tmp;
                    val |= ((long) idigit) << bits;
                    #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
                    if (Py_SIZE(stepval) == 0)
                        goto unpacking_done;
                    #endif
                }
                idigit = PyLong_AsLong(stepval);
                if (unlikely(idigit < 0)) goto done;
                remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
                if (unlikely(idigit >= (1L << remaining_bits)))
                    goto raise_overflow;
                val |= ((long) idigit) << bits;
            #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
            unpacking_done:
            #endif
                if (!is_unsigned) {
                    if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                        goto raise_overflow;
                    if (is_negative)
                        val = ~val;
                }
                ret = 0;
            done:
                Py_XDECREF(shift);
                Py_XDECREF(mask);
                Py_XDECREF(stepval);
#endif
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CheckBinaryVersion */
  static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
    return Py_Version & ~0xFFUL;
#else
    const char* rt_version = Py_GetVersion();
    unsigned long version = 0;
    unsigned long factor = 0x01000000UL;
    unsigned int digit = 0;
    int i = 0;
    while (factor) {
        while ('0' <= rt_version[i] && rt_version[i] <= '9') {
            digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
            ++i;
        }
        version += factor * digit;
        if (rt_version[i] != '.')
            break;
        digit = 0;
        factor >>= 8;
        ++i;
    }
    return version;
#endif
}
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* FunctionExport */
  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;
    cobj = PyCapsule_New(tmp.p, sig, 0);
    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;
}

/* InitStrings */
  #if PY_MAJOR_VERSION >= 3
static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
    if (t.is_unicode | t.is_str) {
        if (t.intern) {
            *str = PyUnicode_InternFromString(t.s);
        } else if (t.encoding) {
            *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
        } else {
            *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
        }
    } else {
        *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
    }
    if (!*str)
        return -1;
    if (PyObject_Hash(*str) == -1)
        return -1;
    return 0;
}
#endif
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION >= 3
        __Pyx_InitString(*t, t->p);
        #else
        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);
        }
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        #endif
        ++t;
    }
    return 0;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const 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)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
                 type_name, type_name, result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
